diff options
author | Donatas <contactdonatas@gmail.com> | 2025-01-20 16:40:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-20 06:40:26 -0800 |
commit | 5b1136a99c7fc6db4cfe6865b72c069a4697c1a5 (patch) | |
tree | 2f8699149e1b377c4d52849c9128c6079d8284c2 /src/nvim/ex_getln.c | |
parent | 92556be33d04668c58a37794de5562af6297b3ac (diff) | |
download | rneovim-5b1136a99c7fc6db4cfe6865b72c069a4697c1a5.tar.gz rneovim-5b1136a99c7fc6db4cfe6865b72c069a4697c1a5.tar.bz2 rneovim-5b1136a99c7fc6db4cfe6865b72c069a4697c1a5.zip |
feat(inccommand): preview 'nomodifiable' buffers #32034
Problem:
Incremental preview is not allowed on 'nomodifiable' buffers.
Solution:
- Allow preview on 'nomodifiable' buffers.
- Restore the 'modifiable' option in case the preview function changes it.
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 423b50cd32..1eecee2a38 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -163,6 +163,7 @@ typedef struct { typedef struct { buf_T *buf; OptInt save_b_p_ul; + int save_b_p_ma; int save_b_changed; pos_T save_b_op_start; pos_T save_b_op_end; @@ -2419,6 +2420,7 @@ static void cmdpreview_prepare(CpInfo *cpinfo) if (!set_has(ptr_t, &saved_bufs, buf)) { CpBufInfo cp_bufinfo; cp_bufinfo.buf = buf; + cp_bufinfo.save_b_p_ma = buf->b_p_ma; cp_bufinfo.save_b_p_ul = buf->b_p_ul; cp_bufinfo.save_b_changed = buf->b_changed; cp_bufinfo.save_b_op_start = buf->b_op_start; @@ -2509,6 +2511,7 @@ static void cmdpreview_restore_state(CpInfo *cpinfo) } buf->b_p_ul = cp_bufinfo.save_b_p_ul; // Restore 'undolevels' + buf->b_p_ma = cp_bufinfo.save_b_p_ma; // Restore 'modifiable' } for (size_t i = 0; i < cpinfo->win_info.size; i++) { @@ -2704,7 +2707,6 @@ static int command_line_changed(CommandLineState *s) && current_sctx.sc_sid == 0 // only if interactive && *p_icm != NUL // 'inccommand' is set && !exmode_active // not in ex mode - && curbuf->b_p_ma // buffer is modifiable && cmdline_star == 0 // not typing a password && !vpeekc_any() && cmdpreview_may_show(s)) { |