diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 9 | ||||
-rw-r--r-- | src/nvim/getchar.c | 10 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index ae649e55d6..d18cfaccd0 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1248,7 +1248,8 @@ void nvim_set_current_tabpage(Tabpage tabpage, Error *err) /// @return /// - true: Client may continue pasting. /// - false: Client should cancel the paste. -Boolean nvim_paste(String data, Boolean crlf, Integer phase, Arena *arena, Error *err) +Boolean nvim_paste(uint64_t channel_id, String data, Boolean crlf, Integer phase, Arena *arena, + Error *err) FUNC_API_SINCE(6) FUNC_API_TEXTLOCK_ALLOW_CMDWIN { @@ -1273,13 +1274,13 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Arena *arena, Error cancelled = true; } if (!cancelled && (phase == -1 || phase == 1)) { - paste_store(kFalse, NULL_STRING, crlf); + paste_store(channel_id, kFalse, NULL_STRING, crlf); } if (!cancelled) { - paste_store(kNone, data, crlf); + paste_store(channel_id, kNone, data, crlf); } if (phase == 3 || phase == (cancelled ? 2 : -1)) { - paste_store(kTrue, NULL_STRING, crlf); + paste_store(channel_id, kTrue, NULL_STRING, crlf); } theend: ; diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 31f31904e0..8c3ac49adf 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3190,8 +3190,6 @@ bool map_execute_lua(bool may_repeat) return true; } -static bool paste_repeat_active = false; ///< true when paste_repeat() is pasting - /// Wraps pasted text stream with K_PASTE_START and K_PASTE_END, and /// appends to redo buffer and/or record buffer if needed. /// Escapes all K_SPECIAL and NUL bytes in the content. @@ -3200,14 +3198,14 @@ static bool paste_repeat_active = false; ///< true when paste_repeat() is pasti /// kTrue for the end of a paste /// kNone for the content of a paste /// @param str the content of the paste (only used when state is kNone) -void paste_store(const TriState state, const String str, const bool crlf) +void paste_store(const uint64_t channel_id, const TriState state, const String str, const bool crlf) { if (State & MODE_CMDLINE) { return; } const bool need_redo = !block_redo; - const bool need_record = reg_recording != 0 && !paste_repeat_active; + const bool need_record = reg_recording != 0 && !is_internal_call(channel_id); if (!need_redo && !need_record) { return; @@ -3302,12 +3300,10 @@ void paste_repeat(int count) String str = cbuf_as_string(ga.ga_data, (size_t)ga.ga_len); Arena arena = ARENA_EMPTY; Error err = ERROR_INIT; - paste_repeat_active = true; for (int i = 0; !aborted && i < count; i++) { - nvim_paste(str, false, -1, &arena, &err); + nvim_paste(LUA_INTERNAL_CALL, str, false, -1, &arena, &err); aborted = ERROR_SET(&err); } - paste_repeat_active = false; api_clear_error(&err); arena_mem_free(arena_finish(&arena)); ga_clear(&ga); |