Skip to content

Commit d9bfa39

Browse files
committed
Disable push to read-only panes for two panes merge.
There is a difference between "left pane" and "pane to the left". For `editable_left` `meld` means the latter. See @kaiw comment https://gitlab.gnome.org/GNOME/meld/-/merge_requests/2#note_886994 For example. editable_left `False` for the **left** pane 0, because there is no pane to the left of it. pane 0 editable_left/right: FalseTrue editable0/1: TrueTrue pane 1 editable_left/right: TrueFalse editable0/1: TrueTrue
1 parent d3feba5 commit d9bfa39

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

meld/filediff.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,8 @@ def on_current_diff_changed(self, *args):
657657
# conditions for push are met, *and* there is some content in the
658658
# target pane.
659659
editable = self.textview[pane].get_editable()
660+
# editable_left is relative to current pane and it is False for the
661+
# leftmost frame. The same logic applies to editable_right.
660662
editable_left = pane > 0 and self.textview[pane - 1].get_editable()
661663
editable_right = (
662664
pane < self.num_panes - 1 and
@@ -693,8 +695,10 @@ def on_current_diff_changed(self, *args):
693695

694696
# If there is chunk and there are only two panes (#25)
695697
if self.num_panes == 2:
696-
push_right = True
697-
push_left = True
698+
pane0_editable = self.textview[0].get_editable()
699+
pane1_editable = self.textview[1].get_editable()
700+
push_left = pane0_editable
701+
push_right = pane1_editable
698702

699703
self.set_action_enabled('file-push-left', push_left)
700704
self.set_action_enabled('file-push-right', push_right)

0 commit comments

Comments
 (0)