1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:47:35 +00:00

Ladybird: Hook up console history into the AppKit console

This commit is contained in:
Timothy Flynn 2023-08-30 08:48:42 -04:00 committed by Andrew Kaster
parent 204a6f9241
commit 8d66b9ea3f

View file

@ -133,6 +133,18 @@ static constexpr CGFloat const WINDOW_HEIGHT = 600;
textView:(NSTextView*)text_view textView:(NSTextView*)text_view
doCommandBySelector:(SEL)selector doCommandBySelector:(SEL)selector
{ {
if (selector == @selector(moveUp:)) {
if (auto script = m_console_client->previous_history_item(); script.has_value())
[text_view setString:Ladybird::string_to_ns_string(*script)];
return YES;
}
if (selector == @selector(moveDown:)) {
if (auto script = m_console_client->next_history_item(); script.has_value())
[text_view setString:Ladybird::string_to_ns_string(*script)];
return YES;
}
if (selector != @selector(insertNewline:)) { if (selector != @selector(insertNewline:)) {
return NO; return NO;
} }