[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TerminalView position and text of prompt
[Thread Prev] | [Thread Next]
- Subject: Re: TerminalView position and text of prompt
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Mon, 22 Apr 2024 16:35:18 -0700
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On 4/20/24 07:19, Bruce Steers wrote:
It seems that line gets all the PS1 string though My PS1 is this.. '\[\e]0;\u: \W\a\]\[\033[01;96m\]\u\[\033[00m\]:\[\033[01;92m\]\W\[\033 between the \e]0; and the \a\] is the part that is read to set the title. The "title getting" code uses this PS1 string,if i change my PS1 to say '\u \w : ' then the PS1 does not have the \e]0; and the terminal will not fire a Title change anymore as it requires this syntax.That PS1 variable is the exact string that sData in the OutputTo method reads. So i reckon it could be considered as much as a solid standard as the title change is.It's a darn shame there is no reasonable / reliable method :( Respects BruceS :)On Sat, 20 Apr 2024 at 06:55, Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> wrote:Le 20/04/2024 à 04:58, Bruce Steers a écrit : > > I may have found an answer already in the code... > https://gitlab.com/gambas/gambas/-/blob/master/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class?ref_type=heads#L158 <https://gitlab.com/gambas/gambas/-/blob/master/comp/src/gb.form.terminal/.src/TerminalView/TerminalFilter_VT100.class?ref_type=heads#L158> > > it does this..... > > If sCmd = "0" Or If sCmd = "2" Then > hView.Title = sTitle > > sData at that point has the path to the left of iPos2 that is used to > set the title and it seems to have the prompt to the right > > If sCmd = "0" Or If sCmd = "2" Then > hView.Title = sTitle > hView.Prompt = Mid$(sData, iPos2 + 1) > > > I wish there was an easily way to remove escape sequences and convert it > to plain text > > All i found was a sed command > > Private Sub Prompt_Write(Value As String) > > Shell "echo -n '" & Value & "'| sed -r > \"s/\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g\"" To $sPrompt > > End > > > Respects > BruceS > This code manages the command for setting the terminal emulator window title. It is an XTerm specific command that became implicit standard. Nothing says that the window title will include the prompt. Regards,-- Benoît Minisini.
I am not sure if this helps, but there is a filter hook in the terminal that allows to monitor what is written to the terminal. Would it be possible to monitor that for the last output, or an expected prompt? -- ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: TerminalView position and text of prompt | Bruce Steers <bsteers4@xxxxxxxxx> |
TerminalView position and text of prompt | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: TerminalView position and text of prompt | Gianluigi <gradobag@xxxxxxxxxxx> |
Re: TerminalView position and text of prompt | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: TerminalView position and text of prompt | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: TerminalView position and text of prompt | Bruce Steers <bsteers4@xxxxxxxxx> |
Re: TerminalView position and text of prompt | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: TerminalView position and text of prompt | Bruce Steers <bsteers4@xxxxxxxxx> |