-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new hotkeys #219
base: development
Are you sure you want to change the base?
new hotkeys #219
Conversation
added Delete Line hotkey (^L) added a second keybind for Search+Replace (^H)
may i suggest also Ctrl+q to exit? I use this often and was actually trying to fix it myself but i gave up bc im not very good with navigating the QB64 source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The section that does find/replace is actually a few lines after that, at 1830..1833;
- For ^L, you might wanna cater for when there's an active selection (what do other IDEs do in that case?)
Hmm... I thought I just added a second key sequence to the existing find/replace code. I'll re-check that.
Notepad++ and Visual Studio both delete every line that has selected text, including the line with the cursor (whether or not text on the cursor line is selected.) So that sounds like the approach to take. I haven't dug into QB64's text selection mechanism yet, so I'll take a look at that tonight. |
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.
I have updated the source file. The ^L shortcut now checks the ideselected flag and counts the number of selected lines. It removes all selected lines and checks on each iteration to ensure the cursor is still on a valid line and that there is at least one line in the buffer. (The IDE crashes if you delete the only line. That's probably worth a future fix.) I also moved the ^H shortcut to the correct code block (Search/Replace, rather than Search.) I guess I should not be merging two different branches of code at 2 AM. I saw a request for ^Q by auowt. PM me on the forum or via Discord and I'll show you how to add your own hotkeys. |
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.
Added another fix. This moves the cursor to the start of the selection. Previously, if you selected lines 11-15 and then deleted them, the cursor would still be on line 15. This change moves the cursor to line 11. |
added Delete Line hotkey (Control+L)
added a second keybind for Search+Replace (Control+H)
These two hotkeys are common in Windows code editors (Visual Studio, Notepad++), and I find myself deleting lines a lot. Same with Search/Replace. ^H is easier to hit than Alt+F3, and it's also the standard binding in all of the editors I use regularly.