Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

LMDEditView Prevent scroll past EOL?

How can I prevent scrolling when making a text selection or scrolling past the end of line with a text selection?

I'm not sure what's going on but the horizontal scrollbars for me are behaving kinda odd, the horizontal scrollbar just keeps growing and growing when dragging the mouse with a text selection.

I noticed MaxHorizScroll property which is 500 by default but even setting it lower it behaves strange.

Additionally, how could we calculate the optimal HorizScroll? I imagine we need to get the longest line in the document?
Tagged:

Comments

  • 2 Comments sorted by Votes Date Added
  • How can I prevent scrolling when making a text selection or scrolling past the end of line with a text selection?

    It works like in Delphi, and there are no ways to achieve this.

    I noticed MaxHorizScroll property which is 500 by default but even setting it lower it behaves strange.

    You right, I can confirm scrolling over the MaxHorizScroll value. I will try to fix it.

    Additionally, how could we calculate the optimal HorizScroll? I imagine we need to get the longest line in the document?

    You can, of course, calculate the longest line, and it may be a good strategy for your own particular use case, but generally just keeping this number big, like in Delphi, imho more preferable.
  • Unfortunately, I cannot change anything in this aspect, because there are a lot of actions which allowed to work beyond EOL. You can place edit caret there by repeatedly pressing Right Arrow key, or End key on a long line. You can start typing new text there. You can drag&drop selected text there.

    So, MaxHorizScroll is only a soft constraint, which is used to calculate horizontal scroll bar parameters. The overall idea is to allow to deal with text outside of MaxHorizScroll range. Moreover, MaxHorizScroll is automatically expanded (increased) when the caret is placed outside of its range.
Sign In or Register to comment.