Skip to content

Conversation

@trevarj
Copy link
Contributor

@trevarj trevarj commented Jun 30, 2020

When pasting a multiline string, specifically when coming back from the editor, we need to call recalculate so the input line is drawn at the correct height, otherwise it will go out of bounds.

Closes #225

@trevarj
Copy link
Contributor Author

trevarj commented Jun 30, 2020

This was an oversight by me when writing the line wrapping code.

When set() gets called when coming back from the editor, InputArea already has a height set, so it won't try to recalculate.

Another option would be to invalidate the height (self.height = None) instead of recalculating in set(). @osa1 which do you prefer?

@osa1
Copy link
Owner

osa1 commented Jun 30, 2020

Great catch @trevarj, thanks!

Another option would be to invalidate the height (self.height = None) instead of recalculating in set(). @osa1 which do you prefer?

I think I prefer self.height = None and delaying calculating height as much as possible. Reason: if there are other code that also invalidates the height after editor returns, but before the next draw call (e.g. maybe we decide to fall back to scrolling) we avoid redundantly calculating height here only to invalidate it again before the next draw call.

When pasting a multiline string, specifically when coming back from the editor, we need to call recalculate so the input line is drawn at the correct height, otherwise it will go out of bounds.

Invalidate height of InputArea during set()
@trevarj
Copy link
Contributor Author

trevarj commented Jun 30, 2020

Changed to self.height = None, and squashed my commits.

@osa1 osa1 merged commit 512e2aa into osa1:master Jun 30, 2020
@osa1
Copy link
Owner

osa1 commented Jun 30, 2020

Thanks!

@trevarj trevarj deleted the pasting-bug branch June 30, 2020 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic when pasting long string

2 participants