After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 383293 - Revert always requests confirmation, even when no unsaved changes
Revert always requests confirmation, even when no unsaved changes
Status: RESOLVED FIXED
Product: gedit
Classification: Applications
Component: general
2.16.x
Other All
: Normal normal
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2006-12-07 09:05 UTC by John Pye
Modified: 2010-05-22 16:13 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
created a patch that seems to do what was wanted (1.95 KB, patch)
2010-01-10 23:12 UTC, Zachary - mach1723
none Details | Review
cleanup of proposed patch (1.08 KB, patch)
2010-03-13 06:42 UTC, Garrett Regier
none Details | Review
Don't show the revert confirmation dialog if the tab can be closed - Fixed the typo (1.64 KB, patch)
2010-05-22 16:09 UTC, Garrett Regier
none Details | Review

Description John Pye 2006-12-07 09:05:11 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
Comment 1 Paolo Maggi 2006-12-07 17:38:40 UTC
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.
Comment 2 John Pye 2006-12-08 02:59:43 UTC
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
Comment 3 Paolo Borelli 2010-01-06 17:44:17 UTC
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
Comment 4 Zachary - mach1723 2010-01-10 23:12:19 UTC
Created attachment 151141 [details] [review]
created a patch that seems to do what was wanted
Comment 5 Garrett Regier 2010-03-13 06:42:06 UTC
Created attachment 156047 [details] [review]
cleanup of proposed patch

expanded comment and keep style
Comment 6 Paolo Borelli 2010-03-13 17:23:40 UTC
isn't it the opposite? if it can close, it can be reverted without asking...
Comment 7 Garrett Regier 2010-05-22 16:09:42 UTC
Created attachment 161726 [details] [review]
Don't show the revert confirmation dialog if the tab can be closed - Fixed the typo
Comment 8 Garrett Regier 2010-05-22 16:13:06 UTC
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.