sodapopcan / vim-twiggy

Git branch management for Vim
280 stars 16 forks source link

Commits with really long names cause "Press Enter..." prompt #13

Closed sodapopcan closed 6 years ago

sodapopcan commented 6 years ago

This was reported through email but I can't actually reproduce it myself. In some setups, if you put your cursor on a branch who head commit message is very long, you get a Press ENTER or type command message.

I'm looking into it but if anyone sees this and has any insight that would be much appreciated.

joshpencheon commented 6 years ago

I'm seeing this on:

$ vi --version
NVIM v0.2.3-dev

with a minimal vimrc:

$ cat ~/.vimrc | sed -e 's/^\s*".*$//' -e '/^$/d'
call plug#begin('~/.vim/plugged')
  Plug 'tpope/vim-fugitive' 
  Plug 'sodapopcan/vim-twiggy'
call plug#end()

and a trivial test repository:

$ mkdir /tmp/test && cd /tmp/test
$ git init && touch my_file && git add my_file
$ git commit -am "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

Then:

$ vi my_file +:Twiggy

                               │~
local [alpha]                  │~
* master                       │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
~                              │~
</.git/branches 4,1         All my_file                          0,0-1          All
e736ffb 00000000000000000000000000000000000000000000000000000000000000000000...
Press ENTER or type command to continue
sodapopcan commented 6 years ago

Awesome, thanks for the info! I won’t be able to get to this until tomorrow, but this helps.

If you want, you can play around with max_len in s:get_branch_details and see if that helps. Otherwise, I'll dig in tomorrow.

sodapopcan commented 6 years ago

It's explained in the commit message but in short, I was not accounting for showcmd being set when cmdheight=1.