[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: can Control+key code be sent by TerminalView.Input() like Alt+key can?
[Thread Prev] | [Thread Next]
- Subject: Re: can Control+key code be sent by TerminalView.Input() like Alt+key can?
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Thu, 2 May 2024 12:12:25 +0100
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On Thu, 2 May 2024 at 02:30, Bruce Steers <bsteers4@xxxxxxxxx> wrote:
>
>
> On Wed, 1 May 2024 at 23:12, Benoît Minisini <
> benoit.minisini@xxxxxxxxxxxxxxxx> wrote:
>
>> Le 01/05/2024 à 21:24, Bruce Steers a écrit :
>> >
>> > To send an Alt+key code to TerminalView i do this..
>> > for example Alt+u would simply be...
>> >
>> > TerminalView1.Input("\eu")
>> > and then in bash the current word is made uppercase from the cursor.
>> >
>> > How would i do the same but with Control+u
>> > I looked about and found some info
>> > https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_input_sequences
>> > <
>> https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_input_sequences>
>> >
>> > I tried TerminalView1.Input("\e[117;5~")
>> > and TerminalView1.Input("\e[5117")
>> > and with Hex(117) 75
>> >
>> > no worky :(
>> >
>> > is it possible ?
>> >
>> > Many thanks
>> > BruceS
>> >
>>
>> Yes, provided that someone writes the code to handle all the missing
>> keyboard sequences in the 'TerminalFilter_VT100.InputTo()' method.
>>
>> Regards,
>>
>> --
>> Benoît Minisini.
>>
>
> eek i only want to input the key code to bash and let bash do all the work
> ;)
>
> i found this ascii table
> https://www.physics.udel.edu/~watson/scen103/ascii.html
>
> Ctrl-U is Hex 15
>
> TrminalView1.Input.("\x15") Does as expected, deletes line left of cursor
>
> would i need to implement it for all keys?
>
> after research i find a control key is ascii key code And 0x1F
>
> and i find yes Hex(Asc("U") And &1F) is 15
>
> but how do i convert Hex(Asc("U") And &1F) into string "\x15" i can input?
>
> I tried something like this but it failed...
> Dim s As String = "\x" & Hex(Asc("U") And &1F)
> TerminalView1.Input(s)
>
>
> But done correctly something like that should work for all the other keys
> too right?
>
> Respects
> BruceS
>
So i now have something like this after setting my menu to the group
SendKeyCode...
'' send a menu Ctrl+ shortcut hit to the terminal like a keypress.
Public Sub SendKeyCode_Click()
Dim aKeys As String[] = Split(Last.Shortcut, "+")
If Not aKeys.Exist("Ctrl") Then Return
Dim sChar As String = UCase(aKeys.Last)
TerminalView1.Input(Chr$(Asc(sChar) And &1F))
End
The reason for this code is that i set up a menu that shows the Ctrl+u
shortcut for deleting to SOL.
If i press Ctrl+U on the keyboard the terminal swallows the keypress so the
menu event does not trigger and but the terminal handles the key and the
function functions.
But when i selected the menu i then needed a way to manually trigger the
key event in the terminal.
Now I should be able to add the other built-in keyboard shortcuts to me
menus and just set their group to the above function :)
Respects
BruceS
| can Control+key code be sent by TerminalView.Input() like Alt+key can? | Bruce Steers <bsteers4@xxxxxxxxx> |
| Re: can Control+key code be sent by TerminalView.Input() like Alt+key can? | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
| Re: can Control+key code be sent by TerminalView.Input() like Alt+key can? | Bruce Steers <bsteers4@xxxxxxxxx> |