You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cursor is moved to the end. To the line next to end of selection but at least to the last line of selection.
Actual behavior
Even if you selected 1000 lines pressing down will move cursor to the second line of selection. NOTE: Pressing up works correctly and moves cursor up
How it was found and what problem it brought
I needed to select whole lines in custom sidebar on moving up and down. Something like the thing you can see in filemanager plugin. And the following example works while you run micro with disabled softwrap. But when you enable softwrap (and make sure that line you currently selected is softwrapped) pressing down will move cursor to the next "visual" line but it will be the same "actual" line. When you are on the second "visual" line of text the "SelectLine()" will select whole "actual" line. Pressing down will move it to the second "visual" line and now we are in a loop...
Minimal reproducible example, just copy it as plugin to your plugin dir to
functiononCursorDown(buffer_pane)
buffer_pane:SelectLine()
endfunctiononCursorUp(buffer_pane)
buffer_pane:SelectLine()
end
Mouse inconsistency
Like mentioned in #3055 if you select something with mouse the direction from what you selected text matters. If you selected text from up to bottom, everything works as with keyboard selection but. But if you select line from bottom to up the things will swap: pressing up will result in moving cursor to the one line up before last line and pressing down will work correctly and normally.
About filemanager and workaround
I tried to overcome the bug and found the workaround the same is in filemanager plugin. The pressing up is done via onCursorUp hook because pressing up works good but pressing down is handled in different way. It is done via preCursorDown that handles cursor down movement before it happens and manually moves cursor down and then return false from hook to let micro know that the action was handled and micro mustn't perform it....
Previously `CursorDown` function called `Deselect` with a wrong
argument which lead to the situation when cursor was moved to the
start instead of the end of the selection
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
dustdfg
changed the title
Pressing Down when have "multiline selection" moves cursor to the second line of selection instead of end
Pressing Down when have "visual multiline selection" moves cursor to the second line of selection instead of end
Dec 18, 2023
Previously `CursorDown` function called `Deselect` with a wrong
argument which lead to the situation when cursor was moved to the
start instead of the end of the selection
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
Description of the problem or steps to reproduce
Expected behavior
Cursor is moved to the end. To the line next to end of selection but at least to the last line of selection.
Actual behavior
Even if you selected 1000 lines pressing down will move cursor to the second line of selection.
NOTE: Pressing up works correctly and moves cursor up
How it was found and what problem it brought
I needed to select whole lines in custom sidebar on moving up and down. Something like the thing you can see in
filemanager
plugin. And the following example works while you run micro with disabled softwrap. But when you enable softwrap (and make sure that line you currently selected is softwrapped) pressing down will move cursor to the next "visual" line but it will be the same "actual" line. When you are on the second "visual" line of text the "SelectLine()" will select whole "actual" line. Pressing down will move it to the second "visual" line and now we are in a loop...Minimal reproducible example, just copy it as plugin to your plugin dir to
Mouse inconsistency
Like mentioned in #3055 if you select something with mouse the direction from what you selected text matters. If you selected text from up to bottom, everything works as with keyboard selection but. But if you select line from bottom to up the things will swap: pressing up will result in moving cursor to the one line up before last line and pressing down will work correctly and normally.
About filemanager and workaround
I tried to overcome the bug and found the workaround the same is in
filemanager
plugin. The pressing up is done viaonCursorUp
hook because pressing up works good but pressing down is handled in different way. It is done viapreCursorDown
that handles cursor down movement before it happens and manually moves cursor down and then returnfalse
from hook to let micro know that the action was handled and micro mustn't perform it....https://github.com/micro-editor/updated-plugins/blob/216ec3adaf3adec78665614402ece56cf60ae713/filemanager-plugin/filemanager.lua#L1024-L1037
Possible root of the problem
UpN
function that is also used for down don't respectCurrentSelection
and just use itself like it is simple 1 char cursormicro/internal/buffer/cursor.go
Lines 232 to 255 in 2d82362
Specifications
Commit hash: 68d88b5
OS: Debian12
Terminal: foot
The text was updated successfully, but these errors were encountered: