diff --git a/docs/features/source-view.md b/docs/features/source-view.md index fb7f59cf02..5d67ccc198 100644 --- a/docs/features/source-view.md +++ b/docs/features/source-view.md @@ -58,6 +58,8 @@ On macOS, use Cmd where Ctrl is shown, and Option+Backspace / Option+Delete for The same commands — plus find, replace and go to line — are in the editor's right-click menu. +**F1** opens this help page. + ## See also - [Edit Menu](edit.md) — find and replace across subtitle lines rather than raw source diff --git a/src/ui/Features/Shared/SourceView/SourceViewViewModel.cs b/src/ui/Features/Shared/SourceView/SourceViewViewModel.cs index a32c50a3c3..2a593f41fe 100644 --- a/src/ui/Features/Shared/SourceView/SourceViewViewModel.cs +++ b/src/ui/Features/Shared/SourceView/SourceViewViewModel.cs @@ -14,6 +14,7 @@ using Nikse.SubtitleEdit.Logic; using Nikse.SubtitleEdit.Logic.Config; using System; +using System.Globalization; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -220,7 +221,10 @@ private void UpdateCaretInfo() var document = _editor.Document; var position = document.GetPosition(_editor.CaretOffset); - LineAndColumnInfo = string.Format(Se.Language.General.LineXColumnY, position.Line + 1, position.Column + 1); + LineAndColumnInfo = string.Format( + Se.Language.General.LineXColumnY, + Grouped(position.Line + 1), + Grouped(position.Column + 1)); var selectionLength = _editor.SelectionLength; if (selectionLength == 0) @@ -233,10 +237,16 @@ private void UpdateCaretInfo() var lastLine = document.GetPosition(_editor.SelectionStart + selectionLength).Line; SelectionInfo = string.Format( Se.Language.SourceView.SelectedXCharactersYLines, - selectionLength, - lastLine - firstLine + 1); + Grouped(selectionLength), + Grouped(lastLine - firstLine + 1)); } + /// + /// A source file runs to tens of thousands of lines and characters, so the status line counts + /// are only readable with thousand separators. + /// + private static string Grouped(int value) => value.ToString("#,##0", CultureInfo.CurrentCulture); + private void ValidationTimerTick(object? sender, EventArgs e) { _validationTimer.Stop(); @@ -260,7 +270,7 @@ internal void Validate() if (source.Length > MaxValidationTextLength) { IsValidationError = false; - ValidationInfo = string.Format(Se.Language.SourceView.XLinesYSubtitles, lineCount, "?"); + ValidationInfo = string.Format(Se.Language.SourceView.XLinesYSubtitles, Grouped(lineCount), "?"); return; } @@ -293,8 +303,12 @@ internal void Validate() var errorCount = _subtitleFormat.ErrorCount; IsValidationError = errorCount > 0; ValidationInfo = errorCount > 0 - ? string.Format(Se.Language.SourceView.XLinesYSubtitlesZErrors, lineCount, subtitle.Paragraphs.Count, errorCount) - : string.Format(Se.Language.SourceView.XLinesYSubtitles, lineCount, subtitle.Paragraphs.Count); + ? string.Format( + Se.Language.SourceView.XLinesYSubtitlesZErrors, + Grouped(lineCount), + Grouped(subtitle.Paragraphs.Count), + Grouped(errorCount)) + : string.Format(Se.Language.SourceView.XLinesYSubtitles, Grouped(lineCount), Grouped(subtitle.Paragraphs.Count)); } // ---------------------------------------------------------------------------------------- @@ -692,6 +706,14 @@ internal void OnKeyDown(object? sender, KeyEventArgs e) : (e.KeyModifiers & KeyModifiers.Control) != 0; var shift = (e.KeyModifiers & KeyModifiers.Shift) != 0; + // Help is user-configurable, so it cannot be a case in the switch below. + if (UiUtil.IsHelp(e)) + { + e.Handled = true; + UiUtil.ShowHelp("features/source-view"); + return; + } + switch (e.Key) { case Key.Escape: