| Deutsch English Français Italiano |
|
<20250313162146.570@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Kaz Kylheku <643-408-1753@kylheku.com> Newsgroups: comp.unix.shell Subject: Re: Initiate command in another shell session? Date: Thu, 13 Mar 2025 23:41:07 -0000 (UTC) Organization: A noiseless patient Spider Lines: 25 Message-ID: <20250313162146.570@kylheku.com> References: <vquhba$3817f$1@dont-email.me> <87plikjz6j.fsf@nosuchdomain.example.com> Injection-Date: Fri, 14 Mar 2025 00:41:08 +0100 (CET) Injection-Info: dont-email.me; posting-host="eddf8a2ccdf2ea49ccac95c3e88dc09d"; logging-data="120469"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+TAV+gzz1aWmTYRiXi2U/lQAuanGxaJE8=" User-Agent: slrn/pre1.0.4-9 (Linux) Cancel-Lock: sha1:RD26gzP9i6BQfPBEYj9X9SSmx3E= Bytes: 2033 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/#1871997 What'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/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca