From 04a0d36183078d66ba97f2b621113bef608731ea Mon Sep 17 00:00:00 2001 From: d3agle Date: Sat, 5 Sep 2015 11:53:30 -0500 Subject: [PATCH 1/4] RemoteShell caret positioning fix -Will always scroll to the very bottom of the rtb when text is changed --- Server/Forms/FrmRemoteShell.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 69f7d624..2e0911c0 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -3,6 +3,7 @@ using System.Windows.Forms; using System.Drawing; using xServer.Core.Helper; using xServer.Core.Networking; +using xServer.Core.Utilities; namespace xServer.Forms { @@ -43,8 +44,7 @@ namespace xServer.Forms private void txtConsoleOutput_TextChanged(object sender, EventArgs e) { - txtConsoleOutput.SelectionStart = txtConsoleOutput.TextLength; - txtConsoleOutput.ScrollToCaret(); + NativeMethods.SendMessage(txtConsoleOutput.Handle, 277, 7, 0); } private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e) From 6c582ff7639b4951f38c9b70560de7aa21b21270 Mon Sep 17 00:00:00 2001 From: d3agle Date: Sat, 5 Sep 2015 12:09:14 -0500 Subject: [PATCH 2/4] Remote shell color fix for mono --- Server/Forms/FrmRemoteShell.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 2e0911c0..8926c451 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -101,6 +101,7 @@ namespace xServer.Forms { txtConsoleOutput.Invoke((MethodInvoker)delegate { + txtConsoleOutput.SelectionColor = Color.White; txtConsoleOutput.AppendText(message); }); } From 567d9dc2f50f82396c76ddfa349f7dc5081c135b Mon Sep 17 00:00:00 2001 From: d3agle Date: Sat, 5 Sep 2015 12:16:10 -0500 Subject: [PATCH 3/4] Remote shell refactor --- Server/Core/Helper/NativeMethodsHelper.cs | 8 ++++++++ Server/Forms/FrmRemoteShell.cs | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Server/Core/Helper/NativeMethodsHelper.cs b/Server/Core/Helper/NativeMethodsHelper.cs index 1aa8420b..1c4efba4 100644 --- a/Server/Core/Helper/NativeMethodsHelper.cs +++ b/Server/Core/Helper/NativeMethodsHelper.cs @@ -8,6 +8,9 @@ namespace xServer.Core.Helper private const int LVM_FIRST = 0x1000; private const int LVM_SETITEMSTATE = LVM_FIRST + 43; + private const int WM_VSCROLL = 277; + private const int SB_PAGEBOTTOM = 7; + public static int MakeLong(int wLow, int wHigh) { int low = (int)IntLoWord(wLow); @@ -31,5 +34,10 @@ namespace xServer.Core.Helper }; NativeMethods.SendMessageLVItem(handle, LVM_SETITEMSTATE, itemIndex, ref lvItem); } + + public static void ScrollToBottom(IntPtr handle) + { + NativeMethods.SendMessage(handle, WM_VSCROLL, SB_PAGEBOTTOM, 0); + } } } diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 8926c451..9dd5dc1e 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -3,7 +3,6 @@ using System.Windows.Forms; using System.Drawing; using xServer.Core.Helper; using xServer.Core.Networking; -using xServer.Core.Utilities; namespace xServer.Forms { @@ -44,7 +43,7 @@ namespace xServer.Forms private void txtConsoleOutput_TextChanged(object sender, EventArgs e) { - NativeMethods.SendMessage(txtConsoleOutput.Handle, 277, 7, 0); + NativeMethodsHelper.ScrollToBottom(txtConsoleOutput.Handle); } private void txtConsoleInput_KeyDown(object sender, KeyEventArgs e) From 2662f1d95258e20a0d79d077a69f2f5736523d85 Mon Sep 17 00:00:00 2001 From: d3agle Date: Sat, 5 Sep 2015 12:24:43 -0500 Subject: [PATCH 4/4] Corrected color of normal output --- Server/Forms/FrmRemoteShell.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/Forms/FrmRemoteShell.cs b/Server/Forms/FrmRemoteShell.cs index 9dd5dc1e..2579eb4a 100644 --- a/Server/Forms/FrmRemoteShell.cs +++ b/Server/Forms/FrmRemoteShell.cs @@ -100,7 +100,7 @@ namespace xServer.Forms { txtConsoleOutput.Invoke((MethodInvoker)delegate { - txtConsoleOutput.SelectionColor = Color.White; + txtConsoleOutput.SelectionColor = Color.WhiteSmoke; txtConsoleOutput.AppendText(message); }); }