mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 10:26:31 +00:00
vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
249591057b
A hunk from the patch depends on patch 8.2.4861, which hasn't been
ported yet, but that should be easy to notice.
This commit is contained in:
@@ -657,8 +657,7 @@ void modify_keymap(uint64_t channel_id, Buffer buffer, bool is_unmap, String mod
|
||||
mode_val = get_map_mode(&p, true); // mapmode-ic
|
||||
} else {
|
||||
mode_val = get_map_mode(&p, false);
|
||||
if ((mode_val == VISUAL + SELECTMODE + NORMAL + OP_PENDING)
|
||||
&& mode.size > 0) {
|
||||
if (mode_val == (MODE_VISUAL | MODE_SELECT | MODE_NORMAL | MODE_OP_PENDING) && mode.size > 0) {
|
||||
// get_map_mode() treats unrecognized mode shortnames as ":map".
|
||||
// This is an error unless the given shortname was empty string "".
|
||||
api_set_error(err, kErrorTypeValidation, "Invalid mode shortname: \"%s\"", p);
|
||||
|
@@ -1327,14 +1327,14 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Error *err)
|
||||
draining = true;
|
||||
goto theend;
|
||||
}
|
||||
if (!(State & (CMDLINE | INSERT)) && (phase == -1 || phase == 1)) {
|
||||
if (!(State & (MODE_CMDLINE | MODE_INSERT)) && (phase == -1 || phase == 1)) {
|
||||
ResetRedobuff();
|
||||
AppendCharToRedobuff('a'); // Dot-repeat.
|
||||
}
|
||||
// vim.paste() decides if client should cancel. Errors do NOT cancel: we
|
||||
// want to drain remaining chunks (rather than divert them to main input).
|
||||
cancel = (rv.type == kObjectTypeBoolean && !rv.data.boolean);
|
||||
if (!cancel && !(State & CMDLINE)) { // Dot-repeat.
|
||||
if (!cancel && !(State & MODE_CMDLINE)) { // Dot-repeat.
|
||||
for (size_t i = 0; i < lines.size; i++) {
|
||||
String s = lines.items[i].data.string;
|
||||
assert(s.size <= INT_MAX);
|
||||
@@ -1345,7 +1345,7 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Error *err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(State & (CMDLINE | INSERT)) && (phase == -1 || phase == 3)) {
|
||||
if (!(State & (MODE_CMDLINE | MODE_INSERT)) && (phase == -1 || phase == 3)) {
|
||||
AppendCharToRedobuff(ESC); // Dot-repeat.
|
||||
}
|
||||
theend:
|
||||
|
Reference in New Issue
Block a user