termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
37.06k stars 3.89k forks source link

[Bug]: Wrong TERM set #2744

Open tastytea opened 2 years ago

tastytea commented 2 years ago

Problem description

TERM is set to xterm-256color but it appears to not be xterm. It is important that terminals set TERM to a unique value because it makes it possible to react to quirks with workarounds.

For example, xterm sends ^H for backspace and ^? for control + backspace, most other terminals (including termux) do it the other way round. So I added this workaround:

if [[ "${TERM}" == xterm* ]]; then
    bindkey '^H'      backward-delete-char
    bindkey '^?'      backward-delete-word
fi

Works fine in xterm but breaks termux. Related: https://github.com/termux/termux-app/issues/212

Steps to reproduce the behavior.

echo ${TERM}

What is the expected behavior?

Please set TERM to termux or so.

System information

xakep8 commented 2 years ago

@tastytea which file did you add the above code to?

tastytea commented 2 years ago

@xakep8 To my ~/.zshrc.

libweirdness commented 2 years ago

$TERM = xterm-256color also breaks package-management within a proot-distro Ubuntu ( jammy ) install!

It breaks ?ncurses?, i think.

Once anything has required ncurses, or whatever the ascii-graphics UI provider is, then some other apt install 's within Ubuntu bring-up an ascii-graphics interface,

but the Termux-keyboard's up & down arrows don't work right, so one ends-up with gibberish spewing all over the place, and a very scrambled terminal ( "reset" doesn't fix history-scrolling, e.g. ), and no ability to interact with the configuration-management script.

apt package tzdata uses this broken graphics ui, if it is installed, as does postfix, and debsecan ( a debian security-analysis package ), and who-knows how many more?

I'm ripping out my Ubuntu installation, & re-installing, as a means of getting those packages in, before the ascii-graphics UI provider gets in there...

: (

Hope this helps identify the scope of the problem

( :