Skip to content

Commit eb1fa18

Browse files
committed
Fix save / save as dialog possible issue
1 parent ec966c1 commit eb1fa18

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Flow.Launcher.Infrastructure/QuickSwitch/Models/WindowsDialog.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public bool JumpFolder(string path, bool auto)
132132
{
133133
// Use legacy jump folder method for auto quick switch because file editor is default value.
134134
// After setting path using file editor, we do not need to revert its value.
135-
return JumpFolderWithFileEditor(path);
135+
return JumpFolderWithFileEditor(path, false);
136136
}
137137

138138
// Alt-D or Ctrl-L to focus on the path input box
@@ -145,7 +145,7 @@ public bool JumpFolder(string path, bool auto)
145145
// https://github.com/idkidknow/Flow.Launcher.Plugin.DirQuickJump/issues/1
146146
// The dialog is a legacy one, so we can only edit file editor directly.
147147
Log.Debug(ClassName, "Legacy dialog, using legacy jump folder method");
148-
return JumpFolderWithFileEditor(path);
148+
return JumpFolderWithFileEditor(path, true);
149149
}
150150

151151
var timeOut = !SpinWait.SpinUntil(() =>
@@ -157,14 +157,14 @@ public bool JumpFolder(string path, bool auto)
157157
{
158158
// Path control is not visible, so we can only edit file editor directly.
159159
Log.Debug(ClassName, "Path control is not visible, using legacy jump folder method");
160-
return JumpFolderWithFileEditor(path);
160+
return JumpFolderWithFileEditor(path, true);
161161
}
162162

163163
if (_pathEditor.IsNull && !GetPathControlEditor())
164164
{
165165
// Path editor cannot be found, so we can only edit file editor directly.
166166
Log.Debug(ClassName, "Path editor cannot be found, using legacy jump folder method");
167-
return JumpFolderWithFileEditor(path);
167+
return JumpFolderWithFileEditor(path, true);
168168
}
169169
SetWindowText(_pathEditor, path);
170170

@@ -306,8 +306,11 @@ private static unsafe nint SetWindowText(HWND handle, string text)
306306

307307
#region Legacy Jump Folder
308308

309-
private bool JumpFolderWithFileEditor(string path)
309+
private bool JumpFolderWithFileEditor(string path, bool resetFocus)
310310
{
311+
// For Save / Save As dialog, the default value in file editor is not null and it can cause strange behaviors.
312+
if (resetFocus && _type == DialogType.SaveOrSaveAs) return false;
313+
311314
if (_fileEditor.IsNull && !GetFileEditor()) return false;
312315
SetWindowText(_fileEditor, path);
313316

0 commit comments

Comments
 (0)