First tab closing without warning when double-clicking

kthanid posted 6 years ago in General
When double-clicking on whatever the first query tab is (whether that's an open file or otherwise) seems to irrevocably close that tab and replace it with a fresh query tab.

The same behavior in any tab past the first results correctly in a warning about unsaved changes (if any) rather than closing outright.

This is somewhat problematic since it is inconsistent behavior between tabs and makes it a little too easy to accidentally lose unsaved work.

Is there any known setting that addresses this behavior? Thanks.
ansgar posted 6 years ago
Ever heard of "Undo" / Ctrl+Z ?
kthanid posted 6 years ago
While I'd love to reply to your comment with a similarly curt and rhetorical response, let me instead just simply state: Thank you for the functioning workaround.

Yes, I've heard of "Undo", however I do not feel that using "Undo" is a particularly intuitive response to accidentally closing a file without saving your work (yes, having tested it just now it does seem to work - assuming you click back into the Query editor window first) as I cannot think of another widely used application where such undo behavior (recovering a lost file) would be an expected result of pressing Ctrl-Z.

To be clear, I hadn't thought to try and "undo" a lost file, nor would I expect doing so to be an intuitive response from most end users.

Additionally, this still does not address the underlying concern that the behavior between tabs is inconsistent. Double-clicking on any tab other than the first results in a warning if unsaved work is present (and no warning if all work is saved). Users typically expect similar aspects of a piece of software to function consistently (meaning if they hadn't noticed the little asterisk indicating unsaved work and were quickly closing tabs, they may assume that all work was saved when they have closed all tabs, which may not be the case if modified work exists on the first tab).

TL;DR - Tabs should behave consistently. I appreciate your help with a functioning workaround, I still believe the issue is worth noting and addressing.
ansgar posted 6 years ago
Sorry for being a bit short, I'm good at giving hints to some obvious thing.

Think you're right - the other tabs warn you about closing a file per doubleclick, while the first tab does not - only it does not close, and that's the reason why it does not warn. I can probably check that. On the other side, why not use Ctrl+Z here - the undo-history is not reset as long as you close the whole application.
kthanid posted 6 years ago
Thanks for the reply, and my apologies if my own reply seemed a bit abrasive (I didn't exactly mean to come off that way, and realized after posting that your suggestion may have been more of a polite nudge in the right direction rather than a snide rhetorical remark)...

I'm not sure I understand entirely what you mean when you say it does not "close" (but I've only been using HeidiSQL for a very short time so far, like a few hours), but at least visually it appears to (I'm assuming you mean it doesn't actually close in the technical sense).

As a quick example if it helps clarify what I mean, if I open HeidiSQL via double-clicking on a SQL file on my desktop, let's call it "test.sql", if I then make some changes and for whatever reason double-click on the "test.sql" tab (since it's the only tab) I'm left looking at a blank query window titled "Query" (which gives the appearance of my sql file having "closed").

I will certainly use undo for now (and I'm glad to have been informed of the ability to do so). Thank you very much for your help.

I also feel it worth noting that I ran into HeidiSQL while looking for a solid alternative to MySQL Workbench/Query Browser (the former being an application I've grown to mostly despise, the latter being functional but obviously a bit out of date and with annoying functionality I'd rather avoid).

Between the alternatives I've tried so far, HedidSQL is my preferred choice. Receiving such a quick response here further solidifies my feeling that this is probably an application I want to spend some time getting to know.

Thanks again for your help.
lieszkol posted 2 years ago

I'd like to "upvote" this issue :-)

HeidiSQL is a great tool but little quirks like this make using it somewhat frustrating. Like kthanid wrote, ideally HeidiSQL should ask to save changes to an open file when it is closed whether it is the first tab or not. Better yet, it shouldn't load files into the first tab at all, even if there is nothing typed into the first tab.

In any case thank you for HeidiSQL!

yblatti posted 2 years ago

Also an "upvote" for me !!

  • First tab should behave like others when closing
  • It should also display the "cross" to close it

Bonus feature

  • Be able to move (drag/drop left/right) the tabs
pifou42 posted 2 months ago


Today, I just closed some tab (NOT the 1st) with a double click on it (expected to expand my request to full screen) It didn't ask me for any confirm, so I'll have to rewrite all the unsaved modifications


I checked back my options, and didn't see anything I might have modified.
Oh, and btw, Ctrl-Z didn't help at all.

After some more testing, it seems ctrl-Z doesn't do anything outside of the current tab, no mater whether I close the first tab or another.

Using Portable version of this great tool.

pifou42 posted 2 months ago

Seems I can't edit my post, so I'll complete with another instead

• After double checking, it turns out the confirmation for closing tabs in the 'SQL' options was indeed disabled

• BUT, this doesn't explain me why ctrl-z doesn't help, which is what matters to me (we tend to confirm things a bit too fast anyway, so I think reverting mistakes is the olny true solution in such cases)

ansgar posted 2 months ago

Ctrl+Z should work on every tab, as well as on the first one. At least it works for me. Can you reproduce that?

pifou42 posted 2 months ago

Yeah, can reproduce as much as I want, just tested it again. I event re-extracted my version in case the keybindings I tried to change could have had any impact.

I've uploaded the exact archive I used to my FTP, so you can check it out : fr/

Hope you'll reproduce as well.

ansgar posted 2 months ago

You should again test with the current nightly build, but at least with the latest release (9.5)

pifou42 posted 2 months ago

No surprise, same result with portable (32 bit, 2017-12-19 15:45:53)

Yet, I just noticed something weird, an error when starting : /* Error with snippets directory: The specified path was not found */

I used to try customizing some shortcuts (essentially replacing ctrl-Y's bind to redo instead of clearing a line), but

  • It was on another version (I use portable ones, so I assume the config shouldn't be shared among them)
  • I reverted keybindings to defaults

Could a paramater effectively be shared among versions ? And could reverted parameters still create such an issue (e.g. leaving an empty custom directory which creates an error ?) Note that ctrl-Z/ctrl-shift-Z work normally for editing in the queries tabs (e.g. cancelling or redoing inputs). So do alt-[shift]-backspace

Is there a particular place I should focus for it to work ? Or any possible conflict ? I mean, I wondered how is this ctrl-Z supposed to be correctly interpreted, since closing a tab leaves your cursor in the previous tab (or in the brand-new first tab in case you closed the first). I'd intuitively think a ctrl-Z here would undo in the editor, not in the broader scope of tabs. Guess this last idea is completely wrong , but I'm just looking in every possible direction :)

ansgar posted 2 months ago

All settings including customized hotkeys go into the portable_settings.txt file when you quit a portable version of HeidiSQL.

Probably a good way to verify if it's some broken setting is to

  • make a backup of portable_settings.txt
  • make the portable_settings.txt entirely empty
  • start HeidiSQL and watch out for the hotkey

This way you definitely have all options set to default.

pifou42 posted 2 months ago

I just noticed an important point : after double-clicking on a tab, you are focused on the tab bar... where ctrl-Z has no effect, anyway. So, you first have to focus the SQL editor panel again for ctrl-Z to have any effect. This might seem "obvious", but I didn't notice it before. I guess the grayed-out "undo" icon in the menubar (since you're not focused on the editor at that time) renforces this confusion.

Still, it only did make a difference when I killed the first tab, for any other, the content is just lost.

About portable_settings.txt, nothing new here, but thanks for the provided details.

Here is the exact console output I get when I launch the application :

/* Error with snippets directory: The specified path was not found */
/* Delimiter changed to ; */
/* Connecting to via MySQL (TCP/IP), username root, using password: No ... */
/* Connected. Thread-ID: 1786 */
/* Characterset: utf8mb4 */
/* Entering session "Local" */

What else could I add... I run without admin rights, and switched in English to get original English messages (default falls to French). If you have no clues, I can live with this, of course. I'm essentially trying to help fix (or more exactly, find which precise case breaks something which seems to work for the others).

Does it work differently with the same portable version on your side ?

ansgar posted 2 months ago

I guess there is no issue, if Ctrl-Z works when the editor is focused, right?

pifou42 posted 2 months ago

Probably. I thought my first post was clear enough, but my misunderstanding complicated the investigation. Sorry for that.

Let me reformulate a part of my initial post :

Closing some tab (NOT the 1st) with a double click loses all unsaved modifications :(

As long as it's the intended behaviour, I guess there's no bug, indeed.

But, making the action undoable would be great, of course.

Also, this is an inconsistency between the first and other tabs, right ?

If you don't plan adding this "undo" feature to the other tabs, I have two suggestions to somehow solve the issue I encountered :

  • (1) In case the "Warn before closing tabs" feature is disabled, add a global confirm "Are you sure you want to close all your tabs at once ?", like Firefox does.

    The reason I disabled this warning is because I often close multiple tabs at once, and don't need to save any request. Having to confirm once for each of the 3 or 10 tabs everytime quickly becomes annoying

  • (2) Add a confirm (with a "don't bother me again" pre-checked checkbox) when (first) double clicking on a tab to close it.

Anyway, I guess those should be addressed in new issues/threads. I'll let you choose whether one (or both) of those additions seem worth implementing to you.

Thanks for your attention.

Please login to leave a reply, or register at first.