bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Remove delay in `tset`


From: Tim Hutt
Subject: Re: Remove delay in `tset`
Date: Sat, 9 Mar 2024 12:26:27 +0000

> Why are you often having to reset your terminal?

Three reasons:

1. Some apps don't handle Ctrl-C properly. I think this is understandable given that it is sent as a signal and signals are a disaster from a programming UX point of view.
2. Sometimes apps have bugs and you have to kill them. They can't reasonably do anything in that case.
3. As a workaround for the lack of Ctrl-K support on Linux. On Mac all common terminal emulators support Ctrl-K as a shortcut for clearing the screen *and scrollback* (unlike Ctrl-L). For some reason this shortcut is almost never supported by default on Linux. I'm not really sure why, but `reset` is an okish workaround. Still not as good as Ctrl-K but I can live with it.

> Are you filing bugs against it for not putting things back the way it found them when starting up?

In some cases yes, but I hope it's pretty obvious why that isn't really a scalable answer. It also only addresses point 1 above.

> You could use tput(1) instead of tset(1).
> Conceivably, tset could be changed to check for the NCURSES_NO_PADDING environment variable

Just to be clear, the goal is to have a reasonable *default*. I use the `tput` workaround on my own system, but it doesn't help anyone else - or me when I'm sshing into another system. If I understand correctly, checking for NCURSES_NO_PADDING wouldn't change the default behaviour either.

I can think of properly engineered solutions to the reasons I listed above, e.g.

a) Why doesn't the shell restore the terminal state automatically after programs exit? You don't have to worry about leaving open files or allocated memory around after a program exits? Why does the terminal require manual restoration? I assume there is some reason given that it doesn't and this seems like an obvious feature.
b) Linux terminal emulators should support Ctrl-K by default (or some similar shortcut that does the same thing). Unfortunately this suffers from the scalability issue.

However those are complicated and this is a one line change with - as far as anyone has told me - no downsides. It has a very high improvement to effort ratio.

Cheers,

Tim

reply via email to

[Prev in Thread] Current Thread [Next in Thread]