From b39cc2b146a4119bba055c09f0e28789d8c4bf34 Mon Sep 17 00:00:00 2001 From: Thomas Wilson Date: Thu, 20 Jan 2022 21:21:28 -0800 Subject: [PATCH 1/3] new hotkeys added Delete Line hotkey (^L) added a second keybind for Search+Replace (^H) --- source/ide/ide_methods.bas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index dbfdf09b2..ca0edf788 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -1821,8 +1821,10 @@ FUNCTION ide2 (ignore) GOTO ideQuickKeycode END IF - - IF KCTRL AND KB = KEY_F3 THEN + 'Alt+F3 + 'Control+H + 'Find and replace + IF (KALT AND KB = KEY_F3) or (KCTRL AND ucase$(k$)="H") THEN IF IdeSystem = 3 THEN IdeSystem = 1 GOTO idefindjmp END IF @@ -3436,6 +3438,14 @@ FUNCTION ide2 (ignore) END IF + if KCONTROL AND UCASE$(K$) = "L" THEN 'delete line + if iden > 1 then + idedelline idecy + else + idesetline idecy, "" + endif + if idecy > iden then idecy = iden + endif IF KCONTROL AND UCASE$(K$) = "Y" THEN 'redo (CTRL+Y) idemredo: From 7178031a35a0fe8a9e212ab1f587edab904ce484 Mon Sep 17 00:00:00 2001 From: Tom Wilson Date: Fri, 21 Jan 2022 13:09:42 -0800 Subject: [PATCH 2/3] delete line honors selected text. ^H replace on correct sub The ^L delete line shortcut now deletes all lines with selected text. If the cursor is on the start of a line and no text is selected on that line, that line is also deleted. I had previously added the ^H shortcut to the wrong code block in ide_methods.bas. I moved that to the correct code block (the same as Alt-F3) so ^H now opens the Search And Replace dialog, consistent with other code editors on Windows. --- source/ide/ide_methods.bas | 63 ++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index ca0edf788..d34529be3 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -1821,15 +1821,17 @@ FUNCTION ide2 (ignore) GOTO ideQuickKeycode END IF - 'Alt+F3 - 'Control+H - 'Find and replace - IF (KALT AND KB = KEY_F3) or (KCTRL AND ucase$(k$)="H") THEN + 'Control+F3 + 'Find dialog + IF KCTRL and KB = KEY_F3 THEN IF IdeSystem = 3 THEN IdeSystem = 1 GOTO idefindjmp END IF - IF KALT AND KB = KEY_F3 THEN + 'Alt+F3 + 'Control+H + 'Find and replace + IF (KALT AND KB = KEY_F3) OR (KCTRL AND UCASE$(K$)="H") THEN IF IdeSystem = 3 THEN IdeSystem = 1 GOTO idefindchangejmp END IF @@ -3438,14 +3440,49 @@ FUNCTION ide2 (ignore) END IF - if KCONTROL AND UCASE$(K$) = "L" THEN 'delete line - if iden > 1 then - idedelline idecy - else - idesetline idecy, "" - endif - if idecy > iden then idecy = iden - endif + 'Control+L + 'Delete Line + if KCONTROL AND UCASE$(K$) = "L" THEN + + ' DEBUG + ' _console on + ' _echo "ideselect=" + str$(ideselect) + ' _echo "idecx=" + str$(idecx) + ' _echo "idecy=" + str$(idecy) + ' _echo "idesx=" + str$(idesx) + ' _echo "idesy=" + str$(idesy) + ' _echo "ideselectx1=" + str$(ideselectx1) + ' _echo "ideselecty1=" + str$(ideselecty1) + ' _echo "idel=" + str$(idel) + ' _echo "ideli=" + str$(ideli) + ' _echo "iden=" + str$(iden) + ' _echo "" + ' + if ideselect then + ' get total number of lines to delete + del_count = abs(idecy - ideselecty1) + 1 + ' make sure we get the top line selected in case user selected bottom-up + if idecy < ideselecty1 then + del_y = idecy + else + del_y = ideselecty1 + end if + else + del_count= 1 + del_y = idecy + end if + + ' delete all selected lines + for del_n = 1 to del_count + if iden > 1 then + idedelline del_y + else + idesetline del_y, "" + endif + if idecy > iden then idecy = iden + ideselect = 0 + next + endif IF KCONTROL AND UCASE$(K$) = "Y" THEN 'redo (CTRL+Y) idemredo: From e43b910aa278193dec474db2549fad047f5a0a22 Mon Sep 17 00:00:00 2001 From: Thomas Wilson Date: Sat, 22 Jan 2022 17:00:20 -0800 Subject: [PATCH 3/3] move cursor to top of selection when deleting multiple lines If you select more than one line and hit ^L to delete the whole block, the cursor ends up in the wrong place. This fix will put the cursor at the top of the selected block, so if you remove 2 or more lines, you're in the right spot afterward. --- source/ide/ide_methods.bas | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/source/ide/ide_methods.bas b/source/ide/ide_methods.bas index d34529be3..8318a57d8 100644 --- a/source/ide/ide_methods.bas +++ b/source/ide/ide_methods.bas @@ -896,34 +896,6 @@ FUNCTION ide2 (ignore) idefocusline = 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 'main loop DO ideloop: @@ -3479,6 +3451,7 @@ FUNCTION ide2 (ignore) else idesetline del_y, "" endif + idecy = del_y if idecy > iden then idecy = iden ideselect = 0 next