File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System ;
2+ namespace SSHDebugger . Extensions
3+ {
4+ public static class ExtGdkKey
5+ {
6+ public static char GetChar ( this Gdk . Key key )
7+ {
8+ return ( char ) Gdk . Keyval . ToUnicode ( ( uint ) key ) ;
9+ }
10+ }
11+ }
Original file line number Diff line number Diff line change 5757 <Compile Include =" Terminal\clsSSHTerminal.cs" />
5858 <Compile Include =" Terminal\ITerminal.cs" />
5959 <Compile Include =" Terminal\FrontEnd\windowTerminalGTK.cs" />
60+ <Compile Include =" Extensions\ExtGdkKey.cs" />
6061 </ItemGroup >
6162 <ItemGroup >
6263 <EmbeddedResource Include =" Properties\Manifest.addin.xml" />
7879 <Folder Include =" Host\" />
7980 <Folder Include =" Terminal\" />
8081 <Folder Include =" Terminal\FrontEnd\" />
82+ <Folder Include =" Extensions\" />
8183 </ItemGroup >
8284 <ItemGroup >
8385 <None Include =" ..\SSHDebugger.png" >
Original file line number Diff line number Diff line change 3535using System . Net . Sockets ;
3636using System . Text ;
3737using System . Threading . Tasks ;
38+ using SSHDebugger . Extensions ;
3839
3940namespace SSHDebugger
4041{
@@ -456,8 +457,32 @@ public void ShellSend(Gdk.Key key)
456457 if ( LocalEcho ) Write ( key . ToString ( ) ) ;
457458 if ( shellStream != null && shellStream . CanWrite )
458459 {
459- shellStream . WriteByte ( ( byte ) key ) ;
460- shellStream . Flush ( ) ;
460+ byte [ ] charBytes = null ;
461+
462+ switch ( key )
463+ {
464+ case Gdk . Key . Shift_L :
465+ case Gdk . Key . Shift_R :
466+ case Gdk . Key . ISO_Level3_Shift : //Alt Gr
467+ //Ignore
468+ break ;
469+ case Gdk . Key . Return :
470+ case Gdk . Key . KP_Enter :
471+ charBytes = Encoding . UTF8 . GetBytes ( Environment . NewLine ) ;
472+ break ;
473+ case Gdk . Key . BackSpace :
474+ charBytes = new byte [ ] { ( byte ) '\b ' } ;
475+ break ;
476+ default :
477+ charBytes = Encoding . UTF8 . GetBytes ( new char [ ] { key . GetChar ( ) } ) ;
478+ break ;
479+ }
480+
481+ if ( charBytes != null )
482+ {
483+ shellStream . Write ( charBytes , 0 , charBytes . Length ) ;
484+ shellStream . Flush ( ) ;
485+ }
461486 }
462487 }
463488 }
You can’t perform that action at this time.
0 commit comments