Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nnn + netbsd-curses + musl libc #998

Closed
8 tasks done
jarun opened this issue May 11, 2021 · 21 comments
Closed
8 tasks done

nnn + netbsd-curses + musl libc #998

jarun opened this issue May 11, 2021 · 21 comments
Labels

Comments

@jarun
Copy link
Owner

jarun commented May 11, 2021

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

  • Operating System: Ubuntu 20.04 x86_64
  • Desktop Environment: XFCE4
  • Terminal Emulator: xfce4-terminal
  • Shell: zsh
  • Custom desktop opener (if applicable): nuke
  • Program options used: -acdDEnQrux
  • Configuration options set: NNN_PLUG
  • Issue exists on nnn master

Exact steps to reproduce the issue

I am seeing an issue with preview-tui-ext with netbsd-curses and musl libc compilation.

Compilation commands used:

$ musl-gcc -O3 -DNORL -DNOMOUSE -DNOBATCH -DTOURBIN_QSORT -DNOSSN -DNOUG -DNOX11 -march=corei7 -I../netbsd-curses/libcurses -o nnn src/nnn.c -Wl,-Bsymbolic-functions -L/opt/netbsd-curses -lcurses -lterminfo -static
$ strip nnn

Plugins are from latest master.

I have set it as p:-preview-tui-ext in NNN_PLUG. I use tmux tmux 3.0a with the config:

# remap prefix from 'C-b' to 'C-\'
unbind C-b 
set-option -g prefix C-c 
bind-key C-c send-prefix

# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"' 
unbind %

set -g escape-time 0
set-option -g status off

set -g default-terminal "xterm-256color"

I can repro this with:

  • run the plugin with Alt-P
  • move up a directory
  • close the plugin with Alt-P
  • window is broken with the following message: dir changed, range sel off

Asciicast

@jarun jarun added the bug label May 11, 2021
@jarun
Copy link
Owner Author

jarun commented May 11, 2021

@luukvbaal can you please take a look?

@luukvbaal
Copy link
Collaborator

I tried to reproduce but I don't see the issue. Not sure when I can take another look.

@jarun jarun changed the title Broken window on closing preview-tui-ext after navigatinging to parent dir Broken window on closing preview-tui-ext after navigating to parent dir May 11, 2021
@jarun
Copy link
Owner Author

jarun commented May 11, 2021

Adding @leovilok.

@luukvbaal Does the message dir changed, range sel off give some ideas? MSG_DIR_CHANGED is used at only one place in nnn.c. It looks like somehow the program has entered the SEL_SELMUL case.

@luukvbaal
Copy link
Collaborator

Well the only I can see that happening is if preview-tui-ext somehow passes key presses to nnn right?

@jarun
Copy link
Owner Author

jarun commented May 11, 2021

Yes, possible. I just tested with preview-tabbed and I don't see this problem.

Also note that I am pressing Alt-P to close the previewer.

@jarun
Copy link
Owner Author

jarun commented May 11, 2021

OK, I have narrowed it down further to the option -n (nav-to-type mode).

@luukvbaal
Copy link
Collaborator

luukvbaal commented May 12, 2021

Also note that I am pressing Alt-P to close the previewer.

Yeah I am too, couldn't reproduce yet.

BTW netbsd-curses doesn't seem to play nice with st(suckless' simple terminal). When toggling preview-tui I see flickering of the trailing whitespace in nnn. Doesn't happen when just opening/closing tmux panes though🤔

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Yes, there are issues. But it will be good if we can sort those out and support it well.

I am using xfce4-terminal. Another thing I see is (when I restore the terminal by going to parent dir after it breaks), the + sign is shown in statusbar. This definitely tells somehow a wrong keypress is registered.

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Does preview-tui(-ext) write something back to nnn when it's closed with the same plugin key?

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

The assigned key is not the problem BTW, I see it happening with Alt-E and Alt-X as well.

@luukvbaal
Copy link
Collaborator

Does preview-tui(-ext) write something back to nnn when it's closed with the same plugin key?

If it does it's not intended. Toggling is done by killing the cat "$NNN_FIFO" pipe.

Could you try

@@ -430,6 +430,6 @@ else
         printf "\$KITTY_LISTEN_ON not set!\nPlease read Usage in preview-tui-ext."
         cfg=$(stty -g); stty raw -echo; head -c 1; stty "$cfg"
     else
-        togglepreview "$1" &
+        togglepreview "$1" > "`~/test &
     fi
 fi

cat ~/test

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Checking it... one more thing... irrespective of the key I assign, only for this plugin, as soon as I start the plugin I see * in the statusbar, which means range selection gets enabled. That's why we are seeing the message when we change the directory.

@luukvbaal
Copy link
Collaborator

But this behavior is still specific to the netbsd-curses and musl libc compilation right?

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

With that change the previewer doesn't show.
But I think our issue is not with the plugin. Even if I edit a text file by opening it in vim, I see the range selection getting set.

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

But this behavior is still specific to the netbsd-curses and musl libc compilation right?

That's correct.

If we can claim good support for this combination, we can auto-generate a static binary with the next release. The numbers are amazing! So I am using it exclusively for a while.

@luukvbaal
Copy link
Collaborator

I see, weird stuff. I'm off to bed for now though, good luck.

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Yes sure, I can repro this easily with the text file open. So I can continue debugging.

Good night!

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Unrelated to this issue.

I see sabotabge-linux has a recipe for nnn but the version is dated.

@rofl0r can you please update it to use the latest nnn v4.0?

Question: is there a nsdbsd-curses specific macro we can use to port the changes upstream?

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

@luukvbaal I have explained the issue in sabotage-linux/netbsd-curses#46. netbsd-curses sends a NULL (0) which is registered as ^Space (mark range/clear sel keybind) in nnn.

See if the flickering issue on st is also due to the same problem.

I am considering removing the ^Space keybind and just leave the m. As someone who uses the nav-to-type mode exclusively, I find it hard remembering the ^Space key all the time. Maybe because it's seldom used.

Attached the debug logs to show the difference between ncursesw and netbsd-curses behaviour.

nnndbg_ncurses.txt
nnndbg_netbsd.txt

@jarun jarun closed this as completed in 907616a May 12, 2021
@jarun jarun mentioned this issue May 12, 2021
36 tasks
@luukvbaal
Copy link
Collaborator

luukvbaal commented May 12, 2021

No the problem is still there, although it seems to go away after changing directories:
out

Was also able to confirm that it's a problem only occurring with netbsd-curses in combination with the alpha patch, issue is not present on st master branch. Seems like cells that haven't been written to by netbsd curses are drawn incorrectly by the alpha patch or something.

@jarun
Copy link
Owner Author

jarun commented May 12, 2021

Thanks for checking it!

While we are at it, and to have the notes for later, I see another issue with xfce4-terminal (no -n) where if I keep opening and closing a text file detached in another tab again and again, the window breaks. The statusbar is printed after the last entry. Not sure if it is due to the same redraw issue we reported.

If I repeat the open and close the file once or twice, the problem goes away.

Asciicast

@jarun jarun mentioned this issue May 19, 2021
50 tasks
@jarun jarun changed the title Broken window on closing preview-tui-ext after navigating to parent dir nnn + netbsd-curses + musl libc May 24, 2021
@jarun jarun mentioned this issue Jun 2, 2021
10 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jun 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants