LibGUI: When focusing a TextEditor via keyboard, select all contents
This feels very natural and allows you to start typing immediately knowing it will replace whatever was in the text box before.
This commit is contained in:
parent
75b8f4e4e6
commit
c1e0047b48
Notes:
sideshowbarker
2024-07-19 03:38:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c1e0047b484
1 changed files with 3 additions and 1 deletions
|
@ -1147,8 +1147,10 @@ void TextEditor::set_cursor(const TextPosition& a_position)
|
|||
m_highlighter->cursor_did_change();
|
||||
}
|
||||
|
||||
void TextEditor::focusin_event(FocusEvent&)
|
||||
void TextEditor::focusin_event(FocusEvent& event)
|
||||
{
|
||||
if (event.source() == FocusSource::Keyboard)
|
||||
select_all();
|
||||
m_cursor_state = true;
|
||||
update_cursor();
|
||||
start_timer(500);
|
||||
|
|
Loading…
Add table
Reference in a new issue