SpaceVim / SpaceVim

A modular Vim/Neovim configuration
https://spacevim.org/
GNU General Public License v3.0
20.24k stars 1.41k forks source link

Git log/Git diff are truncated when using default git_plugin #4662

Closed rcasta74 closed 2 years ago

rcasta74 commented 2 years ago

When using vim, with default git_plugin, opening git log the buffer is truncated (not all commit are shown); same issue with git diff opening a commit with many changes. It does not happen with nvim.

Expected behavior, english is recommend

Environment Information

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

The reproduce ways from Vim starting (Required!)

Start vim from .SpaceVim folder and open git log with SPC g v, only less than 1000 commits are displayed (with nvim instead I can see at around 7400 rows). Then open a commit with many changes (e360f0c9), only less than 500 rows are displayed (with nvim I can see at around 3600 rows). The number of displayed rows in vim changes every time.

Output of the :SPDebugInfo!

SpaceVim debug information ### SpaceVim options : ```toml auto_disable_touchpad = 1 autocomplete_method = 'deoplete' autocomplete_parens = 1 bootstrap_after = 'myspacevim#after' bootstrap_before = 'myspacevim#before' buffer_index_type = 4 checkinstall = 1 code_runner_focus = 0 colorscheme = 'gruvbox' colorscheme_bg = 'dark' colorscheme_default = 'desert' commandline_prompt = '>' custom_color_palette = [] custom_plugins = [] data_dir = '/home/roberto/.cache/' debug_level = 1 default_custom_leader = '' default_indent = 2 disabled_plugins = [] enable_bepo_layout = 0 enable_cursorcolumn = 0 enable_cursorline = 1 enable_debug = 0 enable_googlesuggest = 0 enable_guicolors = 1 enable_javacomplete2_py = 0 enable_key_frequency = 0 enable_language_specific_leader = 1 enable_neocomplcache = 0 enable_os_fileformat_icon = 0 enable_powerline_fonts = 1 enable_projects_cache = 1 enable_statusline_bfpath = 0 enable_statusline_mode = 1 enable_statusline_tag = 1 enable_tabline_filetype_icon = 1 enable_tabline_ft_icon = 0 enable_vimfiler_welcome = 1 enable_ycm = 0 error_symbol = '✖' escape_key_binding = 'jk' expand_tab = 1 file_searching_tools = [] filemanager = 'nerdtree' filetree_direction = 'right' filetype_icons = {} force_global_config = 1 gitcommit_issue_icon = '' gitcommit_pr_icon = '' github_username = '' guifont = '' hiddenfileinfo = 1 home_files_number = 6 hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts' info_symbol = 'ⓘ' keep_server_alive = 1 language = '' leader_guide_default_group_name = '' leader_guide_flatten = 1 leader_guide_hspace = 5 leader_guide_max_size = 0 leader_guide_position = 'botright' leader_guide_run_map_on_popup = 1 leader_guide_sort_horizontal = 0 leader_guide_submode_mappings = {'': 'win_close'} leader_guide_vertical = 0 lint_engine = 'neomake' lint_on_save = 1 lint_on_the_fly = 0 max_column = 120 plugin_bundle_dir = '/home/roberto/.cache/vimfiles/' plugin_manager = 'dein' plugin_manager_processes = 16 plugin_name = 'vim-gitgutter' project_auto_root = 1 project_non_root = '' project_rooter_outermost = 1 project_rooter_patterns = ['.git/', '_darcs/', '.hg/', '.bzr/', '.svn/', 'CMakeLists.txt', '.SpaceVim.d/'] projects_cache_num = 20 realtime_leader_guide = 1 relativenumber = 1 search_tools = ['rg', 'ag', 'pt', 'ack', 'grep', 'findstr', 'git'] sidebar_direction = '' sidebar_width = 30 smartcloseignoreft = ['tagbar', 'vimfiler', 'defx', 'SpaceVimRunner', 'SpaceVimREPL', 'SpaceVimQuickFix', 'HelpDescribe', 'VebuggerShell', 'VebuggerTerminal', 'SpaceVimTabsManager'] smartcloseignorewin = ['__Tagbar__', 'vimfiler:default'] snippet_engine = 'neosnippet' src_root = 'E:\sources\' statusline_iseparator = 'arrow' statusline_left = ['winnr', 'filename', 'major mode', 'search count', 'syntax checking', 'minor mode lighters'] statusline_right = ['fileformat', 'cursorpos', 'percentage'] statusline_separator = 'arrow' statusline_unicode = 1 terminal_cursor_shape = 2 todo_labels = ['fixme', 'question', 'todo', 'idea'] todo_prefix = '@' update_retry_cnt = 3 version = '2.0.0-dev' vim_help_language = 'en' vimcompatible = 0 warning_symbol = '⚠' wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg,*.ttf,*.TTF,*.png,*/target/*,.git,.svn,.hg,.DS_Store,*.svg' windisk_encoding = 'cp936' windows_index_type = 3 windows_leader = 's' windows_smartclose = 'q' wrap_line = 0 ``` ### SpaceVim layers : ```toml [[layers]] name="autocomplete" [[layers]] name="checkers" [[layers]] name="format" [[layers]] name="edit" [[layers]] name="ui" [[layers]] name="core" enable_smooth_scrolling=0 [[layers]] name="core#banner" [[layers]] name="core#statusline" [[layers]] name="core#tabline" [[layers]] name="shell" default_position='top' default_height=30 [[layers]] name="git" ``` ### SpaceVim Health checking : SpaceVim clipboard support check report: Checking +clipboard: Failed : to support +clipboard, you need recompile your vim with +clipboard support. SpaceVim environment check report: Current progpath: vim(/usr/bin/vim) version: 802 OS: linux [shell, shellcmdflag, shellslash]: ['/bin/zsh', '-c', 0] SpaceVim lua support check report: Checking +lua: SUCCEED! SpaceVim python support check report: Checking +python3: SUCCEED! Checking +python: Failed : to support +python, Please install vim-gtk, or build from sources. autocomplete layer health: ok checkers layer health: ok format layer health: ok edit layer health: ok ui layer health: ok core layer health: ok core#banner layer health: ok core#statusline layer health: ok core#tabline layer health: ok shell layer health: ok git layer health: ok ### SpaceVim runtime log : ```log [ SpaceVim ] : logger file does not exists, only log for current process will be shown! [ SpaceVim ] [22:40:18] [0.001] [ Info ] Loading SpaceVim from: /home/roberto/.SpaceVim/ [ SpaceVim ] [22:40:19] [0.303] [ Info ] Startup with no argv, current dir is used: ~/.SpaceVim [ SpaceVim ] [22:40:19] [0.332] [ Info ] start loading global config >>> [ SpaceVim ] [22:40:19] [0.332] [ Info ] global_dir is: /home/roberto/.SpaceVim.d/ [ SpaceVim ] [22:40:19] [0.333] [ Info ] find global config: /home/roberto/.SpaceVim.d/init.toml [ SpaceVim ] [22:40:19] [0.334] [ Info ] start to apply config [glob] [ SpaceVim ] [22:40:19] [0.339] [ Info ] start loading local config >>> [ SpaceVim ] [22:40:19] [0.339] [ Info ] find local conf: /home/roberto/.SpaceVim/.SpaceVim.d/init.vim [ SpaceVim ] [22:40:19] [0.474] [ Info ] the func has been added to mode:syntax-checking [ SpaceVim ] [22:40:19] [0.611] [ Info ] the func has been added to mode:spell-checking [ SpaceVim ] [22:40:19] [0.611] [ Info ] the func has been added to mode:paste-mode [ SpaceVim ] [22:40:19] [0.852] [ Info ] finished loading SpaceVim! [ rooter ] [22:40:19] [0.967] [ Info ] Load projects cache from: /home/roberto/.cache/SpaceVim/projects.json [ rooter ] [22:40:20] [1.229] [ Info ] Start to find root for: /home/roberto/.SpaceVim/ [ rooter ] [22:40:20] [1.230] [ Info ] (.git/):/home/roberto/.SpaceVim/ [ rooter ] [22:40:20] [1.234] [ Info ] buffer name: No Name [ rooter ] [22:40:20] [1.235] [ Info ] same as current directory, no need to change. [ SpaceVim ] [22:40:20] [1.254] [ Info ] try to open SpaceVim welcome page [ SpaceVim ] [22:40:20] [1.613] [ Info ] loading local conf: .SpaceVim.d/init.vim [ SpaceVim ] [22:40:20] [1.618] [ Info ] finished loading local conf [ rooter ] [22:40:20] [1.621] [ Info ] buffer name: No Name [ rooter ] [22:40:20] [1.622] [ Info ] same as current directory, no need to change. [ rooter ] [22:40:24] [5.887] [ Info ] Start to find root for: /tmp/vLzBubF/4/issue_report.md [ SpaceVim ] [22:40:25] [6.089] [ Info ] the func has been added to mode:syntax-checking [ SpaceVim ] [22:40:25] [6.151] [ Info ] the func has been added to mode:spell-checking [ SpaceVim ] [22:40:25] [6.152] [ Info ] the func has been added to mode:paste-mode ```

Screenshots

If you have any screenshots for this issue please upload here. BTW you can use https://asciinema.org/ for recording video in terminal.

wsdjeg commented 2 years ago

It works well for me in gvim: image

rcasta74 commented 2 years ago

Just found out that the issue is due to on_exit callback that is invoked when there are still data to be read from stdout channel (when using job_start function from vim). This is explained by a note of :h job-exit_cb:

           Note that data can be buffered, callbacks may still be
           called after the process ends. 

As a workaround an handler could be registered for close_cb; it looks like that exit_cb handler is invoked after close_cb handler (even if I cannot found it documented in the vim help), while close_cb handler is invoked when there is no more data to be passed to callbacks, so even an empty function cuold be used for this handler.

wsdjeg commented 2 years ago

@rcasta74 thanks, I will look into it. does it happend in neovim?

rcasta74 commented 2 years ago

@rcasta74 thanks, I will look into it. does it happend in neovim?

In neovim it doesn't happen. The fix doesn't work for me: only the first line is shown (in neovim still working). image

rcasta74 commented 2 years ago

The fix doesn't work for me: only the first line is shown

This is due to issue #4674

rcasta74 commented 2 years ago

While trying to fix issue #4674 using the posted code or forcing python code, I have noted that if there are a lot of commit and I try to open one of them, if the buffer is not fullfilled yet the already inserted commit are dropped and the remaining ones will start from the first line. I think this is due to getline('$'), getbufline(s:bufnr, '$')[0] should be used instead.

rcasta74 commented 2 years ago

Also closing the buffer with q, if not all commits were added, the buffer is reopened with missing commit starting from the first line. In this case I have no idea how to solve.