GNOME Bugzilla – Bug 383293
Revert always requests confirmation, even when no unsaved changes
Last modified: 2010-05-22 16:13:06 UTC
Please describe the problem: Revert always requests confirmation, even when no unsaved changes. Steps to reproduce: 1. In gedit, open some file. Don't make any changes 2. In another program, make changes to that file and save them 3. In gedit, activate the 'revert' item in the File menu. Actual results: gedit requests confirmation before allowing you to 'revert' (in other words reload) the file (even though there are not unsaved changed held by gedit) Expected results: I would not have expected gedit to request confirmation in this case. Does this happen every time? Yes (by design, I guess) Other information: Perhaps this is considered desirable behaviour. The use case here for me is that I have a text file open that is an output from a program that I'm working on. I frequently re-run my program and want to get an updated view of the output. Ideally I could just hit a single key for the file to be re-loaded in gedit, but it seems that's currently not possible. Thanks! JP
I think revert should always request a confirmation to avoid losing changes you made in gedit but accidentally overwrote using another program. Your problem will be solved thanks to another feature we are working on, see bug #371188.
Hi Paolo My feeling is that gedit should only ask confirmation if there are local changes made *by the user typing into the document in gedit*. If no changes have been made to the file in gedit, then it should not require confirmation (even if the file on disk is different from the copy in memory). The time when gedit should ask confirmation is when gedit itself has been actively used to modify a file. The changes described in bug #371188 will be good for ensuring that one does not edit an out-of-date file. But I am concerned that the prompt ("this file has changed... reload?") would tend to need to block the user (they shouldn't be allow to continue editing until they answer the question). So there might be cases where this could be annoying, for example if you are trying to cut and paste some stuff out of a fast-changing log file. Another use-case that might cause problems with bug #371188 would be the case of using gedit to view the source of a webpage. For example, gedit http://bugzilla.gnome.org/show_bug.cgi?id=383293 In this case I can't see how the file change notification could work (will gedit ping the webserver every few seconds?) so the 'file...revert' thing would still be needed. And in the case where no changes have been made, there should be no request for confirmation. So I changed the bug to 'reopened', as I think these might be use-cases that go beyond what you've mentioned. Hope that's ok -- I'd be keen to hear your further thoughts. I'll annotate that other bug with a link here also. Cheers JP
These days gedit shows a notice if the file has been modified externally and "revert" already special cases for that. So I think we can drop the confirmation request if the doc has no modifications. If anyone wants to make a patch it should be fairly easy, code is in _gedit_cmd_file_revert function in gedit-commands-file.c
Created attachment 151141 [details] [review] created a patch that seems to do what was wanted
Created attachment 156047 [details] [review] cleanup of proposed patch expanded comment and keep style
isn't it the opposite? if it can close, it can be reverted without asking...
Created attachment 161726 [details] [review] Don't show the revert confirmation dialog if the tab can be closed - Fixed the typo
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.