-
Notifications
You must be signed in to change notification settings - Fork 752
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
Basic text input #495
Basic text input #495
Conversation
src/textual/widgets/text_input.py
Outdated
from textual.widget import Widget | ||
|
||
|
||
class TextInputBase(Widget): |
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.
Trying to think ahead a little here by extracting some common keybinding/text navigation stuff into a base class. Not sure if it will work out, but that's my thinking.
85ba2c7
to
f6002e7
Compare
Having some problems with Text wrapping where typing multiple words separated by spaces can sometimes cause the second word to disappear. I'm assuming it's folding on to the next line. Have tried playing with overflow and no_wrap but no luck |
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.
Amazing work! 😮
I just have a few very picky comments on things that don't matter, that you're totally free to ignore :-)
def get_content_height( | ||
self, container_size: Size, viewport_size: Size, width: int | ||
) -> int: | ||
return self._editor.content.count("\n") + 1 + 2 |
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.
could be nice to add a quick comment that explains why we add 1 and 2 ? :-)
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.
Aha, but that assumes that I know why I added 1 and 2! ;)
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.
Going to leave this for now since it's just for my naive/hacky little multiline editor thing, not intended to be production ready really :)
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.
I like the direction this is going.
Haven't been too pedantic re docstrings etc. since I know this is the first part of a feature branch.
@@ -200,6 +200,9 @@ class Keys(str, Enum): | |||
ShiftControlEnd = ControlShiftEnd | |||
|
|||
|
|||
KEY_BINDINGS = Keys._value2member_map_.values() |
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.
👌
@willmcgugan I've fixed the issue where scrolling would break on resize (since the "visible window" into the editor content wasn't being adjusted previously), and also I had missed a no_wrap on the placeholder text in one case. |
Goals for this PR
sandbox/input.py
)Non-goals