Skip to content

Commit 48e02df

Browse files
committed
visual mode re-highlight fix
-switching from and then back to the peekaboo buffer via multiple `wincmd p` operations fails, possibly due to the use of option `bufhidden` in its creation, meaning its never present in the buffer list -instead, record window number and reset following the `gv` operation -bug likely went unnoticed because the side-effects of latter buffer modifications aren't that noticeable. however, should the multiple `wincmd p` operations land you on a buffer with `modifiable=0` set, then a very visible: `E21: Cannot make changes,'modifiable' is off` error is presented, and the operation a user is attempting (e.g. "+y etc.) fails ..then you know about it!
1 parent a7c940b commit 48e02df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

autoload/peekaboo.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ endfunction
115115
" Triggers gv to keep visual highlight on
116116
function! s:gv(visualmode, visible)
117117
if a:visualmode && a:visible
118+
let wnr = bufwinnr('')
118119
wincmd p
119120
normal! gv
120121
redraw
121-
wincmd p
122+
execute wnr 'wincmd w'
122123
else
123124
redraw
124125
endif

0 commit comments

Comments
 (0)