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

TextInput: Fix for crashes caused by text selection outside of TextInput area #6666

Merged
merged 1 commit into from
May 8, 2020
Merged

TextInput: Fix for crashes caused by text selection outside of TextInput area #6666

merged 1 commit into from
May 8, 2020

Conversation

RedGui
Copy link
Contributor

@RedGui RedGui commented Dec 25, 2019

This may be an edge case, but worth addressing.

Changes:

  • Fix for uncaught exceptions due to text selection exceeding TextInput area

Description:

Fix for uncaught exceptions related to slicing when list indexes are not supplied as integers. This happens for row / col in _lines[row][:col] and other places that use slicing for cursor position or text selection, even double tap.

Observed in:

in KivyMD's class MDTextFieldRound when for example

  1. Created password input field of type MDTextFieldRound with a right side icon (no left side icon) enabled in the text field

  2. Populated the field with text

  3. Resized (downsized) the window until the icon pushes the text beyond the text field area (overflow text is hidden underneath the visible layer)

  4. Selected the text by clicking in a way that:

    • Targeted the beginning of the overflow or an invisible part of the text (obstructed by a part of the input field if it is rounded or partly rounded)
    • 'Double tapped' the text, selecting the entire text (overflow as well)

@welcome
Copy link

welcome bot commented Dec 25, 2019

Thanks for opening your first pull request here! 💖 Please check out our contributing guidelines.

Copy link
Member

@tshirtman tshirtman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it can't hurt, and if it prevents edge case failure, then sure…

@tshirtman tshirtman merged commit db44e64 into kivy:master May 8, 2020
@welcome
Copy link

welcome bot commented May 8, 2020

Congrats on merging your first pull request! 🎉🎉🎉

@RedGui RedGui deleted the bugfix/fix_for_uncaught_exceptions_due_to_text_selection_beyond_TextInput_area branch May 22, 2020 01:04
@matham matham added this to the 2.0.0 milestone Oct 28, 2020
@matham matham changed the title Fix for crashes caused by text selection outside of TextInput area TextInput: Fix for crashes caused by text selection outside of TextInput area Dec 9, 2020
@matham matham added the Component: Widgets kivy/uix, style.kv label Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Widgets kivy/uix, style.kv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants