diff --git a/src/input.c b/src/input.c index 9bc55f9..d564ba6 100644 --- a/src/input.c +++ b/src/input.c @@ -167,6 +167,12 @@ static bool handle_key(client_t *client, unsigned char key, char *input) { /* Handle help screen */ if (client->show_help) { + /* Page size: roughly the visible help body region. */ + int page = client->height - 2; + if (page < 1) page = 1; + int half = page / 2; + if (half < 1) half = 1; + if (key == 'q' || key == 27) { client->show_help = false; tui_render_screen(client); @@ -184,6 +190,20 @@ static bool handle_key(client_t *client, unsigned char key, char *input) { } else if (key == 'k' && client->help_scroll_pos > 0) { client->help_scroll_pos--; tui_render_help(client); + } else if (key == 4) { /* Ctrl+D: half page down */ + client->help_scroll_pos += half; + tui_render_help(client); + } else if (key == 21) { /* Ctrl+U: half page up */ + client->help_scroll_pos -= half; + if (client->help_scroll_pos < 0) client->help_scroll_pos = 0; + tui_render_help(client); + } else if (key == 6) { /* Ctrl+F: full page down */ + client->help_scroll_pos += page; + tui_render_help(client); + } else if (key == 2) { /* Ctrl+B: full page up */ + client->help_scroll_pos -= page; + if (client->help_scroll_pos < 0) client->help_scroll_pos = 0; + tui_render_help(client); } else if (key == 'g') { client->help_scroll_pos = 0; tui_render_help(client); diff --git a/src/tui.c b/src/tui.c index 9778719..a96371b 100644 --- a/src/tui.c +++ b/src/tui.c @@ -730,6 +730,8 @@ const char* tui_get_help_text(help_lang_t lang) { "HELP SCREEN KEYS:\n" " q, ESC - Close help\n" " j/k - Scroll down/up\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" " e/z - Switch English/Chinese\n"; } else { @@ -777,6 +779,8 @@ const char* tui_get_help_text(help_lang_t lang) { "帮助界面按键:\n" " q, ESC - 关闭帮助\n" " j/k - 向下/上滚动\n" + " Ctrl+D/U - 向下/上滚动半页\n" + " Ctrl+F/B - 向下/上滚动整页\n" " g/G - 跳到顶部/底部\n" " e/z - 切换英文/中文\n"; }