Skip to content
Permalink
Browse files

Trim text in TEdit's on session manager dialog, to prevent leading an…

…d trailing spaces after pasting. Closes #797
  • Loading branch information
ansgarbecker committed Dec 11, 2019
1 parent 8b21b0d commit a40fd226c133216cc68255a33b31acb3b832bd14
Showing with 27 additions and 0 deletions.
  1. +11 −0 source/connections.dfm
  2. +16 −0 source/connections.pas
@@ -327,6 +327,7 @@ object connform: Tconnform
Anchors = [akLeft, akTop, akRight]
TabOrder = 5
OnChange = Modification
OnExit = editTrim
end
object editHost: TEdit
Left = 120
@@ -336,6 +337,7 @@ object connform: Tconnform
Anchors = [akLeft, akTop, akRight]
TabOrder = 2
OnChange = editHostChange
OnExit = editTrim
end
object comboNetType: TComboBox
Left = 120
@@ -502,6 +504,7 @@ object connform: Tconnform
Text = 'editSSHUser'
TextHint = 'Your secure shell username'
OnChange = Modification
OnExit = editTrim
end
object editSSHPassword: TEdit
Left = 120
@@ -529,6 +532,7 @@ object connform: Tconnform
TextHint = 'Doubleclick to select plink.exe ...'
OnChange = editSSHPlinkExeChange
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object editSSHhost: TEdit
@@ -540,6 +544,7 @@ object connform: Tconnform
TabOrder = 1
Text = 'editSSHhost'
OnChange = Modification
OnExit = editTrim
end
object editSSHport: TEdit
Left = 356
@@ -566,6 +571,7 @@ object connform: Tconnform
TextHint = 'PuTTY private key (*.ppk)'
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object editSSHTimeout: TEdit
@@ -668,6 +674,7 @@ object connform: Tconnform
TextHint = 'Path to key file'
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object editSSLCACertificate: TButtonedEdit
@@ -683,6 +690,7 @@ object connform: Tconnform
TextHint = 'Path to certificate authority file'
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object editSSLCertificate: TButtonedEdit
@@ -698,6 +706,7 @@ object connform: Tconnform
TextHint = 'Path to certificate file'
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object chkWantSSL: TCheckBox
@@ -746,6 +755,7 @@ object connform: Tconnform
TabOrder = 5
OnChange = Modification
OnDblClick = PickFile
OnExit = editTrim
OnRightButtonClick = PickFile
end
object chkFullTableStatus: TCheckBox
@@ -790,6 +800,7 @@ object connform: Tconnform
TabOrder = 4
TextHint = 'List of permissible ciphers to use for SSL encryption'
OnChange = Modification
OnExit = editTrim
end
object editKeepAlive: TEdit
Left = 120
@@ -171,6 +171,7 @@ Tconnform = class(TExtForm)
procedure TimerButtonAnimationTimer(Sender: TObject);
procedure ColorBoxBackgroundColorGetColors(Sender: TCustomColorBox;
Items: TStrings);
procedure editTrim(Sender: TObject);
private
{ Private declarations }
FLoaded: Boolean;
@@ -990,6 +991,21 @@ procedure Tconnform.editHostChange(Sender: TObject);
end;


procedure Tconnform.editTrim(Sender: TObject);
var
Edit: TCustomEdit;
Trimmed: String;
begin
// Trim input
Edit := Sender as TCustomEdit;
Trimmed := Edit.Text;
Trimmed := Trimmed.Trim([' ', #9]);
if Edit.Text <> Trimmed then begin
Edit.Text := Trimmed;
end;
end;


procedure Tconnform.chkLoginPromptClick(Sender: TObject);
var
Checked: Boolean;

0 comments on commit a40fd22

Please sign in to comment.
You can’t perform that action at this time.