LibGUI: Don't enter TableView edit mode when a control key is pressed
A key press, which is an ASCII control character will no longer cause TableView to begin editing. This fixes an issue in Spreadsheet where navigating to a cell then pressing escape would cause a that cell's text to be set to a non-printable value. Pressing escape after navigating to a cell now has no effect.
This commit is contained in:
parent
4e2e2027c3
commit
361e29cfc9
Notes:
sideshowbarker
2024-07-17 10:10:18 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/361e29cfc9 Pull-request: https://github.com/SerenityOS/serenity/pull/21251 Reviewed-by: https://github.com/gmta ✅
1 changed files with 2 additions and 2 deletions
|
@ -194,8 +194,8 @@ void TableView::keydown_event(KeyEvent& event)
|
|||
auto is_delete = event.key() == Key_Delete;
|
||||
auto is_backspace = event.key() == Key_Backspace;
|
||||
auto is_clear = is_delete || is_backspace;
|
||||
auto has_ctrl = event.modifiers() & KeyModifier::Mod_Ctrl;
|
||||
if (is_editable() && edit_triggers() & EditTrigger::AnyKeyPressed && (event.code_point() != 0 || is_clear) && !has_ctrl) {
|
||||
auto is_control_character = is_ascii_c0_control(event.code_point());
|
||||
if (is_editable() && edit_triggers() & EditTrigger::AnyKeyPressed && !event.ctrl() && (!is_control_character || is_clear)) {
|
||||
begin_editing(cursor_index());
|
||||
if (m_editing_delegate) {
|
||||
if (is_delete) {
|
||||
|
|
Loading…
Add table
Reference in a new issue