New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closing first Query tab never warns of unsaved changes. #231

Closed
yphastos opened this Issue Apr 17, 2018 · 16 comments

Comments

Projects
None yet
4 participants
@yphastos

yphastos commented Apr 17, 2018

Steps to reproduce this issue

  1. Write any content on the first Query tab (always labeled 'Query')
  2. Close the tab by either double clicking it, or by closing HeidiSQL. Note that for some reason, that first Query tab doesn't have a close button, neither right clicking it shows the 'Close query tab' option (is grayed out). But it can be closed by double clicking or closing Heidi.
  3. Despite the tab not being saved (and showing pending changes with a '*' in the tab's title ('Query*'), the application doesn't warn that there is unsaved changes, and closes it regardless.

Current behavior

The tab closes without any warning of unsaved content.

Expected behavior

Attempting to close the tab should warn of unsaved changes and prompt if user wants to save content.

Possible solution

Validate unsaved changes as any other tab,.

Environment

  • HeidiSQL version: 9.5.0.5273
  • Database system and version: MySQL 5.1.73
  • Operating system: MacOS using wine. Also happens in windows
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 17, 2018

You probably just disabled the prompt for it, in Preferences > SQL:

grafik

@yphastos

This comment has been minimized.

yphastos commented Apr 17, 2018

NO! the option IS active, and it DOES work for every other tab.

But it does NOT work in THE FIRST query tab (it doesn't prompt and clears the content).

I mentioned that particularity in the problem description. it only happens with the first tab.

Please try to replicate it, just write anything on the first Query tab, and without saving the content, double click the tab itself. It will clear the tab contents without prompting or warning anything. The tab itself never closes, but the content does disappear.

Please reopen the issue since it is not solved.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 18, 2018

Ah, I see now. I did reproduce that, but only by closing HeidiSQL, and then got this:
grafik
You wrote

Close the tab by either double clicking it, or by closing HeidiSQL.

I did not do that doubleclick again. And yes, it's not warning me when doubleclicking the tab. The reason for not asking on that special first tab was that it is not closable anyway (intentionally). So, after the content is gone, you can get it back via undo (Ctrl+Z).

@yphastos

This comment has been minimized.

yphastos commented Apr 18, 2018

I see,
But shouldn't it warn anyway that the contents would be cleared (despite the tab not closing itself)?

Even if we can get the content back with Ctrl+Z (which btw is quite unintuitive), i think it should always warn if the contents would be lost (or clear) for whichever tab (honoring the setting).

Or if the tab is meant to never close, it then never should clear the content by double clicking it (just as it doesn't have the 'Close query tab' item when right clicking, or not having the 'x' control to close it) That way, the only method to close the tab (and potentially lose content) would be when closing Heidi.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 18, 2018

Oh I think that's a good idea - just not remove the content. That way the doubleclick feature is clearly only for closable tabs.

@ansgarbecker ansgarbecker reopened this Apr 18, 2018

@ansgarbecker ansgarbecker added this to the v9.6 milestone Apr 18, 2018

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 18, 2018

Just committed that. Check the next nightly build.

@anselal

This comment has been minimized.

anselal commented May 11, 2018

Or it could just warn you and you can leave the double click feature as it is..

@anselal

This comment has been minimized.

anselal commented May 14, 2018

@ansgarbecker The problem is still there in the latest build 9.5.0.5287

By pressing Ctrl+W the tab just clears without any warning for modified content.

@yphastos

This comment has been minimized.

yphastos commented May 14, 2018

@anselal Wow, that's true!

I guess the behavior is that the tab attempts to close, but since it can't, it somehow doesn't warn anything but it still clears its content. (the same that happened when double-clicking it)

Maybe the tab should be allowed to close just as any other, triggering the same warnings and behaviors as the rest (having a close button, have the "close query tab" right click item, closing via double-click or Ctrl+W (as it is common in tons of programs), etc.

I don't know the reason it is not meant to close, @ansgarbecker has mentioned it is intentional, but personally I see no problem in closing it (from an end user point of view), I don't know if there are technical reasons to not close it.

But ultimately, there is always the "open a blank query tab" button in the tab bar, as well as the "open query tab - Ctrl+T" item in the File menu. So even if someone closes ALL tabs, you can always open new ones.

So I vote to treat the first tab exactly as all others, with the same behaviors and warnings, including closing it.

Greetings.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented May 14, 2018

The first tab is also sticky to help newbies. And there are other reasons. Most of the time many users just need one tab. Having to create one is an additional click.

@yphastos

This comment has been minimized.

yphastos commented May 14, 2018

IMO you could always create one initial empty one, as it is now. But allow to close it as any other tabs.

If users close it, it would be on purpose, not by accident (because attempting to close it with unsaved data will warn them), and they would need to open a new one on their own, as expected.

I think it is more intuitive that way instead of accidentally pressing Ctrl+W and losing the unsaved content (without a warning), not being aware that Ctrl+Z could restore it.

@albertdick

This comment has been minimized.

albertdick commented May 15, 2018

I think it easier to close a tab by accident in the traditional way (by clicking on the "x") than pressing CTRL+W.

@yphastos

This comment has been minimized.

yphastos commented May 16, 2018

@albertdick indeed! but its the same point. I mean you can 'accidentally' attempt to close it, without saving changes. If it was already saved, its no problem because you could simply reopen it.

If the tab is 'closeable', it will warn of unsaved changes (by any method, 'x' corner, double-click, ctrl+w, and whatever other method for closing tabs I'm unaware of).

But if it is not closable, it simply doesn't warn anything and clears the content (and keeps the tab).
THAT is the main problem.

Of course all the "close" methods could be disabled for the first tab, in this case Ctrl+W. Just as the 'x' and double click are already disabled.

But IMO its non ideal. It is not intuitive at all not being able to close every single tab. and even less that a "closing" event doesn't warn anything and just clears the content.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Aug 4, 2018

As just written in #318 - double click works in the newest nightly build again as previously ;)
With one exception: it asks for confirmation now, like when you close a tab with unsaved contents.

For modification details see my commit 42a03df

@anselal

This comment has been minimized.

anselal commented Aug 4, 2018

Those are great news. Thanks !!! Gonna try it out

@anselal

This comment has been minimized.

anselal commented Aug 4, 2018

Works like a charm !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment