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

Re: Using TeminalScreen.class to move cursor


On Sat, 6 Apr 2024 at 21:35, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> On Sat, 6 Apr 2024 at 20:11, Brian G <brian@xxxxxxxxxxxxxxxx> wrote:
>
>> Why would you not just use the absolute position escape sequence after
>> calculating the needed position from your text buffer?
>>
>> '\e[vpos;hposH'
>>
>> or move n pos left or right
>>
>> '\e[nspacesD'  '\e24D' or '\e[nspacesC' '\e2C'
>>
>> Maybe I don't understand, But it seems correct to not be moving the
>> cursor around bit by bit, but just put it where you want.
>>
>> Select Case iCode
>>       Case Key.Up
>>         sText = If(.AppCursorKey, "\eOA", subst("\e[&1A",len))
>>       Case Key.Down
>>         sText = If(.AppCursorKey, "\eOB", subst("\e[&1B",len))
>>       Case Key.Right
>>         sText = If(.AppCursorKey, "\eOC", subst("\e[&1C",len))
>>       Case Key.Left
>>         sText = If(.AppCursorKey, "\eOD", subst("\e[&1D",len))
>>     End Select
>>
>> 'sText = String(Len, sText)
>>
> That did not work :(   it just printed D when i hit Ctrl+Left (the code
> was correct '\e[15D' )
> i think terminalview is handling it differently (i'm having to hack the
> private api to make it work).
>
> the commands seem to work if i use the recommended TerminalView.Print()
> command but then i cannot move cursor right like before as it does not
> update the cursor position so it thinks i'm still where i was before the
> move.
>
> The code I have that sends an amount of right or left escape sequences is
> currently the only thing i've got working correctly.
>
> Respects
> BruceS
>

You should implement something similar in your terminal program, it's not
as easy as you'd expect ;)
But it is super useful.
My Terminal program now if holding Ctrl i can jump words using left and
right or move line with up and down,  , and I'm loving it like that :)

Respects
BruceS

References:
Re: Using TeminalScreen.class to move cursorBruce Steers <bsteers4@xxxxxxxxx>
Re: Using TeminalScreen.class to move cursorBrian G <brian@xxxxxxxxxxxxxxxx>
Re: Using TeminalScreen.class to move cursorBruce Steers <bsteers4@xxxxxxxxx>