Skip to content

Commit de0e6b9

Browse files
author
Logic Ethos Ltd
authored
Merge pull request logicethos#11 from Int32Overflow/master
Better Terminal input support
2 parents e0d1861 + f48dc67 commit de0e6b9

6 files changed

Lines changed: 63 additions & 38 deletions

File tree

Renci.SshNet.dll

-430 KB
Binary file not shown.

SSHDebugger/Host/clsHost.cs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -297,27 +297,30 @@ String ReplaceVarsInString (String input)
297297
return sb.ToString ();
298298
}
299299

300-
String GetVar (String input)
301-
{
302-
switch (input)
303-
{
304-
case "exe-path":
305-
return build_exe_path;
306-
case "mdb-path":
307-
return build_exe_path + ".mdb";
308-
case "build-path":
309-
return Path.GetDirectoryName(build_exe_path);
310-
case "work-dir":
311-
return WorkingDir;
312-
case "RemoteTunnelPort":
313-
return RemoteTunnelPort.ToString ();
314-
case "exe-file":
315-
return Path.GetFileName (build_exe_path);
316-
default:
317-
return "?";
318-
319-
}
320-
}
300+
String GetVar(String input)
301+
{
302+
switch (input)
303+
{
304+
case "exe-path":
305+
return build_exe_path;
306+
case "mdb-path":
307+
return build_exe_path + ".mdb";
308+
case "pdb-path":
309+
//Replace Test.exe => Test.pdb
310+
return build_exe_path.Substring(0, build_exe_path.Length - ".exe".Length) + ".pdb";
311+
case "build-path":
312+
return Path.GetDirectoryName(build_exe_path);
313+
case "work-dir":
314+
return WorkingDir;
315+
case "RemoteTunnelPort":
316+
return RemoteTunnelPort.ToString();
317+
case "exe-file":
318+
return Path.GetFileName(build_exe_path);
319+
default:
320+
return "?";
321+
322+
}
323+
}
321324

322325

323326
public SoftDebuggerStartInfo DebuggerInfo (int consolePort = -1)

SSHDebugger/SSHDebugger.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\MonoDevelop.Addins.0.4.4\build\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.4\build\MonoDevelop.Addins.props')" />
3+
<Import Project="..\packages\MonoDevelop.Addins.0.4.5\build\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.5\build\MonoDevelop.Addins.props')" />
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -63,12 +63,12 @@
6363
</ItemGroup>
6464
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
6565
<ItemGroup>
66-
<Reference Include="Renci.SshNet">
67-
<HintPath>..\Renci.SshNet.dll</HintPath>
68-
</Reference>
6966
<Reference Include="vte-sharp" Condition="$(DefineConstants.Contains('VTE'))">
7067
<HintPath>..\vte-sharp.dll</HintPath>
7168
</Reference>
69+
<Reference Include="Renci.SshNet">
70+
<HintPath>..\packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
71+
</Reference>
7272
</ItemGroup>
7373
<ItemGroup>
7474
<AddinFile Include="ssh-host.xft.xml" />
@@ -90,5 +90,5 @@
9090
<AddinReference Include="MonoDevelop.Debugger" />
9191
<AddinReference Include="MonoDevelop.Debugger.Soft" />
9292
</ItemGroup>
93-
<Import Project="..\packages\MonoDevelop.Addins.0.4.4\build\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.4\build\MonoDevelop.Addins.targets')" />
93+
<Import Project="..\packages\MonoDevelop.Addins.0.4.5\build\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.4.5\build\MonoDevelop.Addins.targets')" />
9494
</Project>

SSHDebugger/Terminal/clsSSHTerminal.cs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -473,20 +473,40 @@ public String RequestUserInput(String prompt, char? echoChar=null)
473473
UserInputMode = true;
474474
Write (prompt);
475475
String input = "";
476-
while (userkeypress.WaitOne ())
476+
while (UserInputMode && userkeypress.WaitOne ())
477477
{
478-
if (LastKeyPress == Gdk.Key.BackSpace) {
479-
if (input.Length > 0) {
480-
input = input.Substring (0, input.Length - 1);
481-
if (echoChar.HasValue) Write ("\b \b");
478+
switch(LastKeyPress)
479+
{
480+
case Gdk.Key.BackSpace:
481+
{
482+
if (input.Length > 0)
483+
{
484+
input = input.Substring(0, input.Length - 1);
485+
if (echoChar.HasValue) Write("\b \b");
486+
}
487+
}
488+
break;
489+
case Gdk.Key.Return:
490+
case Gdk.Key.KP_Enter:
491+
{
492+
Write(Environment.NewLine);
493+
UserInputMode = false; //Stop Input
494+
break;
495+
}
496+
case Gdk.Key.Shift_L:
497+
case Gdk.Key.Shift_R:
498+
case Gdk.Key.ISO_Level3_Shift: //Alt Gr
499+
{
500+
//Do nothing
501+
}
502+
break;
503+
default:
504+
{
505+
var keyValue = (char)Gdk.Keyval.ToUnicode((uint)LastKeyPress);
506+
Write(echoChar.HasValue ? echoChar.Value.ToString() : keyValue.ToString());
507+
input += keyValue;
482508
}
483-
} else if (LastKeyPress == Gdk.Key.Return) {
484-
Write ("\r\n");
485509
break;
486-
} else {
487-
var keyValue = (char)LastKeyPress;
488-
Write (echoChar.HasValue ? echoChar.Value.ToString() : keyValue.ToString());
489-
input += keyValue;
490510
}
491511
}
492512
UserInputMode = false;

SSHDebugger/packages.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="MonoDevelop.Addins" version="0.4.4" targetFramework="net461" />
3+
<package id="MonoDevelop.Addins" version="0.4.5" targetFramework="net461" />
4+
<package id="SSH.NET" version="2016.1.0" targetFramework="net461" />
45
</packages>

SSHDebugger/ssh-host.xft.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# [exe-file] = output .exe filename
2828
# [exe-path] = path to output .exe
2929
# [mdb-path] = path to output .exe.mdb
30+
# [pdb-path] = path to output .pdb
3031
# [build-path] = path to output
3132
# [work-dir] = remote working dir
3233

0 commit comments

Comments
 (0)