[meld] filediff: Reestablish focus on comparison refresh (bgo#784436)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] filediff: Reestablish focus on comparison refresh (bgo#784436)
- Date: Sun, 16 Jul 2017 01:44:07 +0000 (UTC)
commit 5640a5b3845e249c832f58604eadfc1b6f692a7c
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jul 16 11:37:34 2017 +1000
filediff: Reestablish focus on comparison refresh (bgo#784436)
The way that comparison refresh disables and reenables textview
sensitivity and handlers, it destroys pane focus and stops us from
updating our cursor data (e.g., what are the next and previous chunks).
This can lead to a situation where our comparison results have changed,
but we haven't updated our cursor details. Because next/previous actions
(among others) don't need a currently focused pane, these will try to
run with stale data and break.
The fix here, while it seems odd, is to refocus the last focused pane
(if there is one) on comparison refresh. The focus change causes the
cursor structure to re-update, and the cursor data used by actions is no
longer stale.
meld/filediff.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index 81999d2..9cf02c4 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1118,6 +1118,10 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
self._connect_buffer_handlers()
self._set_merge_action_sensitivity()
+ # Changing textview sensitivity destroys focus; we reestablish it here
+ if self.cursor.pane is not None:
+ self.textview[self.cursor.pane].grab_focus()
+
langs = [LanguageManager.get_language_from_file(buf.data.gfile)
for buf in self.textbuffer[:self.num_panes]]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]