-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
TextInput does not paginate when multiline is False #4951
Comments
Pagination is not present regardless of the value of multiline in 1.9.1 and earlier versions. |
The right fix will likely involve examining how different browser inputs behave in these cases and emulating that. The behavior differs in all Kivy versions from that of html inputs, regardless of |
For my 2c, this works as expected. 'multiline' is does not equate to pagination. With multiline True, it wraps automatically to multiple lines, otherwise text continues on a single line. I think this behavior makes sense and consistent with the docs? And it's not clear what 'pagination' would mean in the context of TextInput. Perhaps you could elaborate? |
I called pagination what is seen on the gif when multiline is True. I'm not that much for pagination either, but the current behavior does not seem correct when multiline is False, compare it to a html input in your browser. One issue is the text that is about to be deleted not being visible after the cursor has reached the left side of the input. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Mot de passe |
Reproduced the problem on Kivy 2.2.1, Windows 11. Restating the problem, because I found the descriptions tough to understand: The two boxes are both only tall enough to display one line of text. The former has multiline turned on by default, which allows you to include new-lines into the text. If you hit enter, it will show the current line of a multi-text window. The latter has multiline turned off. It ignores enter. Multi-line windows have a second feature: Word-wrapping. It is on by default (can be turned off with The word-wrapping doesn't seem to wrap the lines in this example, because of the widget size. If the widget is made larger, it shows more of the lines, and the wrapping is visible. Another behaviour that is controlled by word-wrapping: As you move near/past the edges of the textbox, the displayed jumps to show the previous "page" of text. Multiline off:
Multiline on with explicit
Multiline on with default
The OP is effectively asking for the same auto-movement of the text when word-wrapping is turned off. |
Here is a workaround in user code. Let me know if you think this is sufficient or if it would be better change to the TextInput widget. from kivy.app import App
from kivy.lang import Builder
from kivy.uix.textinput import TextInput
from kivy.properties import NumericProperty
kv = """
AnchorLayout:
ScrollBackTextInput:
size_hint: None, None
size: dp(150), dp(30)
multiline: False
scroll_back: self.width - 20 # scroll back is related to the size of the text box
"""
class ScrollBackTextInput(TextInput):
scroll_back = NumericProperty(90)
def on_text(self, *args):
if self.x + self.padding[0] >= self.cursor_pos[0]:
# cursor is on left hand side, padding[0] is padding on the left
# if the cursor hits the left hand side, scroll to the left
self.scroll_x = max(0, self.scroll_x - self.scroll_back)
class TiTestApp(App):
def build(self):
return Builder.load_string(kv)
TiTestApp().run() |
I vote fix the widget. I believe there is bigger-picture edits happening to TextInput right now, and there seem to be a few PRs in the queue. |
Versions
Description
TextInput does not paginate during character insertions and deletions when
multiline
isFalse
.Here are two ways to reproduce the bug:
type text in the first input until it is overfilled, then start deleting the text with backspace, repeat the same actions for the second input
paste text in the first input with CTRL+V until it is overfilled, then type CTRL+Z, repeat the same actions for the second input
Code and Logs
The text was updated successfully, but these errors were encountered: