瀏覽代碼

Bug 1911: Allow longer input on Edit file input box

https://winscp.net/tracker/1911
(cherry picked from commit b873a4afc8c6e7f1cdf6dd6a03f7cf12c102c631)

Source commit: 2fd454cad946ccf25830bd2f95660195211d55e3
Martin Prikryl 5 年之前
父節點
當前提交
67dcbed771
共有 3 個文件被更改,包括 10 次插入9 次删除
  1. 1 1
      source/forms/CustomScpExplorer.cpp
  2. 8 7
      source/forms/InputDlg.cpp
  3. 1 1
      source/windows/WinInterface.h

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -3035,7 +3035,7 @@ void __fastcall TCustomScpExplorerForm::EditNew(TOperationSide Side)
   UnicodeString Names = Name;
   std::unique_ptr<TStrings> History(CloneStrings(CustomWinConfiguration->History[L"EditFile"]));
   if (InputDialog(LoadStr(EDIT_FILE_CAPTION), LoadStr(EDIT_FILE_PROMPT), Names,
-        HELP_EDIT_NEW, History.get(), true))
+        HELP_EDIT_NEW, History.get(), true, NULL, true, 400))
   {
     while (!Names.IsEmpty())
     {

+ 8 - 7
source/forms/InputDlg.cpp

@@ -18,7 +18,7 @@ class TInputDialog : public TCustomDialog
 public:
   __fastcall TInputDialog(
     const UnicodeString & ACaption, const UnicodeString & Prompt, const UnicodeString & HelpKeyword,
-    TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo);
+    TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo, int AWidth);
 
   bool __fastcall Execute(UnicodeString & Value);
 
@@ -35,7 +35,7 @@ private:
 //---------------------------------------------------------------------------
 __fastcall TInputDialog::TInputDialog(
   const UnicodeString & ACaption, const UnicodeString & Prompt, const UnicodeString & HelpKeyword,
-  TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo) :
+  TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo, int AWidth) :
   TCustomDialog(HelpKeyword)
 {
   Caption = ACaption;
@@ -43,9 +43,10 @@ __fastcall TInputDialog::TInputDialog(
   FOnInitialize = OnInitialize;
   FHistory = History;
 
-  ClientWidth = ScaleByTextHeight(this, 275);
+  ClientWidth = ScaleByTextHeight(this, AWidth);
 
   TLabel * Label = CreateLabel(Prompt);
+  int MaxLength = FPathInput ? 0 : 255;
   if (History == NULL)
   {
     if (Echo)
@@ -58,14 +59,14 @@ __fastcall TInputDialog::TInputDialog(
     }
     HistoryCombo = NULL;
     AddEditLikeControl(Edit, Label);
-    reinterpret_cast<TEdit *>(Edit)->MaxLength = 255;
+    reinterpret_cast<TEdit *>(Edit)->MaxLength = MaxLength;
   }
   else
   {
     DebugAssert(Echo);
     HistoryCombo = new THistoryComboBox(this);
     AddEditLikeControl(HistoryCombo, Label);
-    HistoryCombo->MaxLength = 255;
+    HistoryCombo->MaxLength = MaxLength;
     HistoryCombo->AutoComplete = false;
     Edit = NULL;
   }
@@ -130,9 +131,9 @@ bool __fastcall TInputDialog::Execute(UnicodeString & Value)
 //---------------------------------------------------------------------------
 bool __fastcall InputDialog(const UnicodeString ACaption,
   const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword,
-  TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo)
+  TStrings * History, bool PathInput, TInputDialogInitialize OnInitialize, bool Echo, int Width)
 {
-  std::unique_ptr<TInputDialog> Dialog(new TInputDialog(ACaption, APrompt, HelpKeyword, History, PathInput, OnInitialize, Echo));
+  std::unique_ptr<TInputDialog> Dialog(new TInputDialog(ACaption, APrompt, HelpKeyword, History, PathInput, OnInitialize, Echo, Width));
   return Dialog->Execute(Value);
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/windows/WinInterface.h

@@ -179,7 +179,7 @@ typedef void __fastcall (__closure *TInputDialogInitialize)
 bool __fastcall InputDialog(const UnicodeString ACaption,
   const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword = HELP_NONE,
   TStrings * History = NULL, bool PathInput = false,
-  TInputDialogInitialize OnInitialize = NULL, bool Echo = true);
+  TInputDialogInitialize OnInitialize = NULL, bool Echo = true, int Width = 275);
 
 // forms\About.cpp
 struct TRegistration