fix: place cursor at beginning of text field when quoting a note
When a user hits Quote, the new post screen opens with the nostr URI pre-filled but the cursor was at the end (after the URI). This moves the cursor to the beginning so the user can immediately start typing their commentary. https://claude.ai/code/session_01RPseKC9GJ8hs3GGBR85ezw
This commit is contained in:
+7
@@ -25,6 +25,13 @@ import androidx.compose.ui.text.TextRange
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
fun TextFieldState.setTextAndPlaceCursorAtBeginning(text: String) {
|
||||
edit {
|
||||
replace(0, length, text)
|
||||
selection = TextRange(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
fun TextFieldState.insertUrlAtCursor(url: String) {
|
||||
edit {
|
||||
var toInsert = url.trim()
|
||||
|
||||
Reference in New Issue
Block a user