added j / k for vim-style line movement
j and k move the caret one line, delegated to sublime's own `move` command so they behave exactly like the arrow keys. They dispatch through the existing ACTIONS registry, so the keymap, the status-bar hints and the ? popup all stay in sync through the single KEY_GROUPS table. Unlike the other letter keys, j / k keep no command_mode context: the view is read-only, so leaving them live while Vintage is in command mode can only ever move the caret. That asymmetry was previously documented only in a comment, which was wrong (it claimed j / k were the only unguarded bindings, but escape has always carried its own context instead). It is now pinned by test_command_mode_guard_is_deliberate, so normalising the keymap fails the suite with the reason attached. Also tidies two long lines in commands.py. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -135,3 +135,13 @@ def test_run_async_reports_generic_error(monkeypatch):
|
||||
|
||||
commands.run_async(boom, lambda r: messages.append("done"))
|
||||
assert messages == ["vDiff: boom"]
|
||||
|
||||
|
||||
def test_j_and_k_move_the_caret_one_line():
|
||||
view = sublime.View()
|
||||
commands.ACTIONS["line_down"](view, None, None)
|
||||
commands.ACTIONS["line_up"](view, None, None)
|
||||
assert view.commands == [
|
||||
("move", {"by": "lines", "forward": True}),
|
||||
("move", {"by": "lines", "forward": False}),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user