Braille doesn't scroll to same-line search result in Notepad #5410

Closed
nvaccessAuto opened this Issue Oct 11, 2015 · 12 comments

3 participants

@nvaccessAuto

Reported by dkager on 2015-10-11 20:03
STR:

  • Type a line with the same phrase in it multiple times, at the start of the line and later on with enough other text inbetween.
  • Press Ctrl+F and search for the phrase.
  • Press Escape. Braille shows the selected text, i.e. the search phrase.
  • Press F3.
  • Braille does not scroll to the newly selected text, i.e. the second occurrence of the search phrase.
@nvaccessAuto

Comment 1 by dkager on 2015-10-15 19:17
I was a bit too specific, this happens in plain ol' Notepad too. Uneducated guess: maybe in EditableTextWithAutoSelectDetection.
Changes:
Changed title from "Braille doesn't scroll to same-line search result in Notepad++ (Scintilla)" to "Braille doesn't scroll to same-line search result in Notepad"

@nvaccessAuto

Comment 2 by dkager on 2015-10-18 12:01
Only happens when braille is tethered to focus. If tethered to review, the display is scrolled but instead of the selection indicator (non-blinking dots 7 & 8) you obviously only see the review cursor.

@nvaccessAuto

Comment 3 by dkager on 2015-10-18 18:31
Well, here is a trivial fix.
If there is a selection, then there is no regular cursor. Thus, the braille display is not scrolled to the cursor. To work around this at least in TextInfo regions, the display is also scrolled to the start of the selection if there is one. I hope this makes sense.

@nvaccessAuto

Comment 4 by jteh on 2015-10-21 05:07
Thanks for the patch. However, this won't quite work in all cases. TextInfoRegion._selectionStart is a text position, not a braille position, so this won't work as expected if you're using anything other than computer braille.

Also, I'd rather not have TextInfoRegion specific code there. One solution is to set brailleCursorPos and have a showCursor attribute which could be set to False for selection. However, Since some users want selection to be indicated with dots 7 and 8 for list items (#1953), I guess the best solution is to have selectionStart/End and brailleSelectionStart/End attributes in Region and have Region.update handle the underlining instead of TextInfoRegion.update. The patch for #1953 is then pretty trivial.

Let me know if you're willing to do this. Otherwise, I'll do it when I get some time.
Changes:
Milestone changed from None to 2016.1

@nvaccessAuto

Comment 5 by dkager on 2015-10-21 06:42
I can have a look but as usual cannot say exactly when. In the weekend of Nov 14th at the very latest, well in time for the milestone. It makes sense to do this in conjunction with #5198 I think, as you indicate by assigning both to 2016.1.

@nvaccessAuto

Comment 6 by dkager on 2015-10-24 18:59
I updated the branch I linked to in comment:3. It uses the new approach where braille.Region manages selectionStart/End. It also fixes another case of braille not scrolling to the selection that I overlooked earlier. Since #5198 can't be auto-merged with this I also did that, in t5410_t5198. This made testing a bit easier. The end result appears to do what it was meant to.

@jcsteh jcsteh was assigned by nvaccessAuto Nov 10, 2015
@nvaccessAuto nvaccessAuto added this to the 2016.1 milestone Nov 10, 2015
@dkager dkager added a commit to dkager/nvda that referenced this issue Nov 10, 2015
@dkager dkager Fix and refactor the patch for #5410:
* Move the marking of a selection to braille.Region.
* Add Region.brailleSelectionStart/End.
* If there is a selection but not a cursor, e.g. in a TextInfoRegion, scroll the braille display to the selection start.
d465953
@dkager

Code is now here on GitHub. I'll drop the BitBucket repo linked to in earlier comments.

@jcsteh jcsteh added a commit that referenced this issue Nov 25, 2015
@dkager dkager When using a braille display and text is selected on the current line…
… (e.g. when searching in a text editor for text which occurs on the same line), the braille display will be scrolled if appropriate.

On a pending caret move if there is no cursor, try to scroll the braille display to the selection.

* Move the marking of a selection to braille.Region.
* Add Region.brailleSelectionStart/End.
* If there is a selection but not a cursor, e.g. in a TextInfoRegion, scroll the braille display to the selection start.

Fixes #5410.
a5adfe2
@nvaccessAuto

Incubated in f53054b.

@dkager dkager added a commit to dkager/nvda that referenced this issue Nov 25, 2015
@dkager dkager Oops, I think I overlooked something in #5410. 0ca49f1
@jcsteh

Ug. I was reviewing #5198 and discovered that the selection indicator still shows when the cursor is disabled. I just realised that even with this fixed, the selection indicator doesn't appear/disappear when you toggle the option from a script, since the region isn't updated.

  • I don't want to update all buffers every time we dismiss a message.
  • I guess you could update the last region from within the show cursor script. That might result in an unnecessary update, but at least it's isolated.
  • Alternatively, you could move selection drawing into BrailleHandler alongside cursor drawing. You'd still need to notify BrailleHandler, though, as there won't be a blink timer to do the work for you.
@dkager
@jcsteh

I'm confused. In #5198, I wrote:

I think the command should toggle both the cursor and selection.

And you replied:

I agree. ... SuperNova also uses one command to toggle both.

So, is this a re-think or am I missing something?

@dkager
@jcsteh jcsteh added a commit that closed this issue Dec 10, 2015
@dkager dkager When using a braille display and text is selected on the current line…
… (e.g. when searching in a text editor for text which occurs on the same line), the braille display will be scrolled if appropriate.

On a pending caret move if there is no cursor, try to scroll the braille display to the selection.

* Move the marking of a selection to braille.Region.
* Add Region.brailleSelectionStart/End.
* If there is a selection but not a cursor, e.g. in a TextInfoRegion, scroll the braille display to the selection start.

Fixes #5410.
a5afa2c
@jcsteh jcsteh closed this in a5afa2c Dec 10, 2015
@michaelDCurran michaelDCurran added a commit that referenced this issue Jul 24, 2016
@dkager dkager Add a global command to move braille to the current focus (#5491)
* On a pending caret move if there is no cursor, try to scroll the braille display to the selection.

* Move the marking of a selection to braille.Region.
* Add Region.brailleSelectionStart/End.
* If there is a selection but not a cursor, e.g. in a TextInfoRegion, scroll the braille display to the selection start.

* Add a global command to move braille to the focus, and the caret or cursor within the focus object if possible.
* If tethered to review, move braille to the focus object.
* Otherwise, move braille to the main buffer's last region, which should contain the focus. If it has a cursor/caret, scroll to it. If instead it has a selection, scroll to that.

* Check that there are actually some regions before selecting one.

* If no cursor is found, try scrolling to the selection. Requires #5410.

* Make the script documentation a bit clearer.

* Sync submodules.
4c671a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment