Tab completion in SSH connection?

Topics: Developer Forum, User Forum
Jun 5, 2008 at 11:18 AM
I use terminals mainly for the RDP sessions with windows. However, I would also like to use it for my SSH connections.

The problem is, TAB completion does not work. When I am in a SSH session, the TAB key does not do completion, it tabs to another section of the application. Is there a way to correct this problem?

Thanks in advance.
Jul 10, 2008 at 1:53 PM
Anything new for this? That would really be great to have the tab completion working.

Terminals is so nice that I would like to do everything around it ! :)

Cheers !
Coordinator
Sep 8, 2008 at 10:27 PM
I would love to add this as well, unfortunately I'm using a 3rd party control for the SSH connection which doesnt support this either...

Oct 9, 2008 at 3:17 AM

For an interim fix, add the following code to class WalburySoftware.TerminalEmulator in TerminalControl/TerminalControl.cs

protected override bool ProcessDialogKey(Keys keyData)
{
if (keyData == Keys.Tab)
{
Message m = new Message();
m.Msg = WMCodes.WM_CHAR;
m.WParam = new IntPtr((int)keyData);

Keyboard.KeyDown(m);
return true;
}
else
{
return base.ProcessDialogKey(keyData);
}
}

Coordinator
Oct 26, 2008 at 7:08 PM
done!  Tested with Telnet and it works like a charm.

Thanks.
Nov 3, 2008 at 8:44 AM
Rob,

Is this already included in version 1.7b? or will it be in the next one?

Thank you so much for your work!

Also thank you Dozey!
Nov 3, 2008 at 11:18 AM

 Thankyou.  Unfortunately I only have time chime in with these quick hacks, so here's my last improvement:

For WalburySoftware.TerminalEmulator in TerminalControl/TerminalControl.cs - The arrow / navigation keys weren't being sent

protected override bool ProcessDialogKey(Keys keyData)

{
Message keyMess = new Message();
keyMess.WParam = new IntPtr((int) keyData);
switch (keyData)
{
case Keys.Left:
case Keys.Up:
case Keys.Right:
case Keys.Down:
{
keyMess.Msg = 0x100;
byte[] buffer = new byte[8];
byte[] bytes = BitConverter.GetBytes((ushort) keyData);
buffer[2] = bytes[0];
buffer[3] = 1;
keyMess.LParam = new IntPtr(BitConverter.ToInt64(buffer, 0));
this.Keyboard.KeyDown(keyMess);
return true;
}
case Keys.Tab:
keyMess.Msg = 0x102;
this.Keyboard.KeyDown(keyMess);
return true;
}
return base.ProcessDialogKey(keyData);
}

Also, add the following to WalburySoftware.TerminalEmulator.uc_Keyboard.uc_KeyMap.SetToDefault() in TerminalControl/TerminalControl.cs - I had neither the knowledge nor time to educate myself as to which keyboard mappings were in use, so I slipped these in; seems to work over ssh. You could alternatively map the up/down/right/left keys in ProcessDialogKeys() to their predefined key codes, which are 72, 80, 77 and 75 respectively. I decided to add mappings for the codes defined in System.Windows.Forms.Keys as follows instead. 

Elements.Add(new uc_KeyInfo(38, true, "Key", "\x1B[A", uc_Mode.Any, 0));
Elements.Add(new uc_KeyInfo(40, true, "Key", "\x1B[B", uc_Mode.Any, 0));
Elements.Add(new uc_KeyInfo(39, true, "Key", "\x1B[C", uc_Mode.Any, 0));
Elements.Add(new uc_KeyInfo(37, true, "Key", "\x1B[D", uc_Mode.Any, 0));

Sorry I can't be of much assistance; I'd hand over the amended source code if I still had a copy - the changes above were pried from an assembly using Reflector and my sketchy memory. Hopefully some good will come of it.

Nov 3, 2008 at 9:48 PM
Hi,

  patch 2034 steals code from VncSharp and makes not just tab completion but arrow keys work.

Julian
Coordinator
Dec 9, 2008 at 4:52 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.