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

multiline TextInput text selection on android #8474

Open
alexg93333 opened this issue Nov 21, 2023 · 0 comments
Open

multiline TextInput text selection on android #8474

alexg93333 opened this issue Nov 21, 2023 · 0 comments

Comments

@alexg93333
Copy link

alexg93333 commented Nov 21, 2023

On android the TextInput text selection is behaving strangely. On linux I can hold down the mouse and drag to select text, on android holding down touch and dragging doesn't have any effect at all, I noticed that if I try to select and drag a couple of times in a row suddently the whole text gets selected.

On linux:
https://gyazo.com/66ab3b360078757f02e42d9b9fde88ac

On android:
https://gyazo.com/a3235fb1a5e7bd1e569307528815c5cb

from kivy.app import App
from kivy.lang import Builder
KV = '''
BoxLayout:
    orientation: 'vertical'
    TextInput:    
        id: tinput
        background_color: "black"
        cursor_color: self.background_color
        foreground_color: 1, 1, 1, 1  # Set text color to white
        use_bubble : False
        readonly:True
        size_hint: 1, 1
        height:self.minimum_height
        multiline:True 
    
'''
class MinimalTextInputApp(App):
    def build(self):
        return Builder.load_string(KV)
    
    def on_start(self):
        self.root.ids.tinput.text="""s ajlkk sajklsa jkl
            salajsa kljs alkjas
            as kjlsakjlasjlksakj
            a sjkasjlksalkja sa
            a sjaslkjksasj
            """
        return super().on_start()

if __name__ == '__main__':
    MinimalTextInputApp().run()

EDIT: I also noticed that on linux, after selecting text, you can click outside the text to clear the selection. On android it doesn't work. If I tap anywhere on the screen, even outside the element, the selection seems to be permanent.
Linux:
https://gyazo.com/3bd2a6b368d863e56a6f907ebeb0cb6f
Android:
https://gyazo.com/b1da8de0379e2e095a2efd23ec3e3546

EDIT 2 : I found out that the bug is due to readonly: True. If readonly is false, android text selection starts to behave correctly as on linux. On linux with readonly false or true the text selection behavior is correct in both cases. This is definitely a bug for kivy on android.

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

No branches or pull requests

1 participant