GNOME Bugzilla – Bug 349453
File->Revert resets view to beginning of document instead of keeping line position
Last modified: 2020-11-24 10:00:56 UTC
Please describe the problem: File->Revert sets the line number to the one saved in the metadata. This line number is visible in the status bar, but the text display is actually at the top of the file. Entering something in the text makes the window scroll down to the saved line position in the metadata. Steps to reproduce: 1. Load a file 2. Set the cursor near the end of the document 3. File->Revert Actual results: The file is displayed from the beginning, but the cursor is in the saved metadata position. Expected results: The cursor should be on the same line it was before the revert, and the text display should have this line in the center. Does this happen every time? Yes. Other information: A patch is coming :-)
Created attachment 69986 [details] [review] Restore the correct line number and update the display I'm not sure about the '+ 1' and the interaction with the 'line_pos - 1' in gedit-2.14.3/gedit/gedit-document.c:966
(I haven't looked at the patch yet) Is this really the expected behavior? If you revert, usually the file on disk is different from the one currently in the buffer: does moving to the same line make sense?
My use case is the following: o I work on a file with gedit o at the same time I make a small modification to the file with another tool (indent, nano, svn up, ...) o I want this modification to be visible in gedit, so I revert the file. I'd like the scrollbar in gedit to stay at the same position it was before the revert. Of course, as the file changed, it may not be the same exact position. But that doesn't matter, it's roughly at the place I was before. Another point: that the behaviour of [x]emacs' revert-buffer :-) And considering that gedit remembers the edit position across a close/open in ~/.gnome2/gedit-metadata.xml I think it should also remember it across a revert.
Another vote for this one. Resetting the cursor position gets tedious when viewing and reloading logfiles with gedit.
In 3.2: The file is displayed from the beginning, and the cursor is also set to first line, first character.
Still a problem with gedit 3.14.
Mass-closing of all gedit bugzilla tickets. Special "code" to find again all those gedit bugzilla tickets that were open before the mass-closing: 2bfe1b0590a78457e1f1a6a90fb975f5878cb60064ccfe1d7db76ca0da52f0f3 By searching the above sha256sum in bugzilla, the gedit contributors can find again the tickets. We may be interested to do so when we work on a specific area of the code, to at least know the known problems and possible enhancements. We do this mass-closing because bugzilla.gnome.org is being replaced by gitlab.gnome.org.