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

Weird characters with ncurses 6.1 #185

Closed
agostonbarna opened this issue Feb 20, 2018 · 8 comments
Closed

Weird characters with ncurses 6.1 #185

agostonbarna opened this issue Feb 20, 2018 · 8 comments

Comments

@agostonbarna
Copy link

After upgrading ncurses to v6.1 weird characters appear on the screen when I try to use peco.

$ cat test.txt       
line 1
line 2
line 3
$ cat test.txt | peco
 ������������������������[%i%p1%dG                            [3 (1/1)]
line 1
line�2�������������������������������
����������������������������������  
line�3���[%i%p1%dG
Waiting for input...
�����������������������������  

Thanks to @mattn I learned that peco uses termbox-go under the hood
and that the issue might happen because terminfo was also modified with the latest ncurses upgrade.

infocmp diff:

45c45
< 	pairs= 32767.
---
> 	pairs= 65536.
173c173
< 	kmous= '\E[M'.
---
> 	kmous= '\E[<'.
190c190
< 	rmcup= '\E[?1049l'.
---
> 	rmcup= '\E[?1049l\E[23;0;0t'.
206c206
< 	smcup= '\E[?1049h'.
---
> 	smcup= '\E[?1049h\E[22;0;0t'.

ncurses version: 6.1.20180127
TERM: xterm-256color
OS: Arch Linux
Linux kernel: 4.14.20-1-lts, x86_64

peco/peco#446

@syui
Copy link

syui commented Feb 23, 2018

Are you using tmux ?

@agostonbarna
Copy link
Author

Normally yes, but I did the test without tmux.

@cfstras
Copy link

cfstras commented Feb 25, 2018

Tested with Hyper, gnome-terminal, even with disabling all .profile&zshrc. (all broken)
xterm and bare linux console work...

Did a diff of "set" between gnome-terminal and xterm, found a workaround:

TERM=xterm #works!!!

Seems like the bug only gets triggered with TERM=xterm-256color

@cfstras
Copy link

cfstras commented Feb 25, 2018

Downgrading to ncurses-6.0-20180121 did NOT work.
Downgrading to ncurses-6.0 (found on https://ftp.gnu.org/pub/gnu/ncurses/ ) WORKS.

For anyone on Arch Linux, I've created a PKGBUILD file that gets you going quickly:
https://gist.github.com/cfstras/f8634870126cb5b84c76a30200c2b603

@k2nr
Copy link

k2nr commented Feb 28, 2018

Same here with peco & opensuse tumbleweed. TERM=xterm worked for me

@kevinschoon
Copy link

kevinschoon commented Mar 1, 2018

Confirmed I am seeing this bug as well with ncurses 6.1 on Arch. It will effect anything using this lib including the many popular tools built on termui. TERM=xterm ./my-program will fix the issue. It's not immediately clear to me what the long term fix for this is but I imagine the maintainer will have an idea..

4.15.5-1-ARCH
glibc 2.26-11
ncurses 6.1-3

@nsf
Copy link
Owner

nsf commented Mar 1, 2018

I'll have a look at it this weekend. Hopefully won't forget about it.

@nsf
Copy link
Owner

nsf commented Mar 3, 2018

Should work now. Ncurses 6.1 slightly altered the terminfo file format. Quoting man page:

       On occasion, 16-bit signed integers are not large enough.  With ncurses
       6.1,  a  new format is introduced by making a few changes to the legacy
       format:

       ·   a different magic number (0542)

       ·   changing the type for the number array from signed 16-bit  integers
           to signed 32-bit integers.

Although doc implies octal number (and original magic number is also specified in octal). What I see in terminfo files is just a little endian 16-bit number 542. Whatever...

sachaos pushed a commit to sachaos/peco that referenced this issue Mar 10, 2018
nsf added a commit to nsf/termbox that referenced this issue Mar 18, 2018
namhyung added a commit to namhyung/das that referenced this issue Aug 1, 2018
It seems there's an issue with termbox-go (which termui depends on) with
ncurses 6.  Apply workaround of setting TERM=xterm mentioned in

  nsf/termbox-go#185
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Aug 26, 2018
nxsre pushed a commit to nxsre/termbox-go-noinput that referenced this issue Apr 16, 2019
Documentation says it should have "a different magic number (0542)" (quoting
"man 5 term"). What I see in practice however is a plain number 542. When this
number is present, numbers array is an array of signed 32 bit integers instead
of 16 bit integers. Take that into account when skipping it.

Fixes nsf#185.
samdoshi added a commit to samdoshi/nixpkgs that referenced this issue Apr 26, 2019
Peco 0.5.3 included an update to the termbox-go dependency to fix a bug,
this change did not make it into deps.nix.

See:

 - peco/peco#446
 - peco/peco#447
 - nsf/termbox-go#185
timokau pushed a commit to NixOS/nixpkgs that referenced this issue Apr 29, 2019
Peco 0.5.3 included an update to the termbox-go dependency to fix a bug,
this change did not make it into deps.nix.

See:

 - peco/peco#446
 - peco/peco#447
 - nsf/termbox-go#185
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
nullgemm pushed a commit to nullgemm/termbox_next that referenced this issue Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants