From d05734edb749fcffe9883642d77e5aaaba128b8a Mon Sep 17 00:00:00 2001 From: Jed Laundry Date: Thu, 29 Aug 2019 14:50:14 +1200 Subject: [PATCH] Fix issue with clipboard < 3 characters --- TypeClipboard/Form1.Designer.cs | 8 ++++---- TypeClipboard/Form1.cs | 9 ++------- TypeClipboard/Program.cs | 6 ------ 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/TypeClipboard/Form1.Designer.cs b/TypeClipboard/Form1.Designer.cs index 11abf4b..982080c 100644 --- a/TypeClipboard/Form1.Designer.cs +++ b/TypeClipboard/Form1.Designer.cs @@ -37,16 +37,16 @@ this.textBox1.Location = new System.Drawing.Point(12, 12); this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(212, 20); + this.textBox1.Size = new System.Drawing.Size(184, 20); this.textBox1.TabIndex = 0; // // button1 // - this.button1.Location = new System.Drawing.Point(230, 10); + this.button1.Location = new System.Drawing.Point(202, 10); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.Size = new System.Drawing.Size(103, 23); this.button1.TabIndex = 1; - this.button1.Text = "Type"; + this.button1.Text = "Type (2s delay)"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // diff --git a/TypeClipboard/Form1.cs b/TypeClipboard/Form1.cs index e3c5428..966c3e3 100644 --- a/TypeClipboard/Form1.cs +++ b/TypeClipboard/Form1.cs @@ -1,12 +1,6 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; namespace TypeClipboard @@ -97,7 +91,8 @@ namespace TypeClipboard StringBuilder sb = new StringBuilder(); sb.Append(clipboard.Substring(0, Math.Min(3, clipboard.Length))); sb.Append(" ... "); - sb.Append(clipboard.Substring(clipboard.Length - 3)); + sb.Append(clipboard.Substring(clipboard.Length - Math.Min(clipboard.Length, 3))); + sb.Append(" (" + clipboard.Length.ToString() + " characters)"); textBox1.Text = sb.ToString(); } else diff --git a/TypeClipboard/Program.cs b/TypeClipboard/Program.cs index 14e91a1..c311030 100644 --- a/TypeClipboard/Program.cs +++ b/TypeClipboard/Program.cs @@ -1,11 +1,5 @@ using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; -using TypeClipboard.Properties; namespace TypeClipboard {