AppKit: Let an editable text view take the Tab key

CPWindow handled every Tab key press itself and moved to the next key view, so a text view never received Tab and could not insert a tab character.

It now follows Cocoa: an editable text view takes plain Tab and inserts a tab, while Control-Tab, Shift-Tab and Tab in other views still move through the key view loop.

* CPResponder.j: Add _wantsTabKey, which returns NO by default.

* CPTextView/CPTextView.j: Want the Tab key while editable.

* CPWindow/CPWindow.j: Pass plain Tab to a first responder that wants it, and keep the browser from moving its own focus.
This commit is contained in:
David Richardson committed 2026-10-23 20:20:51 -06:00
1 parent 1622990436
commit b222ee0320
3 files changed
+31 -1

No files matched your search

+10
View File
@@ -1839,6 +1839,16 @@ Sets the selection to a range of characters in response to user action.
[self insertText:@"\t"];
}
/*
@ignore
As in Cocoa, an editable text view takes the Tab key and inserts a tab character.
Control-Tab still moves to the next key view.
*/
- (BOOL)_wantsTabKey
{
return [self isEditable];
}
- (void)insertTabIgnoringFieldEditor:(id)sender
{
[self insertTab:sender];