rhysd / git-messenger.vim

Vim and Neovim plugin to reveal the commit messages under the cursor
MIT License
1.34k stars 32 forks source link

Fix diff toggle when margins are off #85

Closed jshuay closed 2 years ago

jshuay commented 2 years ago

Overview

Diff toggling does not work when g:git_messenger_popup_content_margins = v:false. Instead of toggling, diffs are appended to the buffer on every other call.

Proposed Fix

Update blame__reveal_diff() in blame.vim to account for margins. It will pick between ^ diff --git and ^diff --git search patterns when looking for diff_start, depending on the current state of g:git_messenger_popup_content_margins.

Tests

$ THEMIS_VIM=vi ./vim-themis/bin/themis test/all.vimspec

...

ok 25 - git-messenger.vim Popup window diff support toggles file diff on d -> d
ok 26 - git-messenger.vim Popup window diff support toggles file diff on d -> d when margins are off
ok 27 - git-messenger.vim Popup window diff support toggles commit diff on D -> D
ok 28 - git-messenger.vim Popup window diff support toggles commit diff on D -> D when margins are off

...

# tests 61
# passes 58
# pendings 3