修訂 | 037818ded446dcc2cfd4288335fcb9fe5f893d84 (tree) |
---|---|
時間 | 2015-10-08 11:52:44 |
作者 | Takuya Nishimoto <nishimotz@gmai...> |
Commiter | Takuya Nishimoto |
Merge commit 'fetch_head' into jpbeta
@@ -182,7 +182,7 @@ class TextInfoQuickNavItem(QuickNavItem): | ||
182 | 182 | @property |
183 | 183 | def isAfterSelection(self): |
184 | 184 | caret=self.document.makeTextInfo(textInfos.POSITION_CARET) |
185 | - return self.textInfo.compareEndPoints(caret, "startToStart") <= 0 | |
185 | + return self.textInfo.compareEndPoints(caret, "startToStart") > 0 | |
186 | 186 | |
187 | 187 | class BrowseModeTreeInterceptor(treeInterceptorHandler.TreeInterceptor): |
188 | 188 | scriptCategory = inputCore.SCRCAT_BROWSEMODE |
@@ -640,6 +640,7 @@ class ElementsListDialog(wx.Dialog): | ||
640 | 640 | self._initialElement = None |
641 | 641 | |
642 | 642 | parentElements = [] |
643 | + isAfterSelection=False | |
643 | 644 | for item in self.document._iterNodesByType(elType): |
644 | 645 | # Find the parent element, if any. |
645 | 646 | for parent in reversed(parentElements): |
@@ -656,14 +657,16 @@ class ElementsListDialog(wx.Dialog): | ||
656 | 657 | element=self.Element(item,parent) |
657 | 658 | self._elements.append(element) |
658 | 659 | |
659 | - if item.isAfterSelection: | |
660 | - # The element immediately preceding or overlapping the caret should be the initially selected element. | |
661 | - # This element immediately follows the caret, so we want the previous element. | |
662 | - try: | |
663 | - self._initialElement = self._elements[-1] | |
664 | - except IndexError: | |
665 | - # No previous element. | |
666 | - pass | |
660 | + if not isAfterSelection: | |
661 | + isAfterSelection=item.isAfterSelection | |
662 | + if not isAfterSelection: | |
663 | + # The element immediately preceding or overlapping the caret should be the initially selected element. | |
664 | + # Since we have not yet passed the selection, use this as the initial element. | |
665 | + try: | |
666 | + self._initialElement = self._elements[-1] | |
667 | + except IndexError: | |
668 | + # No previous element. | |
669 | + pass | |
667 | 670 | |
668 | 671 | # This could be the parent of a subsequent element, so add it to the parents stack. |
669 | 672 | parentElements.append(element) |