From 34b75173866faf4f76e8090cac19776af74ca1b8 Mon Sep 17 00:00:00 2001 From: Yuzu Octopus Date: Sat, 8 Aug 2026 20:07:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20show=20=E2=8C=A5=20and=20=E2=8C=83?= =?UTF-8?q?=20symbols=20for=20Alt/Option=20and=20Ctrl=20on=20macOS=20(#527?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use macOS keyboard symbols in help bar instead of M- and ^ notation when built on Apple platforms, matching established __APPLE__ guard pattern in src/uikeyconfig.cpp. Co-authored-by: Yuzu --- src/uihelpview.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uihelpview.cpp b/src/uihelpview.cpp index e0c57438..0a04d0d2 100644 --- a/src/uihelpview.cpp +++ b/src/uihelpview.cpp @@ -270,14 +270,22 @@ std::string UiHelpView::GetKeyDisplay(const std::string& p_Func) const std::string keyName = UiKeyConfig::GetStr(p_Func); if ((keyName.size() == 9) && (keyName >= "KEY_CTRLA") && (keyName <= "KEY_CTRLZ")) { - return "^" + keyName.substr(8, 1); +#if defined(__APPLE__) + return "\xe2\x8c\x83" + keyName.substr(8, 1); // ⌃ +#else + return "^" + keyName.substr(8, 1); // ^ +#endif } else if (std::count(keyName.begin(), keyName.end(), '\\') == 2) { const std::string keyStr = StrUtil::StrFromOct(keyName); if ((keyStr.size() == 2) && (keyStr.at(0) == '\33') && StrUtil::IsValidTextKey(keyStr.at(1))) { - return "M-" + keyStr.substr(1); +#if defined(__APPLE__) + return "\xe2\x8c\xa5" + keyStr.substr(1); // ⌥ +#else + return "M-" + keyStr.substr(1); // M- +#endif } } else if (keyName == "KEY_RETURN") From 42aa10b7439d21f710dc30a690e6f80d97ec7fd4 Mon Sep 17 00:00:00 2001 From: Kristofer Berggren Date: Sat, 8 Aug 2026 20:10:09 +0800 Subject: [PATCH 2/3] add configurable ctrl and meta key prefixes for help bar --- README.md | 18 ++++++++++++++++++ lib/common/src/version.h | 2 +- src/nchat.1 | 2 +- src/uiconfig.cpp | 2 ++ src/uihelpview.cpp | 15 +++++---------- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0daa6742..85c3a854 100644 --- a/README.md +++ b/README.md @@ -492,6 +492,8 @@ This configuration file holds general user interface settings. Default content: file_picker_command= file_picker_persist_dir=1 help_enabled=1 + help_prefix_ctrl=^ + help_prefix_meta=M- home_fetch_all=0 linefeed_on_enter=1 link_open_command= @@ -695,6 +697,22 @@ last selected file. Specifies whether to display help bar. Controlled by Ctrl-g in run-time. +### help_prefix_ctrl + +Specifies the prefix used in the help bar for control key combinations, +i.e. `^` results in `^g` being displayed for Ctrl-g. Users on macOS may +prefer the Apple modifier symbol `⌃` here. + +### help_prefix_meta + +Specifies the prefix used in the help bar for meta / alt key combinations, +i.e. `M-` results in `M-/` being displayed for Alt-/. Users on macOS may +prefer the Apple modifier symbol `⌥` here. Other alternatives include +`A-` and `Alt-`. + +Note that these prefixes are only cosmetic, the actual key bindings are +configured in `key.conf`. + ### home_fetch_all Specifies whether `home` button shall repeatedly fetch all chat history. diff --git a/lib/common/src/version.h b/lib/common/src/version.h index 7db910b3..c4f4dc9d 100644 --- a/lib/common/src/version.h +++ b/lib/common/src/version.h @@ -7,4 +7,4 @@ #pragma once -#define NCHAT_VERSION "5.18.18" +#define NCHAT_VERSION "5.18.19" diff --git a/src/nchat.1 b/src/nchat.1 index 40bd3047..ce16f910 100644 --- a/src/nchat.1 +++ b/src/nchat.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH NCHAT "1" "August 2026" "nchat 5.18.18" "User Commands" +.TH NCHAT "1" "August 2026" "nchat 5.18.19" "User Commands" .SH NAME nchat \- ncurses chat .SH SYNOPSIS diff --git a/src/uiconfig.cpp b/src/uiconfig.cpp index 43c54956..a852e2b4 100644 --- a/src/uiconfig.cpp +++ b/src/uiconfig.cpp @@ -44,6 +44,8 @@ void UiConfig::Init() { "file_picker_command", "" }, { "file_picker_persist_dir", "1" }, { "help_enabled", "1" }, + { "help_prefix_ctrl", "^" }, + { "help_prefix_meta", "M-" }, { "home_fetch_all", "0" }, { "linefeed_on_enter", "1" }, { "link_open_command", "" }, diff --git a/src/uihelpview.cpp b/src/uihelpview.cpp index 0a04d0d2..32e8e829 100644 --- a/src/uihelpview.cpp +++ b/src/uihelpview.cpp @@ -11,6 +11,7 @@ #include "strutil.h" #include "uicolorconfig.h" +#include "uiconfig.h" #include "uikeyconfig.h" #include "uimodel.h" @@ -270,22 +271,16 @@ std::string UiHelpView::GetKeyDisplay(const std::string& p_Func) const std::string keyName = UiKeyConfig::GetStr(p_Func); if ((keyName.size() == 9) && (keyName >= "KEY_CTRLA") && (keyName <= "KEY_CTRLZ")) { -#if defined(__APPLE__) - return "\xe2\x8c\x83" + keyName.substr(8, 1); // ⌃ -#else - return "^" + keyName.substr(8, 1); // ^ -#endif + static const std::string helpPrefixCtrl = UiConfig::GetStr("help_prefix_ctrl"); + return helpPrefixCtrl + keyName.substr(8, 1); } else if (std::count(keyName.begin(), keyName.end(), '\\') == 2) { const std::string keyStr = StrUtil::StrFromOct(keyName); if ((keyStr.size() == 2) && (keyStr.at(0) == '\33') && StrUtil::IsValidTextKey(keyStr.at(1))) { -#if defined(__APPLE__) - return "\xe2\x8c\xa5" + keyStr.substr(1); // ⌥ -#else - return "M-" + keyStr.substr(1); // M- -#endif + static const std::string helpPrefixMeta = UiConfig::GetStr("help_prefix_meta"); + return helpPrefixMeta + keyStr.substr(1); } } else if (keyName == "KEY_RETURN") From 44ad95578372b5cc4771c4cdb56592f7a428b8d4 Mon Sep 17 00:00:00 2001 From: Kristofer Berggren Date: Sat, 8 Aug 2026 20:13:13 +0800 Subject: [PATCH 3/3] Follow-up to 42aa10b - Improved Ctrl example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85c3a854..07db5c32 100644 --- a/README.md +++ b/README.md @@ -700,7 +700,7 @@ Specifies whether to display help bar. Controlled by Ctrl-g in run-time. ### help_prefix_ctrl Specifies the prefix used in the help bar for control key combinations, -i.e. `^` results in `^g` being displayed for Ctrl-g. Users on macOS may +i.e. `^` results in `^X` being displayed for Ctrl-X. Users on macOS may prefer the Apple modifier symbol `⌃` here. ### help_prefix_meta