-
Notifications
You must be signed in to change notification settings - Fork 592
Open
Labels
bugSomething isn't workingSomething isn't workinghas reproducible stepsIssue is reproducibleIssue is reproducible
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
I wanted to implement undo/redo on a TextField, but I found out that the field natively supports it with ctrl + z and ctrl + shift + z. However, when I do an undo, the cursor tends to jumps to the end of the text, and I can't find a way to prevent it.
Code sample
Code
ft.TextField(
label="Test",
multiline=True,
min_lines=5,
hint_text="Just trying some text",
width=700,
border_color=ft.Colors.GREY_300,
focused_border_color=ft.Colors.GREY_600,
expand=True,
)To reproduce
- Start up an application with a simple multiple text field, as I provided in the code example.
- Paste in a few paragraphs of text.
- Make some edits.
- Perform
ctrl + z - At least on Ubuntu, this causes the cursor to jump to the end of the text.
Expected behavior
I expect the cursor to stay at the current location when ctrl + z is pressed.
Screenshots / Videos
Captures
2025-10-29.10-59-05.mp4
Operating System
Linux
Operating system details
Ubuntu 24.04.3 LTS
Flet version
0.28.3
Regression
I'm not sure / I don't know
Suggestions
I am not at all a dart expert, so this could be way off, but I thought it could have something to do with: packages/flet/lib/src/controls/textfield.dart, where we set selection: TextSelection.collapsed(offset: value.length).
Logs
Logs
I just start the python code:
python main.pyAdditional details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghas reproducible stepsIssue is reproducibleIssue is reproducible