fix: move keybind command arguments to stack before executing
This avoids problems with commands that cause the current mode to be deleted before the arguments are read such as `enter_mode`.
This commit is contained in:
parent
fdf0c7ada9
commit
386453ee61
2 changed files with 7 additions and 5 deletions
|
@ -8,8 +8,8 @@
|
||||||
["l", "move_right_vim"],
|
["l", "move_right_vim"],
|
||||||
["h", "move_left"],
|
["h", "move_left"],
|
||||||
["<Space>", "move_right_vim"],
|
["<Space>", "move_right_vim"],
|
||||||
["i", "enter_mode", "insert"],
|
["i", "enter_mode", "vim/insert"],
|
||||||
["v", "enter_mode", "visual"],
|
["v", "enter_mode", "vim/visual"],
|
||||||
["/", "find"],
|
["/", "find"],
|
||||||
["n", "goto_next_match"],
|
["n", "goto_next_match"],
|
||||||
["0", "move_begin"],
|
["0", "move_begin"],
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
"insert": {
|
"insert": {
|
||||||
"syntax": "vim",
|
"syntax": "vim",
|
||||||
"press": [
|
"press": [
|
||||||
["jk", "enter_mode", "normal"],
|
["jk", "enter_mode", "vim/normal"],
|
||||||
["<Esc>", "enter_mode", "normal"]
|
["<Esc>", "enter_mode", "vim/normal"]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,9 @@ const Binding = struct {
|
||||||
command.get_id_cache(self.command, &self.command_id) orelse {
|
command.get_id_cache(self.command, &self.command_id) orelse {
|
||||||
return tp.exit_fmt("CommandNotFound: {s}", .{self.command});
|
return tp.exit_fmt("CommandNotFound: {s}", .{self.command});
|
||||||
};
|
};
|
||||||
try command.execute(id, .{ .args = .{ .buf = self.args } });
|
var buf: [2048]u8 = undefined;
|
||||||
|
@memcpy(buf[0..self.args.len], self.args);
|
||||||
|
try command.execute(id, .{ .args = .{ .buf = buf[0..self.args.len] } });
|
||||||
}
|
}
|
||||||
|
|
||||||
const MatchResult = enum { match_impossible, match_possible, matched };
|
const MatchResult = enum { match_impossible, match_possible, matched };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue