Refactor definitions of vi-mode operators.#952
Conversation
0b3670f to
09510cf
Compare
ae964a3 to
3adb7f3
Compare
There was a problem hiding this comment.
I changed define-command to allow to take :initargs to specify :default-initargs to the class.
I don't believe this breaks any other parts, but please keep in mind.
src/base/package.lisp
Outdated
| :delete-point | ||
| :point-buffer | ||
| :point-charpos | ||
| :point-linum |
There was a problem hiding this comment.
What about using line-number-at-point?
There was a problem hiding this comment.
Thanks!
I rewrote it with the function and stopped exporting.
2bf4278 to
8c92c61
Compare
0ad1354 to
578023e
Compare
cxxxr
left a comment
There was a problem hiding this comment.
I think it's a very nice change.
One thing that concerns me is that there are several compile-time warnings, could you please fix them?
| :type ,(or type :exclusive) | ||
| :default-n-arg ,default-n-arg)) | ||
| ,arg-list ,arg-descriptor | ||
| (with-point ((*vi-origin-point* (current-point))) |
There was a problem hiding this comment.
nits:
with-point creates a point with kind = temporary by default.
This means that it will become invalid after the buffer has been modified, so care should be taken in the future.
| "Goto end of a line." | ||
| (line-end point) | ||
| (unless (bolp point) | ||
| (character-offset point *cursor-offset*))) |
There was a problem hiding this comment.
It may be better to move before using definitions. *cursor-offset*
578023e to
3e261c9
Compare
|
Thank you for so many improvements! |
Fix new bugs of vi-mode introduced by #952
Add
define-vi-motionanddefine-vi-operatormacros, and rewrite vi-mode's operator commands with them.This aims to make them much cleaner and behave more consistently.
Bugs fixed
dh,ch,d^andc^not to delete the char under the cursor1000dlto delete the last char of the linedf<char>,cf<char>,dt<char>, andct<char>to delete the char under the cursor after the movementdF<char>,dT<char>not to delete the char under the cursorcjto remain a single lineyyto allow to take a universal argumentJnot to skip empty lines, and don't allow to concatenate the following onesJandgJto allow to take a universal argument, like3Jto join 3 linesJnot to add a space in between if the next line starts with a ')' not only when the current line ends with ')'Jin visual mode to join lines between pointersDin visual mode to delete the whole lines between pointersrto work in visual moderto allow to take a universal argument, like2r<char>sis pressed on the last char of the linedGto delete to the end of the buffer instead to the begindManddLto delete the line if the pointer is the end of the buffer after the movementgUandguto change cases in normal modeI also found strange behavior of
eandE, but I decided to leave them not to make changes huge.