With BTF2's TextFieldState, is the shorter way to ...
# compose
s
With BTF2's TextFieldState, is the shorter way to replace the entire text with something new to do this:
Copy code
state.edit {
 delete(0, length)
 append(newString)
}
I know I can just make a new function myself, but just wanted to make sure I am not somehow missing something in the existing API
a
There’s
TextFieldState.setTextAndPlaceCursorAtEnd()
.
s
That's it! I was mostly looking inside the
.edit {}
lambda in the receiver of
TextFieldBuffer
. Thanks a lot!
e
A lot of the time I’ll do an “All Places” search with my exact snippet of code (or similar) to see if there already exists library code that does the same thing
💡 1
Searching for
delete(0, length)
for instance
s
Does that actually search in library code too? I am afk now but I would've swore that this hasn't worked for me 😅
e
Yeah it does, you just need to use one of “Project & Libraries” or “All Places” scopes
👍 1
h
I love that we put the entire implementation of the function inside its kdoc
😅 2
👌 1