Sujet : Re: Initiate command in another shell session?
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shellDate : 14. Mar 2025, 00:41:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250313162146.570@kylheku.com>
References : 1 2
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-03-13, Keith Thompson <Keith.S.Thompson+
u@gmail.com> wrote:
On some systems, opening a tty and calling ioctl(fd, TIOCSTI, ptr),
where ptr is a char*, will cause the single character *p to appear
as if it had been typed.
I used this in a Superuser Stackexchange answer, the C code from
which can be used as a sample.
https://superuser.com/questions/272818/how-to-turn-off-word-wrap-in-less/#1871997What's such a thing doing on Superuser? It's part of trying to address
a usability quirk with the "less" pager, in a really hacky way.
I cobbed a solution together whereby we filter the to-be-paged text to
add a certain number of spaces to the start of every line, and then we
tell less to scroll to the right by exactly that many positions.
How we do that last step is by injecting the right arrow escape sequence
via TIOCSTI. (A small delay is required, so that this injection happens
after less has done its terminal initialization.)
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca