Created attachment 176348 [details] Screenshots illustrating the proposal Nowadays, text editors and IDEs have a common behavior: if you're editing a line of code and press "Home", the cursor will move to the first character in the same line that is not a blank space or Tab. However, on LO Basic IDE, pressing Home will move the cursor to position 1 in the same line regardless of its contents and indentation. So I would like to suggest to implement this behavior in Basic IDE, so that when "Home" is pressed, the cursor would be placed in the first non-blank character (see attached ODG file for a better explanation).
Andreas, Alain, what do you think?
+1 from my side. I would implement it as all the other IDEs: "Home" key pressed and not being on position 1: move cursor to the non whitespace character in the corresponding line "Home" key pressed and cursor being at first non whitespace character: move the cursor to position 1
Yes, the second Home (or pressing at line start) goes to the very beginning of the line.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/809236ed826b67328409e008313dea87de6d5243 tdf#145764 - BASIC IDE Home Key: move cursor to the beginning/first character It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
I hope this patch completes this enhancement request. Maybe there are some corner cases where the BreakIterator.nextWord method misses a whitespace. Additional testing is appreciated.
Danke, Andreas! Loving all the little quality-of-life improvements youβre making.
You are welcome π So many bugs I wish I could tackle, but so less time π
Have to reopen the enhancement request since I did not fully understand how the feature should work. As Mike pointed out in [1] pressing the home key should only move to position one if the current position is at the first word. [1] https://gerrit.libreoffice.org/c/core/+/126548/comment/64052f6b_20f2f987/
Andreas, thank you for implementing this new feature. It'll be very useful for everyone using the Basic IDE. As for what Mike suggested, this is something I had never noticed in IDEs; but I tested it this is the way it works in Kate (and some other IDEs). But in other popular IDEs as PyCharm, pressing the "Home" key will take the cursor to the first position in the line instead of taking it to the first word (as is done by the current fix implemented by Andreas). If if turns out to be too hard to implement Mike's suggestion, I believe the current implementation will suffice for most use cases.
I implemented both cases now, so we can decide: https://gerrit.libreoffice.org/c/core/+/126702 Waiting for a comment from Mike if he thinks it fits the needs now.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1aa0a43d60336eb1f0e51805939a7cc00b377a2b tdf#145764 - Change behaviour of BASIC IDE Home Key It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
(In reply to Rafael Lima from comment #9) > But in other popular IDEs as PyCharm, pressing the "Home" key will take the > cursor to the first position in the line instead of taking it to the first > word (as is done by the current fix implemented by Andreas). This is not correct. E.g., PyCharm (as tested with 2021.3 Community Edition) uses a slight modification of what I suggested, but not what was implemented before comment 11: it goes to the first "word" *unless the cursor is to the left of it* (i.e., it goes to the left when it's in the middle of the whitespace before the first non-whitespace character - but it will go to the first non-whitespace character from any other character to the right). Andreas made a brilliant job, and it now works as I suggested. Thanks! (Wrt PyCharm-like modification: if someone would like to implement *that*, I'd consider that nitpicking, but have nothing against that, as long as it's consistent and does not introduce new settings for such a tiny differences - either current behavior, or the other, but not both please ;))