Public Access
IRC App: Alt scrolls, Up/Down recall sent lines; /j for /join
- Alt + ; / Alt + . scroll the Buffer back and forward - Up / Down (Fn + ; / Fn + .) browse the last 30 sent lines, shell-style, returning to the draft past the newest (InputHistory, host-tested) - /j is short for /join Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
+14
-2
@@ -80,13 +80,24 @@ bool IrcApp::onKey(const KeyEvent& e) {
|
||||
}
|
||||
|
||||
bool IrcApp::onChatKey(const KeyEvent& e) {
|
||||
// Alt + ; / Alt + . scroll the Buffer; Up / Down (Fn + ; / Fn + .) recall sent lines.
|
||||
if (e.key == Key::Char && e.alt && (e.ch == ';' || e.ch == '.')) {
|
||||
if (e.ch == ';') scroll_++; // older
|
||||
else if (scroll_ > 0) scroll_--;
|
||||
return true;
|
||||
}
|
||||
std::string recalled;
|
||||
switch (e.key) {
|
||||
case Key::Char: input_.insert(e.ch); break;
|
||||
case Key::Delete: input_.backspace(); break;
|
||||
case Key::Left: input_.left(); break;
|
||||
case Key::Right: input_.right(); break;
|
||||
case Key::Up: scroll_++; break; // older
|
||||
case Key::Down: if (scroll_ > 0) scroll_--; break;
|
||||
case Key::Up:
|
||||
if (history_.up(input_.text(), recalled)) input_.setText(recalled);
|
||||
break;
|
||||
case Key::Down:
|
||||
if (history_.down(recalled)) input_.setText(recalled);
|
||||
break;
|
||||
case Key::Tab: {
|
||||
int count = irc_.withSession([](IrcSession& s) { return s.bufferCount(); });
|
||||
view((current_ + 1) % count);
|
||||
@@ -95,6 +106,7 @@ bool IrcApp::onChatKey(const KeyEvent& e) {
|
||||
case Key::Select: {
|
||||
std::string text = input_.text();
|
||||
if (text.empty()) break;
|
||||
history_.add(text);
|
||||
input_.setText("");
|
||||
scroll_ = 0;
|
||||
if (lowered(text) == "/settings") {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "app.h"
|
||||
#include "event_bus.h"
|
||||
#include "input_history.h"
|
||||
#include "line_editor.h"
|
||||
#include "list_model.h"
|
||||
#include "services/irc_service.h"
|
||||
@@ -48,6 +49,7 @@ class IrcApp : public App {
|
||||
uint32_t seenRevision_ = 0;
|
||||
IrcService::Status seenStatus_ = IrcService::Status::Stopped;
|
||||
LineEditor input_{400};
|
||||
InputHistory history_{30};
|
||||
ListModel fields_{theme::kContent.h / theme::kLineHeight};
|
||||
bool editing_ = false;
|
||||
LineEditor fieldEditor_{63};
|
||||
|
||||
Reference in New Issue
Block a user