[Gambas-user] removing xterm escape codes from terminal text
Bruce Steers
bsteers4 at gmail.com
Wed Jun 8 00:58:33 CEST 2022
On Tue, 7 Jun 2022, 23:37 Bruce Steers, <bsteers4 at gmail.com> wrote:
>
>
> On Tue, 7 Jun 2022, 23:24 Benoit Minisini, <
> benoit.minisini at gambas-basic.org> wrote:
>
>> Le 07/06/2022 à 22:19, Bruce Steers a écrit :
>> > Has anyone made a routine to strip xterm escape codes from a terminal
>> text?
>> >
>> > I'm looking at having to have a close study of the
>> > TerminalFilter_VT100.class and try to account for all possible code
>> > combinations to strip them.
>> >
>> > I thought before i spent hours doing it i'd ask if anyone already has
>> > and could share the code.
>> >
>> > Or if there is already a way either an existing function somewhere or
>> > possibly in gb.form.terminal or some other class a function that could
>> > do it.
>> >
>> > I'm looking at TerminalFilter_VT100.class and the function OutputTo()
>> > looks like it could do it , it seems to do all the right processing but
>> > for other reasons. maybe by printing to a stream i could get plain text
>> > but i do not know how to do that :(
>> >
>> > Any thoughts/suggestions?
>> > Many thanks
>> > All the best
>> > BruceS
>> >
>>
>> Why do you want to do that?
>>
>
> Because I can us the Process_Read() of the terminal process to control
> things inside a terminalview running a shell like bash or dash.
>
> I have working a routine that can "Wait" and get return codes/text from
> commands running inside the bash terminal but it reeds to read the terminal
> text that has a lot of hidden codes to process out.
> I know there is terminalview.text but reading each bit as I t comes and
> not all the text is preferred.
> Cheers
>
I have that RootShell thing I've been working on uploaded here for an
example of what I currently need it for...
https://forum.gambas.one/viewtopic.php?f=4&t=1333
Possibly a controversial use but this could be used for various other
things like easily piping out a copy/log of running shell terminal output.
Other functionality with a terminal running processes within processes.
Respects
BruceS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220607/a04f71cd/attachment.htm>
More information about the User
mailing list