xahlee / xah-fly-keys

the most efficient keybinding for emacs
http://xahlee.info/emacs/misc/xah-fly-keys.html
470 stars 80 forks source link

Support visual-line-mode in xah-select-line #117

Closed DivineDominion closed 3 years ago

DivineDominion commented 3 years ago

When looking for a way to make xah-select-line work with visual lines, I found that there's no forward-visual-line; instead, I discovered that end-of-visual-line can take an optional parameter. The default behavior equals (end-of-visual-line 1), but when you pass 2, it goes to the end of the next visual line.

Then I found that it was odd that the key binding does always go down 1 line first when a region is active, even if point is in the middle of a line.K Instead, I wanted to go to the end of the line first, even with a region active, and then advance to the next line. I added a new branching path for that.

I left the old code untouched; but if you like that behavior, I can extend the non-visual variant to go to end-of-line first, and if it's already there, advance to the next line.

Can also remove the comments of course.

Demonstration of the "end of line first" behavior

2021-03-18 17 14 45