help-bash
[Top][All Lists]
Advanced

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

Re: question .. did u implent when checkwinsize no need to exteral bin t


From: alex xmb ratchev
Subject: Re: question .. did u implent when checkwinsize no need to exteral bin to update
Date: Tue, 25 Apr 2023 16:17:23 +0200

On Tue, Apr 25, 2023, 3:17 PM Chet Ramey <chet.ramey@case.edu> wrote:

> On 4/24/23 7:17 PM, alex xmb ratchev wrote:
>
> >      > This is not case because : is a builtin. For COLUMNS and LINES to
> be
> >     set, either the command must be external or the shell must be
> >     interactive and must have received SIGWINCH.
> >
> >     The entire reason for checkwinsize is for use with interactive
> shells with
> >     job control enabled, since the shell will not get SIGWINCH when a
> >     foreground job has the terminal.
> >
> >
> > i dont get it
>
> OK. When a shell with job control is running, signals like SIGWINCH go to
> the foreground job, not the shell. That means that if you resize the
> terminal when a screen editor is running, the shell won't know it.
>
> checkwinsize exists to solve that problem: when it's set, interactive
> shells with job control enabled can poll for window size changes that
> happen when another process has the terminal. It happens to work when
> the shell is not interactive, too, but that was not the primary intent.
>
> Interactive shells install a signal handler for SIGWINCH, so they will be
> able to detect window size changes when the shell is the foreground job.
> Non-interactive shells don't.
>
> > but , i d need it for scripts
>
> If you find you need it for scripts, set a trap on SIGWINCH and parse the
> output of `stty size'. Or just parse the output when you need to.
>

firsly , big thanks to insightful explaintion
i just needed twice for it :))

so 1 i know more when change size
i for in scripts .. just used it as replacement for stty and other such cmds
i guess i can also sme ansi csi code to read the values ..

it doesnt have much functionality
rows and lines ..
for like chat apps useful

thanks , ++ , greets ..

-- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>
>


reply via email to

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