Skip to content

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Jan 8, 2026

Closes #577

Description

Cause:
Every recomposition creates a NEW TextFieldValue with cursor forced to end via TextRange(value.length). This overwrites whatever cursor position the user had.

Solution:
Keep the TextField's internal state and sync external changes

Preview

Screen_recording_20260108_134224.webm

QA Notes

  • Preferably use the virtual keyboard

@jvsena42 jvsena42 requested review from Copilot and ovitrif January 8, 2026 16:47
@jvsena42 jvsena42 self-assigned this Jan 8, 2026
@jvsena42 jvsena42 enabled auto-merge January 8, 2026 16:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a cursor positioning bug in the TextInput component where the cursor was being forced to the end of the text field on every recomposition, making it impossible for users to edit text in the middle of the input.

Key Changes:

  • Implemented internal state management for TextFieldValue to preserve cursor position across recompositions
  • Added synchronization logic to handle external text changes while preserving cursor position when possible
  • Disabled autocorrect for the Electrum server IP address input field

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
app/src/main/java/to/bitkit/ui/components/TextInput.kt Introduced remember state for TextFieldValue and LaunchedEffect to sync external changes while preserving cursor position
app/src/main/java/to/bitkit/ui/settings/advanced/ElectrumConfigScreen.kt Disabled autocorrect for IP address input field

@jvsena42 jvsena42 changed the title fix: component was forcing the cursor to the end on every recomposition fix: text input was forcing the cursor to the end on every recomposition Jan 8, 2026
Copy link
Collaborator

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

tAck

thanks for this fix 🙏🏻

@jvsena42 jvsena42 merged commit 7ce2c87 into master Jan 8, 2026
21 of 23 checks passed
@jvsena42 jvsena42 deleted the fix/preserve-input-position branch January 8, 2026 20:23
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

Successfully merging this pull request may close these issues.

Cannot type normally in Electrum Server inputs after paste

3 participants