Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ncurses box not rendered properly in st with tmux
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 346

PostPosted: Thu Oct 17, 2024 7:11 am    Post subject: ncurses box not rendered properly in st with tmux Reply with quote

Recently I have noticed that ncurses boxes, like in alsamixes or kernel's menuconfig use a wrong character for horizontal lines.

That's the kind of "box" ncurses displays. Everything else is working, so alsamixer is functional.
It's just very distracting.

I say I have noticed recently, but I don't open alsamixer or kernel menuconfig every day...
However, there was one significant change on my machine that I can think of. I've added -flto -fgraphite-identity to my CFLAGS in make.conf
On my machine the simplest ncurses box reproduces the problem:
Code:
#include <ncurses.h>

int main() {
   initscr();
   refresh();
   WINDOW *win = newwin(3, 10, 2, 2);
   box(win, 0 , 0);
   wrefresh(win);
   getch();
   endwin();
}

On my system, the above displays
Code:
  ┌─qqqqqqq┐
  │        │
  └─qqqqqqq┘


I'm running this in x11-terms/st, running a tmux session, with TERM set to xterm-256color.
Any of the following fixes the problem:


  • Changing to a different terminal, including tty2.
  • Changing TERM to st-256color
  • Not using tmux


So only if TERM=xterm-256color, inside st, inside xterm does the problem manifest.
Usually, I'd just change the tmux config to set st-256color, but that feels wrong and not setting it worked for so many years.
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 346

PostPosted: Thu Oct 17, 2024 8:47 am    Post subject: Reply with quote

I've tried recompiling tmux, ncurses and st without -flto -fgraphite-identity.
Didn't help.

I'm running out of ideas...
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2325

PostPosted: Thu Oct 17, 2024 10:01 am    Post subject: Reply with quote

It has something to do with the encoding/font. Do you use it in a FB console, a graphical VT or ssh(possibly in a FB console and graphical VT)?

I've seen it where multi-language support is involved. I've seen it to the extent I wouldn't pay attention to it if it appeared right now.

First thing to check is your locale:

Code:
# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


Of course my native language is not English, but I've set it up only in the graphic environment where I'll most likely use it in the browser or while editing documents, but likely not anywhere else. My consoles are natively English. The FB console and the graphical VT. I've tried to add my native language but it's awkward for me to read system messages in my native language.

Leave your CFLAGS alone, they won't help with the above.

Best Regards,
Georgi
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 346

PostPosted: Thu Oct 17, 2024 11:19 am    Post subject: Reply with quote

@logrusx
Thanks for the response.

locale:
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=


logrusx wrote:
Leave your CFLAGS alone, they won't help with the above.


Deal!

logrusx wrote:
Do you use it in a FB console, a graphical VT or ssh(possibly in a FB console and graphical VT)?


Noticed it in a graphical VT first.
By now I've tried switching to tty2 and trying there.
So the constants are: tmux, TERM=xterm-256color and... no, that's it. The x11-term/st was a red herring.

/etc/locale-gen:
en_US.UTF-8 UTF-8

.tmux.conf:
# Vi copypame mode
set-window-option -g mode-keys vi

set-option -g prefix 'C-\'
bind-key 'C-\' last-window

# Keep cwd when creating a new tab
unbind c
bind-key c new-window -c "#{pane_current_path}"

# hjkl pane traversal
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

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

# Split
unbind v
bind v split-window -h -c "#{pane_current_path}"
unbind s
unbind b
bind s split-window -v -c "#{pane_current_path}"

# Allows for faster key repetition
set -s escape-time 0

# reload config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."

# Don't start login shell
set -g default-command "${SHELL}"

# Window resize
bind H resize-pane -L 5
bind L resize-pane -R 5
bind J resize-pane -D 5
bind K resize-pane -U 5

# No confirm on kill-pane
unbind x
bind x kill-pane

# Status
#set -g status-bg black
set -g status-bg '#262626'
set -g status-fg '#87875f'
set -g status-justify centre # center align window list
set -g status-interval 1
set -g status-left '#H'
set -g status-right '%R'

# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h"  "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j"  "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k"  "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l"  "select-pane -R"
#bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"


logrusx wrote:
I've tried to add my native language but it's awkward for me to read system messages in my native language.


Yeah, tell me about it. Especially if, like mine, your native language does not necessarily use the latin script.
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2325

PostPosted: Thu Oct 17, 2024 12:41 pm    Post subject: Reply with quote

I have en_US ISO-8859-1 as well in my locale.gen. It works fine under Gnome Terminal as well as in FB console. Xterm-256color here too. I can't comment the tmux config as I don't understand it...

But I'm pretty certain it boils down to some kind of localization/multi-language support. If my memory serves me right, I've seen this kind of behavior in PuTTY and remote logins.

Actually I took your tmux.conf and I still see no problem.

Best Regards,
Georgi
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 346

PostPosted: Thu Oct 17, 2024 1:02 pm    Post subject: Reply with quote

logrusx wrote:
I have en_US ISO-8859-1 as well in my locale.gen.


I have just tried adding it.
No change in behaviour.

I have not touched locale config in years. Like I said, the only major change recently was enabling LTO everywhere...
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2325

PostPosted: Thu Oct 17, 2024 1:07 pm    Post subject: Reply with quote

bstaletic wrote:
logrusx wrote:
I have en_US ISO-8859-1 as well in my locale.gen.


I have just tried adding it.
No change in behaviour.

I have not touched locale config in years. Like I said, the only major change recently was enabling LTO everywhere...


Well, maybe something got rebuilt in relationship to that. Try looking for something relevant in emerge -pve ncurses output. That's the best I can do about your issue, sorry.

Until now I excluded the font problem route, because I didn't believe that it could be the problem, but it might be worth exploring in that direction too.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum