Bläddra i källkod

Handle Alt+R conflict just like VSCode. And make it Ctrl+Alt+R when using classic menu keys.

Martijn Laan 1 år sedan
förälder
incheckning
495fcfde1d
3 ändrade filer med 15 tillägg och 9 borttagningar
  1. 0 1
      Projects/Src/IDE.MainForm.dfm
  2. 14 7
      Projects/Src/IDE.MainForm.pas
  3. 1 1
      whatsnew.htm

+ 0 - 1
Projects/Src/IDE.MainForm.dfm

@@ -565,7 +565,6 @@ object MainForm: TMainForm
       end
       end
       object EFindRegEx: TMenuItem
       object EFindRegEx: TMenuItem
         Caption = 'Use Regular E&xpressions'
         Caption = 'Use Regular E&xpressions'
-        ShortCut = 32850
         OnClick = EFindRegExClick
         OnClick = EFindRegExClick
       end
       end
       object N13: TMenuItem
       object N13: TMenuItem

+ 14 - 7
Projects/Src/IDE.MainForm.pas

@@ -3856,13 +3856,19 @@ end;
 
 
 procedure TMainForm.EFindRegExClick(Sender: TObject);
 procedure TMainForm.EFindRegExClick(Sender: TObject);
 begin
 begin
-  FOptions.FindRegEx := not FOptions.FindRegEx;
-  UpdateFindRegExPanel;
-  var Ini := TConfigIniFile.Create;
-  try
-    Ini.WriteBool('Options', 'FindRegEx', FOptions.FindRegEx);
-  finally
-    Ini.Free;
+  { If EFindRegEx uses Alt+R as the shortcut just like VSCode then also handle it like VSCode:
+    when the memo does not have the focus open the Run menu (also Alt+R) instead }
+  if not FActiveMemo.Focused and (EFindRegEx.ShortCut = ShortCut(Ord('R'), [ssAlt])) then
+    SendMessage(Handle, WM_SYSCOMMAND, SC_KEYMENU, Ord('r'))
+  else begin
+    FOptions.FindRegEx := not FOptions.FindRegEx;
+    UpdateFindRegExPanel;
+    var Ini := TConfigIniFile.Create;
+    try
+      Ini.WriteBool('Options', 'FindRegEx', FOptions.FindRegEx);
+    finally
+      Ini.Free;
+    end;
   end;
   end;
 end;
 end;
 
 
@@ -6174,6 +6180,7 @@ type
 
 
 begin
 begin
   var KeyMappedMenus := [
   var KeyMappedMenus := [
+    KMM(EFindRegEx, Ord('R'), [ssCtrl, ssAlt], Ord('R'), [ssAlt]),
     KMM(BCompile, VK_F9, [ssCtrl], Ord('B'), [ssCtrl], CompileButton),
     KMM(BCompile, VK_F9, [ssCtrl], Ord('B'), [ssCtrl], CompileButton),
     KMM(RRun, VK_F9, [], VK_F5, [], RunButton),
     KMM(RRun, VK_F9, [], VK_F5, [], RunButton),
     KMM(RRunToCursor, VK_F4, [], VK_F10, [ssCtrl]),
     KMM(RRunToCursor, VK_F4, [], VK_F10, [ssCtrl]),

+ 1 - 1
whatsnew.htm

@@ -55,7 +55,7 @@ For conditions of distribution and use, see <a href="files/is/license.txt">LICEN
   <li>Added autocompletion support for all Pascal Scripting support functions, types, constants, etcetera. Existing option <i>Invoke autocompletion automatically</i> controls whether the autocompletion suggestions appear automatically or only when invoked manually by pressing Ctrl+Space or Ctrl+I.</li>
   <li>Added autocompletion support for all Pascal Scripting support functions, types, constants, etcetera. Existing option <i>Invoke autocompletion automatically</i> controls whether the autocompletion suggestions appear automatically or only when invoked manually by pressing Ctrl+Space or Ctrl+I.</li>
   <li>Added parameter hints and autocompletion support for all Pascal Scripting support class members and properties. Both always show all classes' members and properties instead of just those of the object's class.</li>
   <li>Added parameter hints and autocompletion support for all Pascal Scripting support class members and properties. Both always show all classes' members and properties instead of just those of the object's class.</li>
   <li>Added new <i>Enable section folding</i> option which allows you to temporarily hide sections while editing by clicking the new minus or plus icons in the editor's gutter or by using the new keyboard shortcuts (Ctrl+Shift+[ to fold and Ctrl+Shift+] to unfold) or menu items. Enabled by default.</li>
   <li>Added new <i>Enable section folding</i> option which allows you to temporarily hide sections while editing by clicking the new minus or plus icons in the editor's gutter or by using the new keyboard shortcuts (Ctrl+Shift+[ to fold and Ctrl+Shift+] to unfold) or menu items. Enabled by default.</li>
-  <li>Added new <i>Use Regular Expressions</i> option to the <i>Edit</i> menu to enable or disable the use of regular expressions for all find and replace operations and added a shortcut for it (Alt+R). Also added a small panel to the statusbar to indicate the current state.</li>
+  <li>Added new <i>Use Regular Expressions</i> option to the <i>Edit</i> menu to enable or disable the use of regular expressions for all find and replace operations and added a shortcut for it (Ctrl+Alt+R or Alt+R). Also added a small panel to the statusbar to indicate the current state.</li>
   <li>The editor's gutter now shows change history to keep track of saved and unsaved modifications. Always enabled.</li>
   <li>The editor's gutter now shows change history to keep track of saved and unsaved modifications. Always enabled.</li>
   <li>The editor's font now defaults to Consolas if available, consistent with most other modern editors.</li>
   <li>The editor's font now defaults to Consolas if available, consistent with most other modern editors.</li>
   <li>The editor can now be scrolled horizontally instead of vertically by holding the Shift key while rotating the mouse wheel. Horizontal scroll wheels are now also supported.</li>
   <li>The editor can now be scrolled horizontally instead of vertically by holding the Shift key while rotating the mouse wheel. Horizontal scroll wheels are now also supported.</li>