#1021 cocoa SCI_POSITIONFROMPOINTCLOSE returning invalid position

Completed
closed
nobody
None
5
2013-10-15
2013-09-24
Todd Whiteman
No

On Cocoa (i.e. ScintillaTest) when the scintilla editor is vertically scrolled (e.g. past one page), that SCI_POSITIONFROMPOINTCLOSE always returns "-1", whilst SCI_POSITIONFROMPOINT still returns the correct position.

Here's the simple modifications I was using to test this:

diff -r baaa425295db cocoa/ScintillaCocoa.mm
--- a/cocoa/ScintillaCocoa.mm Sun Sep 22 12:59:01 2013 +1030
+++ b/cocoa/ScintillaCocoa.mm Tue Sep 24 16:34:33 2013 -0700
@@ -1982,6 +1982,10 @@
{
lastMouseEvent = event;

  • Point location = ConvertPoint([event locationInWindow]);
  • int pos = PositionFromLocation(location, false, false);
  • int posc = PositionFromLocation(location, true, false);
  • printf("MouseMove: (%f, %f), pos %d, posc %d\n", location.x, location.y, pos, posc);
    ButtonMoveWithModifiers(ConvertPoint([event locationInWindow]), TranslateModifierFlags([event modifierFlags]));
    }

Discussion

  • Neil Hodgson
    Neil Hodgson
    2013-09-25

    It wasn't converting back out of scroll view coordinates.
    Fix committed as [c4bbc6].

     

    Related

    Commit: [c4bbc6]

  • Neil Hodgson
    Neil Hodgson
    2013-10-15

    • status: open --> closed