GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 16b5b083 authored by Kai Willadsen's avatar Kai Willadsen

filediff: Use property binding instead of signals for overwrite mode

This is a whole lot cleaner and also feels more... normal.
parent 36f30a6d
......@@ -157,12 +157,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self._keymask = 0
self.meta = {}
self.lines_removed = 0
self.textview_overwrite = 0
self.focus_pane = None
self.textview_overwrite_handlers = [
t.connect("toggle-overwrite", self.on_textview_toggle_overwrite)
for t in self.textview
self.textbuffer = [v.get_buffer() for v in self.textview]
self.buffer_texts = [
meldbuffer.BufferLines(b) for b in self.textbuffer]
......@@ -207,6 +202,14 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
for t in self.textview:
t.connect("focus-in-event", self.on_current_diff_changed)
t.connect("focus-out-event", self.on_current_diff_changed)
# Bind all overwrite properties together, so that toggling
# overwrite mode is per-FileDiff.
for t in self.textview[1:]:
'overwrite', self.textview[0], 'overwrite',
self.linediffer.connect("diffs-changed", self.on_diffs_changed)
self.undosequence.connect("checkpointed", self.on_undo_checkpointed)
self.connect("next-conflict-changed", self.on_next_conflict_changed)
......@@ -974,18 +977,6 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
return True
return False
def on_textview_toggle_overwrite(self, view):
self.textview_overwrite = not self.textview_overwrite
for v, h in zip(self.textview, self.textview_overwrite_handlers):
if v != view:
self.textview_overwrite_handlers = [
t.connect("toggle-overwrite", self.on_textview_toggle_overwrite)
for t in self.textview
self.on_cursor_position_changed(view.get_buffer(), None, True)
def set_labels(self, labels):
labels = labels[:self.num_panes]
for label, buf in zip(labels, self.textbuffer):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment