nengo / nengo-gui

Nengo interactive visualizer
Other
97 stars 38 forks source link

Accidentally deleting and saving the model in GUI #904

Open ikajic opened 7 years ago

ikajic commented 7 years ago

After seeing someone else encounter a situation that happens to me sometimes, I decided to open this "issue" to discuss how much of an issue this actually is, and whether it is worth doing some actions in this direction. The problematic situation is the following: an unfortunate keystroke combination deletes the code in GUI, and then saves it. This is rare but can happen when being sloppy with ctrl+s.

In the ideal world, this shouldn't be a big deal because a) the file should be tracked by git b) the editor should store some kind of a backup. But, users who are new to Nengo GUI and are using git/git shell for the first time are more likely to have some initial learning troubles with git (and therefore not use it) and their editors might not make backups, which can lead to :cry:

So, I would describe a feature that helps with this more of a "courtesy" feature to new users. I am not sure what would be the best solution for the problem (can think of several things: e.g, prompting a user and asking "Are you sure you want to save an empty file?" or creating backups), but I just wanted to throw this idea out...

jgosmann commented 7 years ago

Do I understand correctly that the issue here is that Ctrl+D deletes the current line or selected text and because D is close to S on most keyboard layout it can accidentally be hit when trying to save the file?

Seems like the easiest solution would be to disable the Ctrl+D shortcut if possible (and hope that no one complains wanting to use this particular shortcut).

Along similar lines: My v key is where on most keyboard layouts is w. This has the effect that I sometimes close the tab when I intend to paste stuff (pressing what would be Ctrl+V on my keyboard, but happens to be Ctrl+W on some other persons keyboard that I am helping). Many websites with forms will warn you when trying to close the tab with unsaved changes. It would be great if we could do the same.

ikajic commented 7 years ago

Do I understand correctly that the issue here is that Ctrl+D deletes the current line or selected text and because D is close to S on most keyboard layout it can accidentally be hit when trying to save the file?

Yeah, that is one possible scenario. I think the most code I "lost" was when copy-pasting stuff to/from Nengo GUI and then (somehow) press something else before ctrl+s while still having selected all of my code. But I'm sure there other ways to screw things up :)

Many websites with forms will warn you when trying to close the tab with unsaved changes. It would be great if we could do the same.

:+1:

jgosmann commented 7 years ago

Does undo work in those situations?

ikajic commented 7 years ago

Yup, it usually does. Unless the GUI closes/crashes...

On 13 June 2017 at 16:29, Jan Gosmann notifications@github.com wrote:

Does undo work in those situations?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nengo/nengo_gui/issues/904#issuecomment-308238871, or mute the thread https://github.com/notifications/unsubscribe-auth/ACXtpkq5ba7sxsIA683DqSzJrr1__Gscks5sDvEfgaJpZM4N4-OY .

celiasmith commented 7 years ago

Agreed. In general file saving, etc features need some thinking. Maybe moving to the "constantly save the file" kind of model would help? Anyway mostly just a +1 to this suggestion.

On June 13, 2017 3:31:53 PM EDT, "Ivana Kajić" notifications@github.com wrote:

After seeing someone else encounter a situation that happens to me sometimes, I decided to open this "issue" to discuss how much of an issue this actually is, and whether it is worth doing some actions in this direction. The problematic situation is the following: an unfortunate keystroke combination deletes the code in GUI, and then saves it. This is rare but can happen when being sloppy with ctrl+s.

In the ideal world, this shouldn't be a big deal because a) the file should be tracked by git b) the editor should store some kind of a backup. But, users who are new to Nengo GUI and are using git/git shell for the first time are more likely to have some initial learning troubles with git (and therefore not use it) and their editors might not make backups, which can lead to 😢

So, I would describe a feature that helps with this more of a "courtesy" feature to new users. I am not sure what would be the best solution for the problem (can think of several things: e.g, prompting a user and asking "Are you sure you want to save an empty file?" or creating backups), but I just wanted to throw this idea out...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/nengo/nengo_gui/issues/904, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AB5JUwbPPej5LY_n8W521zz5BTqUXFN4ks5sDuOpgaJpZM4N4-OY.