diff --git a/README.md b/README.md index 7360473..356f4f8 100644 --- a/README.md +++ b/README.md @@ -68,19 +68,32 @@ Ctrl+C - Enter NORMAL mode ``` i - Return to INSERT mode : - Enter COMMAND mode -j/k - Scroll down/up -g/G - Scroll to top/bottom +j/k - Scroll down/up one line +Ctrl+D/U - Scroll half page down/up +Ctrl+F/B - Scroll full page down/up +g/G - Jump to top/bottom ? - Show help +Ctrl+C - Exit chat ``` **COMMAND mode** ``` -:list, :users, :who - Show online users -:help, :commands - Show available commands -:clear, :cls - Clear command output +:list, :users - Show online users +:nick - Change nickname +:msg - Whisper to user +:w - Short alias for :msg +:help - Show available commands +:clear - Clear command output +:q, :quit, :exit - Disconnect +Up/Down - Browse command history ESC - Return to NORMAL mode ``` +**Special messages (INSERT mode)** +``` +/me - Send action (e.g. /me waves) +``` + ### Security Configuration **Access control:** @@ -143,6 +156,7 @@ ssh -p 2222 chat.m1ng.space stats --json ssh -p 2222 chat.m1ng.space users ssh -p 2222 chat.m1ng.space "tail -n 20" ssh -p 2222 operator@chat.m1ng.space post "service notice" +ssh -p 2222 chat.m1ng.space post "/me deploys v2.0" ``` ## Development diff --git a/src/ssh_server.c b/src/ssh_server.c index 1c4d98a..44699be 100644 --- a/src/ssh_server.c +++ b/src/ssh_server.c @@ -762,6 +762,7 @@ static int exec_command_help(client_t *client) { " tail [N] Print recent messages\n" " tail -n N Print recent messages\n" " post MESSAGE Post a message non-interactively\n" + " post \"/me act\" Post an action message\n" " exit Exit successfully\n"; return client_send(client, help_text, sizeof(help_text) - 1) == 0 ? 0 : 1; @@ -1153,7 +1154,7 @@ static void execute_command(client_t *client) { } else if (strcmp(cmd, "help") == 0 || strcmp(cmd, "commands") == 0) { buffer_appendf(output, sizeof(output), &pos, "========================================\n" - " Available Commands\n" + " Available Commands / 可用命令\n" "========================================\n" "list, users, who - Show online users\n" "nick/name - Change nickname\n" @@ -1162,6 +1163,9 @@ static void execute_command(client_t *client) { "clear, cls - Clear command output\n" "q, quit, exit - Disconnect\n" "Up/Down arrows - Command history\n" + "========================================\n" + "In INSERT mode:\n" + " /me - Send action message\n" "========================================\n"); } else if (strncmp(cmd, "msg ", 4) == 0 || strncmp(cmd, "w ", 2) == 0) { diff --git a/src/tui.c b/src/tui.c index 6da378b..bfeca31 100644 --- a/src/tui.c +++ b/src/tui.c @@ -299,35 +299,30 @@ const char* tui_get_help_text(help_lang_t lang) { "NORMAL MODE KEYS:\n" " i - Return to INSERT mode\n" " : - Enter COMMAND mode\n" - " j - Scroll down (older messages)\n" - " k - Scroll up (newer messages)\n" - " g - Jump to top (oldest)\n" - " G - Jump to bottom (newest)\n" + " j/k - Scroll down/up one line\n" + " Ctrl+D/U - Scroll half page down/up\n" + " Ctrl+F/B - Scroll full page down/up\n" + " g/G - Jump to top/bottom\n" " ? - Show this help\n" " Ctrl+C - Exit chat\n" "\n" - "COMMAND MODE KEYS:\n" - " Enter - Execute command\n" - " ESC - Cancel, return to NORMAL\n" - " Backspace - Delete character\n" - " Ctrl+W - Delete last word\n" - " Ctrl+U - Delete line\n" - "\n" "AVAILABLE COMMANDS:\n" - " list, users, who - Show online users\n" - " nick/name - Change nickname\n" - " msg/w - Whisper to user\n" - " help, commands - Show available commands\n" - " clear, cls - Clear command output\n" + " :list, :users - Show online users\n" + " :nick - Change nickname\n" + " :msg - Whisper to user\n" + " :w - Short alias for :msg\n" + " :help - Show available commands\n" + " :clear - Clear command output\n" + " :q, :quit, :exit - Disconnect\n" + "\n" + "SPECIAL MESSAGES:\n" + " /me - Send action (e.g. /me waves)\n" "\n" "HELP SCREEN KEYS:\n" " q, ESC - Close help\n" - " j - Scroll down\n" - " k - Scroll up\n" - " g - Jump to top\n" - " G - Jump to bottom\n" - " e, E - Switch to English\n" - " z, Z - Switch to Chinese\n"; + " j/k - Scroll down/up\n" + " g/G - Jump to top/bottom\n" + " e/z - Switch English/Chinese\n"; } else { return "终端聊天室 - 帮助\n" "\n" @@ -347,35 +342,30 @@ const char* tui_get_help_text(help_lang_t lang) { "NORMAL 模式按键:\n" " i - 返回 INSERT 模式\n" " : - 进入 COMMAND 模式\n" - " j - 向下滚动(更早的消息)\n" - " k - 向上滚动(更新的消息)\n" - " g - 跳到顶部(最早)\n" - " G - 跳到底部(最新)\n" + " j/k - 向下/上滚动一行\n" + " Ctrl+D/U - 向下/上滚动半页\n" + " Ctrl+F/B - 向下/上滚动整页\n" + " g/G - 跳到顶部/底部\n" " ? - 显示此帮助\n" " Ctrl+C - 退出聊天\n" "\n" - "COMMAND 模式按键:\n" - " Enter - 执行命令\n" - " ESC - 取消,返回 NORMAL 模式\n" - " Backspace - 删除字符\n" - " Ctrl+W - 删除上个单词\n" - " Ctrl+U - 删除整行\n" - "\n" "可用命令:\n" - " list, users, who - 显示在线用户\n" - " nick/name <名字> - 更改昵称\n" - " msg/w <用户> <文本> - 私聊\n" - " help, commands - 显示可用命令\n" - " clear, cls - 清空命令输出\n" + " :list, :users - 显示在线用户\n" + " :nick <名字> - 更改昵称\n" + " :msg <用户> <文本> - 私聊\n" + " :w <用户> <文本> - :msg 的简写\n" + " :help - 显示可用命令\n" + " :clear - 清空命令输出\n" + " :q, :quit, :exit - 断开连接\n" + "\n" + "特殊消息:\n" + " /me <动作> - 发送动作 (如 /me 挥手)\n" "\n" "帮助界面按键:\n" " q, ESC - 关闭帮助\n" - " j - 向下滚动\n" - " k - 向上滚动\n" - " g - 跳到顶部\n" - " G - 跳到底部\n" - " e, E - 切换到英文\n" - " z, Z - 切换到中文\n"; + " j/k - 向下/上滚动\n" + " g/G - 跳到顶部/底部\n" + " e/z - 切换英文/中文\n"; } } diff --git a/tnt.1 b/tnt.1 index ce92a26..b782b76 100644 --- a/tnt.1 +++ b/tnt.1 @@ -84,6 +84,7 @@ ESC Switch to NORMAL Ctrl+W Delete last word Ctrl+U Clear input line Ctrl+C Switch to NORMAL +/me \fIaction\fR Send action message (e.g. /me waves) .TE .SS NORMAL mode .TS @@ -120,6 +121,7 @@ ssh host \-p 2222 users \-\-json ssh host \-p 2222 stats \-\-json ssh host \-p 2222 tail 20 ssh host \-p 2222 post "Hello from a script" +ssh host \-p 2222 post "/me deploys v2.0" ssh host \-p 2222 health .fi .PP