diff options
| author | Michael <[email protected]> | 2017-03-08 19:08:35 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-08 19:08:35 -0500 |
| commit | 5f0cfb100cc0698ede828857393b7fd3f44af73d (patch) | |
| tree | c8f0169de51a9c29abc1750bab50a49595cf3dd1 /ShiftOS.WinForms | |
| parent | e51f51b7d1b379f7d632ee010ad704562aacb797 (diff) | |
| download | shiftos_thereturn-5f0cfb100cc0698ede828857393b7fd3f44af73d.tar.gz shiftos_thereturn-5f0cfb100cc0698ede828857393b7fd3f44af73d.tar.bz2 shiftos_thereturn-5f0cfb100cc0698ede828857393b7fd3f44af73d.zip | |
selecting content in terminal copies to clipboard
Diffstat (limited to 'ShiftOS.WinForms')
| -rw-r--r-- | ShiftOS.WinForms/Controls/TerminalBox.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index 4fcb429..b75d077 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -61,5 +61,29 @@ namespace ShiftOS.WinForms.Controls { this.AppendText(Localization.Parse(text) + Environment.NewLine); } + + bool quickCopying = false; + + protected override void OnMouseDown(MouseEventArgs e) + { + //if right-clicking, then we initiate a quick-copy. + if (e.Button == MouseButtons.Right) + quickCopying = true; + + //Override the mouse event so that it's a left-click at all times. + base.OnMouseDown(new MouseEventArgs(MouseButtons.Left, e.Clicks, e.X, e.Y, e.Delta)); + } + + protected override void OnMouseUp(MouseEventArgs mevent) + { + if(quickCopying == true) + { + if (!string.IsNullOrWhiteSpace(this.SelectedText)) + { + this.Copy(); + } + } + base.OnMouseUp(mevent); + } } } |
