[PATCH stable] repoview: forcibly clear selection on goto(rev) (fixes #1673)

2 views
Skip to first unread message

Yuya Nishihara

unread,
Mar 4, 2012, 9:54:36 AM3/4/12
to thg...@googlegroups.com
# HG changeset patch
# User Yuya Nishihara <yu...@tcha.org>
# Date 1330872829 -32400
# Branch stable
# Node ID ce7096d0facc065e1486388fc822ac0ecbd2bbbb
# Parent bbbcf272bf584d441f5f708b5bca2240680e342f
repoview: forcibly clear selection on goto(rev) (fixes #1673)

It looks view.setCurrentIndex() is Ctrl-key-aware.

Note that even with this change, we cannot get rid of 46296c315034.
It happens *after* invocation of goto().

diff --git a/tortoisehg/hgqt/repoview.py b/tortoisehg/hgqt/repoview.py
--- a/tortoisehg/hgqt/repoview.py
+++ b/tortoisehg/hgqt/repoview.py
@@ -281,7 +281,9 @@ class HgRepoView(QTableView):
if idx is not None:
# avoid unwanted selection change (#1019)
if self.currentIndex().row() != idx.row():
- self.setCurrentIndex(idx)
+ flags = (QItemSelectionModel.ClearAndSelect
+ | QItemSelectionModel.Rows)
+ self.selectionModel().setCurrentIndex(idx, flags)
self.scrollTo(idx)

def saveSettings(self, s = None):

Johan Samyn

unread,
Mar 4, 2012, 10:03:55 AM3/4/12
to thg...@googlegroups.com, Yuya Nishihara

Yuya,
Looks like we send in a patch for this both at the same time :-) .
I suspect yours is more genericly applicable then only for the Ctrl-P case ?
Johan

--
___________________________________________________________________
"Perfection is achieved, not when there is nothing more to add,
but when there is nothing left to take away." - A. de Saint-Exup�ry

Yuya Nishihara

unread,
Mar 4, 2012, 11:44:11 AM3/4/12
to Johan Samyn, thg...@googlegroups.com
2012/3/5 Johan Samyn <johan...@gmail.com>
On 04-03-2012 17:20, Yuya Nishihara wrote:
2012/3/5 Johan Samyn <johan...@gmail.com>
I believe it's unintended behavior that "Ctrl+goto(rev)" selects multiple rows.
This patch affects any Ctrl+goto(rev) cases including Ctrl+P.
Oops, I forgot to send the previous message to the list. (so CC-ing) 

Yes, I fully agree your solution is better than mine.

Thanks,
I'll push this change to stable.

Regards,
Reply all
Reply to author
Forward
0 new messages