2
0
Эх сурвалжийг харах

Add a debug option (so no UI for it) to show raw CaretPosition in the statusbar.

Martijn Laan 1 жил өмнө
parent
commit
258d82c10b

+ 11 - 1
Projects/Src/CompForm.pas

@@ -407,6 +407,7 @@ type
       ThemeType: TThemeType;
       ThemeType: TThemeType;
       ShowPreprocessorOutput: Boolean;
       ShowPreprocessorOutput: Boolean;
       OpenIncludedFiles: Boolean;
       OpenIncludedFiles: Boolean;
+      ShowCaretPosition: Boolean;
     end;
     end;
     FOptionsLoaded: Boolean;
     FOptionsLoaded: Boolean;
     FTheme: TTheme;
     FTheme: TTheme;
@@ -801,6 +802,12 @@ constructor TCompileForm.Create(AOwner: TComponent);
       for Memo in FMemos do
       for Memo in FMemos do
         if Memo <> FMainMemo then
         if Memo <> FMainMemo then
           Memo.Font := FMainMemo.Font;
           Memo.Font := FMainMemo.Font;
+
+      { Debug options }
+      FOptions.ShowCaretPosition := Ini.ReadBool('Options', 'ShowCaretPosition', False);
+      if FOptions.ShowCaretPosition then
+        StatusBar.Panels[spCaretPos].Width := StatusBar.Panels[spCaretPos].Width * 2;
+
       SyncEditorOptions;
       SyncEditorOptions;
       UpdateNewMainFileButtons;
       UpdateNewMainFileButtons;
       UpdateKeyMapping;
       UpdateKeyMapping;
@@ -4429,8 +4436,11 @@ end;
 procedure TCompileForm.UpdateCaretPosPanelAndBackNavStack;
 procedure TCompileForm.UpdateCaretPosPanelAndBackNavStack;
 begin
 begin
   { Update panel }
   { Update panel }
-  StatusBar.Panels[spCaretPos].Text := Format('%4d:%4d', [FActiveMemo.CaretLine + 1,
+  var Text := Format('%4d:%4d', [FActiveMemo.CaretLine + 1,
     FActiveMemo.CaretColumnExpandedForTabs + 1]);
     FActiveMemo.CaretColumnExpandedForTabs + 1]);
+  if FOptions.ShowCaretPosition then
+    Text := Format('%5d:%s', [FActiveMemo.CaretPosition, Text]);
+  StatusBar.Panels[spCaretPos].Text := Text;
 
 
   { Update NavStacks.Back if needed and remember new position }
   { Update NavStacks.Back if needed and remember new position }
   var NewNavItem := TCompScintEditNavItem.Create(FActiveMemo); { This is a record so no need to free }
   var NewNavItem := TCompScintEditNavItem.Create(FActiveMemo); { This is a record so no need to free }