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

Re: TerminalView position and text of prompt


On Tue, 16 Apr 2024 at 15:37, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> On Tue, 16 Apr 2024 at 14:15, Benoît Minisini <
> benoit.minisini@xxxxxxxxxxxxxxxx> wrote:
>
>> Le 16/04/2024 à 15:03, Bruce Steers a écrit :
>> >
>> > So i just need to know reliably where exactly the PS1 prompt ends and
>> > the command begins.
>> >
>> > If possible, If somewhere in the terminalview code this place is known?
>> > Or if from the codes perspective that position is all handled by the
>> > running shell so it's irrelevant/unknown.
>> >
>> > Respects
>> > BruceS
>> >
>>
>> I think there is no reliable way to detect a prompt:
>>
>> - The shell knows what the prompt is, and when it will be printed to the
>> terminal. But it cannot know how exactly it will be drawn inside the
>> terminal.
>>
>> - The terminal knows how things are drawn. But it has no way to know
>> what is a prompt, and what is not a prompt.
>>
>> Regards,
>>
>> --
>> Benoît Minisini.
>
> Thank you Ben , i feared as much.
>
> Respects
> BruceS
>

I found something i might be able to use (somehow)
echo "'${PS1@P}'"

getting a different result with TerminalView than i do with mate-terminal
and konsole though
(see pic)
the others echo the line exactly as it looks.

Respects
BruceS

Attachment: Untitled.jpg
Description: JPEG image


References:
TerminalView position and text of promptBruce Steers <bsteers4@xxxxxxxxx>
Re: TerminalView position and text of promptGianluigi <gradobag@xxxxxxxxxxx>
Re: TerminalView position and text of promptBruce Steers <bsteers4@xxxxxxxxx>
Re: TerminalView position and text of promptBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: TerminalView position and text of promptBruce Steers <bsteers4@xxxxxxxxx>