Reported by @joshdbe in #458 after testing the new Open/Save Query.
A query session has no idea whether it has been edited. You can open a .sql, change it, close the tab or the app, and lose the edit without being asked. Nothing anywhere warns you.
Two symptoms, one missing piece:
- No prompt on close. Closing a modified tab, or the window, discards the edit silently. Wanted: Save / Don't Save / Cancel, and Cancel actually cancels the close.
- No modified marker. Josh asked for the VS Code treatment — the tab's
× becomes a filled dot while there are unsaved changes, and goes back to × on hover so you can still close it.
What's there now
QuerySessionControl gained SourceFilePath in #459 but tracks nothing about content. The dirty flag is the whole feature; both symptoms are consumers of it.
- Compare
QueryEditor.Text against the text as of the last load or save, rather than a bare "was edited" bool — retyping something back to how it started should not leave the tab marked.
- A never-saved scratch tab with content typed into it is also dirty, and its prompt has to go through Save As, not save-in-place.
- The tab header is
StackPanel { headerText, closeBtn } in MainWindow.Tabs.cs, so the marker is a swap of closeBtn content plus a pointer-over trigger.
Window.Closing needs to walk every tab, not just the active one, and cancel the close if anyone picks Cancel.
Plan tabs are read-only and are not part of this.
Reported by @joshdbe in #458 after testing the new Open/Save Query.
A query session has no idea whether it has been edited. You can open a
.sql, change it, close the tab or the app, and lose the edit without being asked. Nothing anywhere warns you.Two symptoms, one missing piece:
×becomes a filled dot while there are unsaved changes, and goes back to×on hover so you can still close it.What's there now
QuerySessionControlgainedSourceFilePathin #459 but tracks nothing about content. The dirty flag is the whole feature; both symptoms are consumers of it.QueryEditor.Textagainst the text as of the last load or save, rather than a bare "was edited" bool — retyping something back to how it started should not leave the tab marked.StackPanel { headerText, closeBtn }inMainWindow.Tabs.cs, so the marker is a swap ofcloseBtncontent plus a pointer-over trigger.Window.Closingneeds to walk every tab, not just the active one, and cancel the close if anyone picks Cancel.Plan tabs are read-only and are not part of this.