Skip to content

🐛 Graphical paging issues unless piped to less #186

@Iron-E

Description

@Iron-E

Description

It appears that delta's paging implementation has some graphical issues. When there is preexisting text (or even just a large diff), not all of the diff will show, and scrolling up causes previous input from the terminal to be shown (and sometimes the diff will loop and repeat itself).

Expected Behavior

delta's paging behavior will work regardless of previous input, and will show the complete contents of a diff without less.

Steps to Reproduce

  1. Use cat or bat to add some text to the console (what that text is, is not important— just that there is something there).
    • cat /dev/urandom works, for example. But any text will do.
  2. Take some diff, using git diff | delta or git diff using the instructions in the README.
raw diff (renders poorly on GitHub) diff --git a/README.md b/README.md index a7251d0..92cfb5e 100644 --- a/README.md +++ b/README.md @@ -83,11 +83,11 @@ function! s:FooMode() endfunction ```

-After defining said function, you can create a mapping to enter the mode. Be sure to use <expr>. Example:
+After defining said function, you can create a mapping to enter the mode. Example:

command! FooModeEnter call libmodal#Enter('FOO', funcref('s:FooMode'))
-nnoremap <expr> <leader>n FooModeEnter
+nnoremap <leader>n :FooModeEnter
  • Note the funcref() call. It must be there or else libmodal#Enter won't execute properly.
    diff --git a/autoload/libmodal.vim b/autoload/libmodal.vim
    index 9b63188..a5b1aeb 100644
    --- a/autoload/libmodal.vim
    +++ b/autoload/libmodal.vim
    @@ -90,18 +90,17 @@ function! s:Get(comboDict, comboString) abort

    " Make sure the dicitonary has a key for that value.
    if has_key(a:comboDict, l:comboChar)

  •   let l:valType = type(a:comboDict[l:comboChar])
    
  •   let l:val = a:comboDict[l:comboChar]
    
  •   let l:valType = type(l:val)
    
      if l:valType == v:t_dict
    
  •   	if has_key(a:comboDict, s:EX_KEY)
    
  •   		return a:comboDict
    
  •   	if has_key(l:val, s:EX_KEY) && len(a:comboString) <= 1
    
  •   		return l:val
      	else
    
  •   		return s:Get(
    
  •   		\	a:comboDict[l:comboChar], a:comboString[1:]
    
  •   		\)
    
  •   		return s:Get(l:val, a:comboString[1:])
      	endif
      elseif l:valType == v:t_string && len(a:comboString) <= 1
    
  •   	return a:comboDict[l:comboChar]
    
  •   	return l:val
      endif
    
    " The user input has run out, but there is more in the dictionary.
    elseif a:comboString == ''
    diff --git a/doc/libmodal.txt b/doc/libmodal.txt
    index 29bc787..dd45e9f 100644
    --- a/doc/libmodal.txt
    +++ b/doc/libmodal.txt
    @@ -117,11 +117,11 @@ To define a new mode, you must first create a |user-function| to pass into
    <

After defining said |user-function|, you can create a |mapping| to enter the
-mode. Be sure to use |map-|. Example:
+mode.

command! FooModeEnter call libmodal#Enter('FOO', funcref('s:FooMode'))
  • nnoremap n FooModeEnter
  • nnoremap n :FooModeEnter
    <
  • NOTE: the |funcref()| call must be there or else |libmodal#Enter| won't
  1. Scroll up and notice that all the text from step one is still visible.
    • Additionally, scroll down and notice that not all of the diff is viewable (it stops prematurely).
  2. Use git diff | delta | less and attempt to reproduce step 3's behavior. None of the text from step 1 will be visible, and all of the diff will be visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions