bigH / git-fuzzy

interactive `git` with the help of `fzf`
MIT License
2.3k stars 42 forks source link

fuzzy adds persistent whitespace to terminal after `git fuzzy status` #39

Closed tyconway closed 2 years ago

tyconway commented 2 years ago

Environment: macOS Big Sur 11.3+ zsh Native Terminal, VS Code Terminal, iTerm2

Screen Shot 2021-07-15 at 12 13 24 PM

Each successive run adds another swath of whitespace to future output. Haven't tested other commands.

bigH commented 2 years ago

What command are you running? Do you get this symptom in all terminals you mentioned?

Also, can you set the following variables and share the output?

export GF_DEBUG_MODE="YES"
export GF_COMMAND_DEBUG_MODE="YES"
export GF_COMMAND_FZF_DEBUG_MODE="YES"
export GF_COMMAND_LOG_OUTPUT="YES"
export GF_INTERNAL_COMMAND_DEBUG_MODE="YES"

This will help me debug and diagnose the issue.

tyconway commented 2 years ago

I'm running git fuzzy status and then committing anything. It goes out to Vim, I type a commit message, and when it returns to the command line is when I'm seeing the symptom.

Here's the output:

❯ git fuzzy status
hint: Waiting for your editor to close the file... Vim: Warning: Input is not from a terminal
[master 51f4b3d] Test
                      1 file changed, 1 insertion(+)
                                                    [DBG] `hub` not found, disabling GitHub support.
   [CMD] (internal) $ gf_status 
                                [CMD] $ fzf --ansi --no-sort --no-info --multi                      --bind "ctrl-d:deselect-all"     --bind "ctrl-a:select-all"             --preview-window=right:50%             -m --header $'\nType to filter. \E[37mEnter\E(B\E[m to \E[32mACCEPT\E(B\E[m\n\n  \E[90m-- (\E(B\E[m*\E[90m) editor: \E[35m \E(B\E[m\E(B\E[m\n                                        * \E[32m\E[1medit ✎\E(B\E[m  \E[37mCtrl-E\E(B\E[m\n   \E[32mall ☑\E(B\E[m  \E[37mCtrl-A\E(B\E[m     \E[32mstage \E[1m⇡\E(B\E[m  \E[37mCtrl-S\E(B\E[m     \E[31m\E[1mdiscard ✗\E(B\E[m  \E[37mCtrl-U\E(B\E[m\n  \E[32mnone ☐\E(B\E[m  \E[37mCtrl-D\E(B\E[m     \E[32mreset \E[31m\E[1m⇣\E(B\E[m  \E[37mCtrl-R\E(B\E[m    * \E[31m\E[1mcommit \E(B\E[m\E[31m⇧\E(B\E[m  \E[37mCtrl-M\E(B\E[m\n\n' --header-lines=2 --expect=ctrl-e\,ctrl-m --nth=2 --preview git\ fuzzy\ helper\ status_preview_content\ \{1\}\ \{2..\} --bind ctrl-s:execute-silent\(git\ fuzzy\ helper\ status_add\ \{+2..\}\)+down+reload:git\ fuzzy\ helper\ status_menu_content --bind ctrl-r:execute-silent\(git\ fuzzy\ helper\ status_reset\ \{+2..\}\)+down+reload:git\ fuzzy\ helper\ status_menu_content --bind ctrl-u:execute-silent\(git\ fuzzy\ helper\ status_discard\ \{+2..\}\)+reload:git\ fuzzy\ helper\ status_menu_content 
        [CMD] (internal) $ gf_helper_status_menu_content 
                                                         [CMD] (internal) $ gf_helper_status_preview_content M file.txt 
                       [CMD] (internal) $ gf_helper_status_add file.txt 
                                                                        [CMD] $ git   add -- file.txt 
     [CMD] (internal) $ gf_helper_status_menu_content 
                                                      [CMD] (internal) $ gf_helper_status_preview_content M file.txt 
                    [CMD] (internal) $ gf_helper_status_commit 
                                                               [CMD] $ git   commit 
                                                                                    % 

You can see the symptom begins immediately and affects the debug output. Yes, this happens in each of the terminals I mentioned. I haven't tried it in other shells however. Let me give that a go.

tyconway commented 2 years ago

Here's in bash:

Tys-MacBook-Air:fuzzy-issue tyconway$ git fuzzy status
hint: Waiting for your editor to close the file... Vim: Warning: Input is not from a terminal
[master 06105d5] Another test
                              1 file changed, 1 insertion(+)
                                                            [DBG] `hub` not found, disabling GitHub support.
       [CMD] (internal) $ gf_status
                                    [CMD] $ fzf --ansi --no-sort --no-info --multi                      --bind "ctrl-d:deselect-all"     --bind "ctrl-a:select-all"             --preview-window=right:50%             -m --header $'\nType to filter. \E[37mEnter\E(B\E[m to \E[32mACCEPT\E(B\E[m\n\n  \E[90m-- (\E(B\E[m*\E[90m) editor: \E[35m \E(B\E[m\E(B\E[m\n                                        * \E[32m\E[1medit �\234\216\E(B\E[m  \E[37mCtrl-E\E(B\E[m\n   \E[32mall �\230\221\E(B\E[m  \E[37mCtrl-A\E(B\E[m     \E[32mstage \E[1m�\207�\E(B\E[m  \E[37mCtrl-S\E(B\E[m     \E[31m\E[1mdiscard �\234\227\E(B\E[m  \E[37mCtrl-U\E(B\E[m\n  \E[32mnone �\230\220\E(B\E[m  \E[37mCtrl-D\E(B\E[m     \E[32mreset \E[31m\E[1m�\207�\E(B\E[m  \E[37mCtrl-R\E(B\E[m    * \E[31m\E[1mcommit \E(B\E[m\E[31m�\207�\E(B\E[m  \E[37mCtrl-M\E(B\E[m\n\n' --header-lines=2 --expect=ctrl-e\,ctrl-m --nth=2 --preview git\ fuzzy\ helper\ status_preview_content\ \{1\}\ \{2..\} --bind ctrl-s:execute-silent\(git\ fuzzy\ helper\ status_add\ \{+2..\}\)+down+reload:git\ fuzzy\ helper\ status_menu_content --bind ctrl-r:execute-silent\(git\ fuzzy\ helper\ status_reset\ \{+2..\}\)+down+reload:git\ fuzzy\ helper\ status_menu_content --bind ctrl-u:execute-silent\(git\ fuzzy\ helper\ status_discard\ \{+2..\}\)+reload:git\ fuzzy\ helper\ status_menu_content
       [CMD] (internal) $ gf_helper_status_menu_content
                                                        [CMD] (internal) $ gf_helper_status_preview_content M file.txt
                  [CMD] (internal) $ gf_helper_status_preview_content M file.txt
                                                                                 [CMD] (internal) $ gf_helper_status_add file.txt
                             [CMD] $ git   add -- file.txt
                                                           [CMD] (internal) $ gf_helper_status_menu_content
       [CMD] (internal) $ gf_helper_status_preview_content M file.txt
                                                                      [CMD] (internal) $ gf_helper_status_commit
            [CMD] $ git   commit
                                 Tys-MacBook-Air:fuzzy-issue tyconway$
bigH commented 2 years ago

This seems like something that's an issue on your machine. Since all that debug output is written to files with line separators and then cat'ed to /dev/stderr. The fact that that's misbehaving makes me think your dot-files are doing something to your shell environment to cause this.

bigH commented 2 years ago

Closing this. Apologies this doesn't work for you but since this is a personal/passion project I'm unable to spend time debugging one-off issues like this.

I wish you luck in figuring this out. Feel free to reopen this if you feel there's more information that I can use to help diagnose/fix.

zetaqubit commented 3 months ago

Sorry to re-open, but I'm having the same issue on MacOS iterm2, with zsh. I also notice when I use the commit action, vim opens but backspace in insert mode sends ^? instead of deleting. Could it be that the TERM environment is not being set correctly when executing shell commands from within git fuzzy?

bigH commented 2 months ago

@zetaqubit - if you're able to reproduce w/ a clean shell & in a minimally configured terminal emulator, then I could help you diagnose and fix:

$ env -i bash
<opens subshell>

# in the subshell, modify the environment minimally to get `git-fuzzy` working:

# for example, if using brew
$ eval "$(brew shellenv)"
$ export PATH="/path/to/git-fuzzy/bin:$PATH"

# then perform the same action
bigH commented 2 months ago

@tyconway if this is still an issue, see repro help above