mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
@@ -460,10 +460,11 @@ endfunction
|
|||||||
" Preview window: assumes cursor is in preview window.
|
" Preview window: assumes cursor is in preview window.
|
||||||
function! s:populate_hunk_preview_window(header, body)
|
function! s:populate_hunk_preview_window(header, body)
|
||||||
let body_length = len(a:body)
|
let body_length = len(a:body)
|
||||||
let height = min([body_length, &previewheight])
|
|
||||||
|
|
||||||
if g:gitgutter_preview_win_floating
|
if g:gitgutter_preview_win_floating
|
||||||
if exists('*nvim_open_win')
|
if exists('*nvim_open_win')
|
||||||
|
let height = min([body_length, &previewheight])
|
||||||
|
|
||||||
" Assumes cursor is not in previewing window.
|
" Assumes cursor is not in previewing window.
|
||||||
call nvim_buf_set_var(winbufnr(s:winid), 'hunk_header', a:header)
|
call nvim_buf_set_var(winbufnr(s:winid), 'hunk_header', a:header)
|
||||||
|
|
||||||
@@ -496,12 +497,16 @@ function! s:populate_hunk_preview_window(header, body)
|
|||||||
|
|
||||||
else
|
else
|
||||||
let b:hunk_header = a:header
|
let b:hunk_header = a:header
|
||||||
execute 'resize' height
|
|
||||||
|
|
||||||
%delete _
|
%delete _
|
||||||
call setline(1, a:body)
|
call setline(1, a:body)
|
||||||
setlocal nomodified
|
setlocal nomodified
|
||||||
|
|
||||||
|
normal! G$
|
||||||
|
let height = min([winline(), &previewheight])
|
||||||
|
execute 'resize' height
|
||||||
|
1
|
||||||
|
|
||||||
call clearmatches()
|
call clearmatches()
|
||||||
for region in gitgutter#diff_highlight#process(a:body)
|
for region in gitgutter#diff_highlight#process(a:body)
|
||||||
let group = region[1] == '+' ? 'GitGutterAddIntraLine' : 'GitGutterDeleteIntraLine'
|
let group = region[1] == '+' ? 'GitGutterAddIntraLine' : 'GitGutterDeleteIntraLine'
|
||||||
|
|||||||
Reference in New Issue
Block a user