diff options
Diffstat (limited to 'cocoa/ScintillaCocoa.mm')
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 25 | 
1 files changed, 15 insertions, 10 deletions
| diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 823bcfd3f..08c827b38 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -220,7 +220,8 @@ ScintillaCocoa::~ScintillaCocoa()  void ScintillaCocoa::Initialise()   {    static bool initedLexers = false; -  if (!initedLexers) { +  if (!initedLexers) +  {      initedLexers = true;      Scintilla_LinkLexers();    } @@ -1105,25 +1106,29 @@ void ScintillaCocoa::DoScroll(float position, NSScrollerPart part, bool horizont    }    else    { -    // VerticalScrolling is by line. -    int topLine = (int) (position * MaxScrollPos()); -    int page = LinesOnScreen(); +    // VerticalScrolling is by line. If the user is scrolling using the knob we can directly +    // set the new scroll position. Otherwise we have to compute it first. +    if (part == NSScrollerKnob) +      ScrollTo(position * MaxScrollPos(), false); +    else +    {      switch (part)      {        case NSScrollerDecrementLine: -        topLine--; +          ScrollTo(topLine - 1, true);          break;        case NSScrollerDecrementPage: -        topLine -= page; +          ScrollTo(topLine - LinesOnScreen(), true);          break;        case NSScrollerIncrementLine: -        topLine++; +          ScrollTo(topLine + 1, true);          break;        case NSScrollerIncrementPage: -        topLine += page; +          ScrollTo(topLine + LinesOnScreen(), true);          break;      }; -    ScrollTo(topLine, true); +       +    }    }  } @@ -1232,7 +1237,7 @@ void ScintillaCocoa::IdleTimerFired()  /**   * Main entry point for drawing the control.   * - * @param rect The area to paint, given in the sender's coordinate. + * @param rect The area to paint, given in the sender's coordinate system.   * @param gc The context we can use to paint.   */  void ScintillaCocoa::Draw(NSRect rect, CGContextRef gc) | 
