From 4a976c89260bde2d58d502d43922c1334cc1c6e2 Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Mon, 6 Jun 2011 12:03:10 +1000 Subject: [PATCH] Fix for #1455 (Hyphenated words reported incorrectly in standard Windows Edit controls). for now just revert changeset:main,4148 as although this was correct for XP edit controls with out uniscribe support, it was incorrect for all later Operating systems and most likely xP with unicscribe support (east asian language pack installed). An alternative way this could be implemented in the future is to first detect whether uniscribe is being used (not sure how), and if it is, then use ScriptItemize / ScriptBreak to generate an array of script logic attribute structures, and check for which characters allow word stop on. We could also consider using this inside offsetstextInfo at a low level so that virtualBuffers can make use of better word navigation. --- source/NVDAObjects/window/edit.py | 47 +++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/source/NVDAObjects/window/edit.py b/source/NVDAObjects/window/edit.py index 1392aff13..8393cc155 100644 --- a/source/NVDAObjects/window/edit.py +++ b/source/NVDAObjects/window/edit.py @@ -353,30 +353,29 @@ class EditTextInfo(textInfos.offsets.OffsetsTextInfo): start=end end=winUser.sendMessage(self.obj.windowHandle,EM_FINDWORDBREAK,WB_MOVEWORDRIGHT,offset) return (start,end) - else: #Implementation of standard edit field wordbreak behaviour (only breaks on space) - text=self.obj.windowText - textLength=len(text) - if offset>=textLength: - return offset,offset+1 - #cariage returns are always treeted as a word by themselves - if text[offset]=='\r': - return offset,offset+1 - #Find the start of the word (possibly moving through space to get to the word first) - tempOffset=offset - while offset>=0 and text[tempOffset].isspace(): - tempOffset-=1 - while tempOffset>=0 and not text[tempOffset].isspace(): - tempOffset-=1 - start=tempOffset+1 - #Find the end of the word and trailing space - tempOffset=offset - textLen=len(text) - while tempOffset=(self._getStoryLength()-1): + return [offset,offset+1] + oldSel=self._getSelectionOffsets() + self._setSelectionOffsets(offset,offset) + KeyboardInputGesture.fromName("control+leftArrow").send() + back=self._getSelectionOffsets()[0] + KeyboardInputGesture.fromName("control+rightArrow").send() + forward=self._getSelectionOffsets()[0] + if (back<=offset) and (forward>offset): + start=back + end=forward + elif (back=1: -- 2.11.0