-
Notifications
You must be signed in to change notification settings - Fork 814
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
Auto width inputs #1699
Auto width inputs #1699
Conversation
@@ -255,6 +255,7 @@ def cursor_width(self) -> int: | |||
return self._position_to_cell(len(self.value)) + 1 | |||
|
|||
def render(self) -> RenderableType: | |||
self.view_position = self.view_position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forces validation again. This is required as the input may have changed size since last render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How the heck does one conclude the issue was here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forces validation again. This is required as the input may have changed size since last render.
Given that, to the casual reader, the change might look like a nop; perhaps this should be a comment in the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rodrigogiraoserrao The only difference with width:auto is that the size of the input changes after text is appended, leaving the view position in the wrong place. The validate_view_position
should always keep the view position in the right place, so I figured i justt wasn't being called.
@davep It's somewhat of an established pattern now. Not keen on cut and pasting the same comment everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add and commit the snapshot app auto_width_input.py
😆
@@ -255,6 +255,7 @@ def cursor_width(self) -> int: | |||
return self._position_to_cell(len(self.value)) + 1 | |||
|
|||
def render(self) -> RenderableType: | |||
self.view_position = self.view_position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How the heck does one conclude the issue was here?
Fixes #1693
Fixes a glitch where auto-width inputs were scrolled off by one character.
Screen.Recording.2023-01-31.at.12.03.08.mov