[meld] filediff: Set buffers as modified when using custom save path (#581)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Set buffers as modified when using custom save path (#581)
- Date: Sat, 8 Jan 2022 04:09:26 +0000 (UTC)
commit 603b13aba66f9b1e014b687bc73d5c14095f982d
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Jan 8 13:57:40 2022 +1000
filediff: Set buffers as modified when using custom save path (#581)
This change is about improving conflict resolution, which is envisaged
as the primary use case for the `--output` flag. The point here is that
if when you use the "save this buffer to a different place than where
you loaded it from" functionality, it's reasonable to expect that the
buffer is going to need to be saved in order for the buffer contents to
end up on disk.
This will change some workflows slightly, in that if you open up a
conflict from Meld's version control view but make no changes, you'll
now be prompted to save the file... but this seems like an acceptable
trade-off.
meld/filediff.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 38420618..436fabf8 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1604,9 +1604,17 @@ class FileDiff(Gtk.VBox, MeldDoc):
'dialog-warning-symbolic', primary, secondary, _("Open"),
functools.partial(open_files_external, gfiles=[gfile]))
+ # We checkpoint first, which will set modified state via the
+ # checkpointed callback. We then check whether we're saving the
+ # file to a different location than it was loaded from, in
+ # which case we assume that this needs to be saved to persist
+ # what the user is seeing. Finally, we update the writability,
+ # which does label calculation.
+ self.undosequence.checkpoint(buf)
+ if buf.data.savefile:
+ buf.set_modified(True)
self.update_buffer_writable(buf)
- self.undosequence.checkpoint(buf)
buf.data.update_mtime()
buf.data.loaded = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]