Menu

#2271 Disabling horizontal scrollbar without wrapping causes issues

Bug
closed-fixed
nobody
5
2021-09-22
2021-08-03
No

I was wondering if I could use scintilla with the horizontal scrollbar and wrapping disabled. I'd guess that in this case the content view will still be scrolled, but only by keeping the caret visible. It seems that this does not work in Scintilla on Mac but works on Windows.

To reproduce:

  1. In ScintillaTest, add [mEditor setGeneralProperty: SCI_SETHSCROLLBAR value: 0]; and run the app.
  2. Clear the contents of the editor.
  3. Start typing. When your line exceeds the width of the view it starts scrolling, but does not render anything past the moment you exceeded the view width.

I've attached a screen recording demonstrating the issue

Any ideas of ways to work around this, or is the fix simple? As of now, I'm not able to come up with a fix.

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-08-04

    The key method here is ScintillaCocoa::SetScrollingSize. The document width docWidth is set to the view width when the scroll bar is not shown. You can start experimenting here by disregarding horizontalScrollBarVisible when determining the docWidth, changing line 1967 from if (!showHorizontalScroll) to if (Wrapping()):

    bool showHorizontalScroll = horizontalScrollBarVisible &&
                    !Wrapping();
    if (Wrapping())
        docWidth = clipRect.size.width;
    NSRect contentRect = {{0, 0}, {docWidth, docHeight}};
    

    There may be further problems that need to be addressed - I haven't thought through all the potential implications of this change.

     
  • Neil Hodgson

    Neil Hodgson - 2021-08-04
    • status: open --> open-accepted
     
  • Neil Hodgson

    Neil Hodgson - 2021-08-27
    • status: open-accepted --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2021-08-27

    Committed [73ece9] which makes the mentioned change.

     

    Related

    Commit: [73ece9]

  • Neil Hodgson

    Neil Hodgson - 2021-09-22
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB