Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling with Line Folding not working correctly #7

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments
Open

Scrolling with Line Folding not working correctly #7

GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

To reproduce:

Run the demo, fold the line containing "sub test". This folds away lines 8 to 
171.
Now move the cursor to the bottom of the view, and then press the cursor down 
key a few more times until the top line goes beyond the folded section.

At that point, the scroll position jumps instead of moving just one more line.

It appears that the issue lies inside CustomEditField.changeScrollValues(), 
after the comment "//Cap values". Here, the variable "vertical" needs to be 
adjusted to remove the folded lines, but this isn't happening.

Therefore, until this is fixed, Line Folding is fairly unusable.

Original issue reported on code.google.com by tempelmann@gmail.com on 10 Sep 2013 at 10:46

@GoogleCodeExporter
Copy link
Author

Koen Van Hulle adds (via e-mail):

I have updated my code to the latest version of Custom Edit Field.
I encountered a problem with the foldings, which I couldn't get to work.

After a couple of hours debugging I found a workaround for me.

In my solution I start with an empty text field. This leads to an initial empty 
value of the property mIndentationStateOut (Textline).
When loading a new XML in the edit field, the first line results also in an 
empty mIndentationStateOut.
So the code stops checking the rest of the text.

Changing the method "UpdateIndentationState", by always setting the property 
mChangedIndentState to true solved my issue.
I know this is not the most optimised way, but works for me.

==================

 Sub UpdateIndentationState(definition as highlightdefinition, prevIndentationState as String, myText as String)
  // TODO: Maybe optimize this so that it doesn't need to perform the Regex checks
  // every time. E.g, if neither the mIndentationState nor the text changed, then
  // there's no need to update.
  // However, how to I tell if the text has changed? I shouldn't buffer each line here, that might
  // be wasteful.

  if mIndentationStateIn <> prevIndentationState then
    mIndentationStateIn = prevIndentationState
    mIndentationStateOut = prevIndentationState
    mChangedIndentState = true
  end

  if me.length = 0 then
    mIsBlkStart = false
    mBlockIndent = 0
    isBlockEnd = false
    Return
  end

  // KVH commented out
  'dim newState as String
  'mBlockIndent = definition.isBlockStart(myText, mIndentationStateIn, newState)
  'if newState <> mIndentationStateOut then
  'mIndentationStateOut = newState
  'mChangedIndentState = true
  'end
  '
  'isBlockEnd = definition.isBlockEnd(myText, newState, newState)
  'if newState <> mIndentationStateOut then
  'mIndentationStateOut = newState
  'mChangedIndentState = true
  'end



  // KVH-  Force a change since the prev is not always working
  dim newState as String
  mBlockIndent = definition.isBlockStart(myText, mIndentationStateIn, newState)
  isBlockEnd = definition.isBlockEnd(myText, newState, newState)
  mIndentationStateOut = newState
  mChangedIndentState = true

  mIsBlkStart = mBlockIndent <> 0

End Sub

Original comment by tempelmann@gmail.com on 18 Mar 2014 at 11:32

@GoogleCodeExporter
Copy link
Author

And more from Koen Van Hulle:

It seems to happen in certain circumstances.
Enclosed you find an example. Just click on the button "Load Sample XML".

Original comment by tempelmann@gmail.com on 18 Mar 2014 at 11:32

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant