jarun / nnn

n³ The unorthodox terminal file manager
BSD 2-Clause "Simplified" License
18.51k stars 743 forks source link

Visual Glitch, visual bug, the whole screen breaks, resize does something, redraw does not #1866

Open alexNecroJack opened 2 months ago

alexNecroJack commented 2 months ago

Environment details (Put x in the checkbox along with the information)

~/.bashrc:

nn ()
{
  # Block nesting of nnn in subshells
  [ "${NNNLVL:-0}" -eq 0 ] || {
    echo "nnn is already running"
    return
  }

  export NNN_OPTS="HucUAd" #c option should use the hashbang... On the contrary it even tries to open images!! I don't know if it tries with bash or whatever...
  export NNN_OPENER=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/passive/nuke
  export NNN_CLI_ONLY=1
  export NNN_PLUG='f:finder;b:amasis_backup_files_suffixer;c:cd;0:passive/amasis_startup'
  export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd"
  export NNN_TRASH=1

  # The command builtin allows one to alias nnn to nn, without making an infinitely recursive alias
  command nnn -P0 "$@"

  [ ! -f "$NNN_TMPFILE" ] || {
    . "$NNN_TMPFILE"
    rm -f "$NNN_TMPFILE" > /dev/null
  }
}
export -f nn
# endregion

# Check for interactive shell
# Terminal is the default for many cases, even for SFTP!!
# So in order for everything to work, for example SFTP,
# we need to check first that the terminal is interactive,
# meaning, that we are in a for-user shell.
if [[ $- == *i* ]]; then # Check for interactive shell

  if [ -z "$TMUX" ]; then # Not inside tmux
    session_name="$(whoami)_$(date '+%Y-%m-%d %H-%M-%S')" # Generate a unique session name
    tmux new-session -s "$session_name"
  else # already inside tmux
    nn
  fi

fi

I access the terminal through:

And then tmux opens, and NNN.

When it happened, I could reproduce it, with the steps presented below. Then I tried to kill tmux and go bare terminal, and it stopped happening even with tmux... really, I don't know how to reproduce it right now. I could before 5 minutes with the steps below.

Exact steps to reproduce the issue

Open a terminal with Ctrl-~ in VCode: Clip_204145

Drag the terminal up to make it as editor (therefor resizing the terminal) : Clip_204146 Everything seems okay so far..

Open help (Shift /) : Clip_204147 Woah! ... something died..

Close help: Clip_204148 wow ... all those quota.user? They definately don't exist

This is me moving the cursor (arrow keys down) to the entry below "bin": Clip_204149 which is as we see (multiple times) "boot"

This is me moving the cursor (arrow key down) to the entry below "boot": Clip_204150 which is as we see (multiple times) "dev" (not "devta.user")

Ant this is the result after moving the cursor a lot (up / down arrows) Clip_204152

I tried redrawing the screen in tmux multiple times, no luck (refresh-client -l) (C-b r) and I even tried the ^L of NNN (Ctrl Shift l / Ctrl l / Shift L) and nothing changed.

After resizing the VCode window (and therefore I guess resize is being propagated) it seems like it's fixed... But I can easily see the problem persists, by typing / to filter, and typing an (existing) letter... Everything get's corrupted again...

I will install the latest NNN and try it there too. Although now that I can not persistently recreate it, I might take a week to provide more info. Don't worry though, it's happening at least once a week, the past 3-4 months or so for sure.

It would be nice to have a config option, to skip smart redrawing, and force it to full redraw.. I am thinking to myself, rather than having some performance boost, we are on a Web server machine, I think it can handle full redraws, but the buuug.... it's not okay.

Thanks for this MAGNIFICENT program, it's one of the BEST I have ever seen :D

KlzXS commented 6 days ago

Thanks for this MAGNIFICENT program, it's one of the BEST I have ever seen :D

Thank you for the kind words and sorry for such a late response. When this was originally posted I tried to recreated, but I couldn't. I was hoping someone else would take it on, but that obviously wasn't the case.

Do you still experience this issue? Can you reliably reproduce it?