hishamhm / htop

htop is an interactive text-mode process viewer for Unix systems. It aims to be a better 'top'.
GNU General Public License v2.0
5.85k stars 580 forks source link

Hardcoding tab width #854

Open fbruetting opened 6 years ago

fbruetting commented 6 years ago

I have tabs -4 in my .bashrc, because 8-letter-wide spaces are overkill for most purposes. htop however sadly reuses this environment variable and thus the displayed columns get corrupted. Please hardcode this.

I use Fedora 29 and htop v2.2.0.

bildschirmfoto von 2018-11-09 20-01-57

wangqr commented 6 years ago

I am not able to reproduce this issue on archlinux with tilix 1.8.5 or xfce4-terminal 0.8.7.4, and ncurses 6.1. Does running tabs -8 before htop resolve this issue for you?

fbruetting commented 6 years ago

Yes, it does, but then I loose my custom tab spacing.

wangqr commented 6 years ago

I just tried Fedora 29 Workstation LiveCD on VirtualBox, with dnf installed htop and tilix but still cannot reproduce this. Can you provide the output of

echo $TERM
locale

And try stty sane; reset; tabs -4; htop and see if that works fine?

fbruetting commented 6 years ago

Thank you for your effort! Gnome-Terminal behaves the same, by the way. Your last command sadly didn’t solve that issue. And I use Fedora Silverblue, but I don’t think that this makes any difference here as both terminals are installed by RPM-layering (I can confirm this on Monday at work, there I have the regular Fedora 28).

> echo $TERM
xterm-256color
> locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
fbruetting commented 5 years ago

Ok, I could reproduce this on another Fedora Silverblue 29 machine.

Additionally, I saw some other artifacts on the regular Fedora 28 machine, where some glyphs of the load bars remained uncleared, after the bar shrinked down. The glyphs then stayed in place, while the smaller bar worked on without an artifact. It looked like this: [||||||||||||||                |||             ]

In my bashrc, I just specified a few things:

# .bashrc

## Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

tabs -4

export  EDITOR=nvim
export  PAGER=less

alias ..="      cd .."
alias ...="     cd ../.."
alias ....="    cd ../../.."
alias .....="   cd ../../../.."
alias ......="  cd ../../../../.."

alias igrep="   grep -i"

alias l="       exa --git"
alias la="      exa --git -a"
alias lt="      exa --git -T"
alias lat="     exa --git -aT"

alias ll="      exa --git -lgH"
alias lla="     exa --git -lgH -a"
alias llt="     exa --git -lgH -T"
alias llat="    exa --git -lgH -aT"

alias less="    less -x1,5"

alias untar="   tar -zxvf"
alias wget="    wget -c"
alias getpass=" openssl rand -base64 20"
alias sha="     shasum -a 256"
alias ping="    ping -c 5"
alias ip_ext="  curl ipinfo.io/ip"

## Powerline-Go
function _update_ps1() {
    PS1="$(/usr/bin/powerline-go -error $?)"
}

if [ "$TERM" != "linux" ]; then
    PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND"
fi

Otherwise, in the meantime I also have seen other artifacts in the bar graphs:

fbruetting commented 5 years ago

So curses has the library variable TABSIZE which defaults to the initial_tabs value of the terminal database – and thus does not respect tabs -4 commands from .bashrc. Can you please set this variable accordingly to the current tab size of the terminal at program start?