From 14b74fe51d18a11c3c04df5a550259b1344afd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 09:06:23 +0800 Subject: [PATCH 01/28] Doc: update issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7b3260a5e..a8884aa15 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -19,7 +19,10 @@ assignees: '' # Often helpful information: -The content of the configuration file you use (if any) +Screenshot: + + +The content of the configuration file you use (if any): ``` //paste here ``` From 31b3fe403a451a68581c2e0bce3077438c8a2f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 09:07:38 +0800 Subject: [PATCH 02/28] Wifi (Linux): remove trailing `\n` Fix #697 --- src/detection/wifi/wifi_linux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/detection/wifi/wifi_linux.c b/src/detection/wifi/wifi_linux.c index 34af04fd4..d9788c994 100644 --- a/src/detection/wifi/wifi_linux.c +++ b/src/detection/wifi/wifi_linux.c @@ -250,7 +250,11 @@ static const char* detectWifiWithIoctls(FFlist* result) item->conn.txRate = 0.0/0.0; ffStrbufSetF(&path, "/sys/class/net/%s/operstate", i->if_name); - if (!ffAppendFileBuffer(path.chars, &item->inf.status) || !ffStrbufEqualS(&item->inf.status, "up\n")) + if (!ffAppendFileBuffer(path.chars, &item->inf.status)) + continue; + + ffStrbufTrimRightSpace(&item->inf.status); + if (!ffStrbufEqualS(&item->inf.status, "up")) continue; FF_AUTO_CLOSE_FD int sock = socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); From a9a5790cba940b62ecf78a906bce5d3781539e6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 10:20:50 +0800 Subject: [PATCH 03/28] TerminalShell (Linux): improve terminal detection by env --- .../terminalfont/terminalfont_linux.c | 2 +- src/detection/terminalshell/terminalshell.c | 2 +- .../terminalshell/terminalshell_linux.c | 79 ++++++++++++++----- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/src/detection/terminalfont/terminalfont_linux.c b/src/detection/terminalfont/terminalfont_linux.c index 8f163418e..b4bd5e36f 100644 --- a/src/detection/terminalfont/terminalfont_linux.c +++ b/src/detection/terminalfont/terminalfont_linux.c @@ -315,7 +315,7 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo detectFromConfigFile("lxterminal/lxterminal.conf", "fontname =", terminalFont); else if(ffStrbufIgnCaseEqualS(&terminal->processName, "tilix")) detectFromGSettings("/com/gexperts/Tilix/profiles/", "com.gexperts.Tilix.ProfilesList", "com.gexperts.Tilix.Profile", "default", terminalFont); - else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal-")) + else if(ffStrbufStartsWithIgnCaseS(&terminal->processName, "gnome-terminal")) detectFromGSettings("/org/gnome/terminal/legacy/profiles:/:", "org.gnome.Terminal.ProfilesList", "org.gnome.Terminal.Legacy.Profile", "default", terminalFont); else if(ffStrbufIgnCaseEqualS(&terminal->processName, "kgx")) detectKgx(terminalFont); diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 78c309766..f9a41c42c 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -440,7 +440,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe #if defined(__linux__) || defined(__FreeBSD__) - if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal-")) + if(ffStrbufStartsWithIgnCaseS(processName, "gnome-terminal")) return getTerminalVersionGnome(version); if(ffStrbufIgnCaseEqualS(processName, "konsole")) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index c83dffde4..7b2499279 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -297,6 +297,21 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid) return ppid; } +static bool getTerminalInfoByPidEnv(FFTerminalResult* result, const char* pidEnv) +{ + pid_t pid = (pid_t) strtol(getenv(pidEnv), NULL, 10); + result->pid = (uint32_t) pid; + char name[256]; + if (getProcessNameAndPpid(pid, name, (pid_t*) &result->ppid, NULL) == NULL) + { + ffStrbufSetS(&result->processName, name); + getProcessInformation(pid, &result->processName, &result->exe, &result->exeName, &result->exePath); + return true; + } + + return false; +} + static void getTerminalFromEnv(FFTerminalResult* result) { if( @@ -319,58 +334,80 @@ static void getTerminalFromEnv(FFTerminalResult* result) const char* term = NULL; //SSH - if(getenv("SSH_CONNECTION") != NULL) + if( + getenv("SSH_TTY") != NULL + ) term = getenv("SSH_TTY"); + else if( + getenv("KITTY_PID") != NULL || + getenv("KITTY_INSTALLATION_DIR") != NULL + ) + { + if (getTerminalInfoByPidEnv(result, "KITTY_PID")) + return; + term = "kitty"; + } - #ifdef __linux__ + #ifdef __linux__ // WSL //Windows Terminal - if(!ffStrSet(term) && ( + else if( getenv("WT_SESSION") != NULL || getenv("WT_PROFILE_ID") != NULL - )) term = "Windows Terminal"; + ) term = "Windows Terminal"; //ConEmu - if(!ffStrSet(term) && ( + else if( getenv("ConEmuPID") != NULL - )) term = "ConEmu"; + ) term = "ConEmu"; #endif //Alacritty - if(!ffStrSet(term) && ( + else if( getenv("ALACRITTY_SOCKET") != NULL || getenv("ALACRITTY_LOG") != NULL || getenv("ALACRITTY_WINDOW_ID") != NULL - )) term = "Alacritty"; + ) term = "Alacritty"; #ifdef __ANDROID__ //Termux - if(!ffStrSet(term) && ( + else if( getenv("TERMUX_VERSION") != NULL || getenv("TERMUX_MAIN_PACKAGE_FORMAT") != NULL - )) term = "com.termux"; + ) + { + if (getTerminalInfoByPidEnv(result, "TERMUX_APP__PID")) + return; + term = "com.termux"; + } #endif - #ifdef __linux__ + #if defined(__linux__) || defined(__FreeBSD__) //Konsole - if(!ffStrSet(term) && ( + else if( getenv("KONSOLE_VERSION") != NULL - )) term = "konsole"; + ) term = "konsole"; + + else if( + getenv("GNOME_TERMINAL_SCREEN") != NULL || + getenv("GNOME_TERMINAL_SERVICE") != NULL + ) term = "gnome-terminal"; #endif //MacOS, mintty - if(!ffStrSet(term)) + else if(getenv("TERM_PROGRAM") != NULL) term = getenv("TERM_PROGRAM"); - if(!ffStrSet(term)) + else if(getenv("LC_TERMINAL") != NULL) term = getenv("LC_TERMINAL"); //Normal Terminal - if(!ffStrSet(term)) + else + { term = getenv("TERM"); - - //TTY - if(!ffStrSet(term) || ffStrEquals(term, "linux")) - term = ttyname(STDIN_FILENO); + //TTY + if(!ffStrSet(term) || ffStrEquals(term, "linux")) + term = ttyname(STDIN_FILENO); + } if(ffStrSet(term)) { @@ -437,7 +474,7 @@ static void setTerminalInfoDetails(FFTerminalResult* result) #elif defined(__linux__) || defined(__FreeBSD__) - else if(ffStrbufStartsWithS(&result->processName, "gnome-terminal-")) + else if(ffStrbufStartsWithS(&result->processName, "gnome-terminal")) ffStrbufInitStatic(&result->prettyName, "GNOME Terminal"); else if(ffStrbufStartsWithS(&result->processName, "kgx")) ffStrbufInitStatic(&result->prettyName, "GNOME Console"); From 994fd359a53d80193a40c1865972d103b55afc86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 10:34:45 +0800 Subject: [PATCH 04/28] Terminal (Linux): fix kgx version detection --- src/detection/terminalshell/terminalshell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index f9a41c42c..e42c6099e 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -281,7 +281,7 @@ FF_MAYBE_UNUSED static bool getTerminalVersionGnome(FFstrbuf* version) FF_MAYBE_UNUSED static bool getTerminalVersionKgx(FFstrbuf* version) { if(ffProcessAppendStdOut(version, (char* const[]){ - "gnome-terminal", + "kgx", "--version", NULL })) return false; From a5d5de90f887663224bd80a5e1fe5362cd576074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 14:33:55 +0800 Subject: [PATCH 05/28] Terminal (Linux): support screen version detection --- src/detection/terminalshell/terminalshell.c | 12 ++++++++++++ src/detection/terminalshell/terminalshell_linux.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index e42c6099e..f4e56a124 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -400,6 +400,15 @@ static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version) return version->length > 0; } +static bool getTerminalVersionScreen(FFstrbuf* exe, FFstrbuf* version) +{ + if(!getExeVersionRaw(exe, version)) return false; + // Screen version 4.09.01 (GNU) 20-Aug-23 + ffStrbufSubstrAfter(version, strlen("Screen version ") - 1); + ffStrbufSubstrBeforeFirstC(version, ' '); + return version->length > 0; +} + #ifdef _WIN32 static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version) @@ -511,6 +520,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe if(ffStrbufStartsWithIgnCaseS(processName, "contour")) return getTerminalVersionContour(exe, version); + if(ffStrbufStartsWithIgnCaseS(processName, "screen")) + return getTerminalVersionScreen(exe, version); + const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION"); if(termProgramVersion) { diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 7b2499279..c8c500ee3 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -466,6 +466,8 @@ static void setTerminalInfoDetails(FFTerminalResult* result) ffStrbufInitStatic(&result->prettyName, "WezTerm"); else if(ffStrbufStartsWithS(&result->processName, "tmux:")) ffStrbufInitStatic(&result->prettyName, "tmux"); + else if(ffStrbufStartsWithS(&result->processName, "screen-")) + ffStrbufInitStatic(&result->prettyName, "screen"); #if defined(__ANDROID__) From fa8c99601c9520286eb2257018089ef8587d312c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 14:34:19 +0800 Subject: [PATCH 06/28] TerminalSize: tidy --- src/detection/terminalsize/terminalsize_linux.c | 4 ++-- src/detection/terminalsize/terminalsize_windows.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/detection/terminalsize/terminalsize_linux.c b/src/detection/terminalsize/terminalsize_linux.c index 68a75cbb2..b15939661 100644 --- a/src/detection/terminalsize/terminalsize_linux.c +++ b/src/detection/terminalsize/terminalsize_linux.c @@ -10,10 +10,10 @@ bool ffDetectTerminalSize(FFTerminalSizeResult* result) ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize); if (winsize.ws_row == 0 || winsize.ws_col == 0) - ffGetTerminalResponse("\033[18t", "\033[8;%hu;%hut", &winsize.ws_row, &winsize.ws_col); + ffGetTerminalResponse("\e[18t", "\e[8;%hu;%hut", &winsize.ws_row, &winsize.ws_col); if (winsize.ws_ypixel == 0 || winsize.ws_xpixel == 0) - ffGetTerminalResponse("\033[14t", "\033[4;%hu;%hut", &winsize.ws_ypixel, &winsize.ws_xpixel); + ffGetTerminalResponse("\e[14t", "\e[4;%hu;%hut", &winsize.ws_ypixel, &winsize.ws_xpixel); if (winsize.ws_row == 0 && winsize.ws_col == 0) return false; diff --git a/src/detection/terminalsize/terminalsize_windows.c b/src/detection/terminalsize/terminalsize_windows.c index a0b554517..4d2f6c83d 100644 --- a/src/detection/terminalsize/terminalsize_windows.c +++ b/src/detection/terminalsize/terminalsize_windows.c @@ -14,7 +14,7 @@ bool ffDetectTerminalSize(FFTerminalSizeResult* result) } else { - ffGetTerminalResponse("\033[18t", "\033[8;%hu;%hut", &result->rows, &result->columns); + ffGetTerminalResponse("\e[18t", "\e[8;%hu;%hut", &result->rows, &result->columns); } } From ec6195133b9fe6b01a8a5123c905eb6aed8d4256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 16:03:32 +0800 Subject: [PATCH 07/28] TerminalTheme: add new module --- CMakeLists.txt | 2 + src/common/modules.c | 1 + src/detection/terminaltheme/terminaltheme.c | 91 +++++++++++++ src/detection/terminaltheme/terminaltheme.h | 19 +++ src/modules/modules.h | 1 + src/modules/options.h | 1 + src/modules/terminaltheme/option.h | 11 ++ src/modules/terminaltheme/terminaltheme.c | 134 ++++++++++++++++++++ src/modules/terminaltheme/terminaltheme.h | 9 ++ src/options/modules.c | 6 +- src/options/modules.h | 3 +- 11 files changed, 275 insertions(+), 3 deletions(-) create mode 100644 src/detection/terminaltheme/terminaltheme.c create mode 100644 src/detection/terminaltheme/terminaltheme.h create mode 100644 src/modules/terminaltheme/option.h create mode 100644 src/modules/terminaltheme/terminaltheme.c create mode 100644 src/modules/terminaltheme/terminaltheme.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0834a2d6c..fb5da6f14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -293,6 +293,7 @@ set(LIBFASTFETCH_SRC src/detection/os/os.c src/detection/packages/packages.c src/detection/publicip/publicip.c + src/detection/terminaltheme/terminaltheme.c src/detection/terminalfont/terminalfont.c src/detection/terminalshell/terminalshell.c src/detection/version/version.c @@ -348,6 +349,7 @@ set(LIBFASTFETCH_SRC src/modules/swap/swap.c src/modules/media/media.c src/modules/terminal/terminal.c + src/modules/terminaltheme/terminaltheme.c src/modules/terminalfont/terminalfont.c src/modules/terminalsize/terminalsize.c src/modules/theme/theme.c diff --git a/src/common/modules.c b/src/common/modules.c index 580e946f6..fa486261f 100644 --- a/src/common/modules.c +++ b/src/common/modules.c @@ -124,6 +124,7 @@ static FFModuleBaseInfo* T[] = { (void*) &instance.config.modules.terminal, (void*) &instance.config.modules.terminalFont, (void*) &instance.config.modules.terminalSize, + (void*) &instance.config.modules.terminalTheme, (void*) &instance.config.modules.title, (void*) &instance.config.modules.theme, NULL, diff --git a/src/detection/terminaltheme/terminaltheme.c b/src/detection/terminaltheme/terminaltheme.c new file mode 100644 index 000000000..845eec637 --- /dev/null +++ b/src/detection/terminaltheme/terminaltheme.c @@ -0,0 +1,91 @@ +#include "terminaltheme.h" +#include "common/io/io.h" +#include "util/stringUtils.h" + +#include + +static bool detectByEscapeCode(FFTerminalThemeResult* result) +{ + int command = 0; + + if (ffGetTerminalResponse("\e]10;?\e\\", "\e]%d;rgb:%" SCNx16 "/%" SCNx16 "/%" SCNx16 "\e\\", &command, &result->fg.r, &result->fg.g, &result->fg.b) == NULL) + { + if (command != 10) + return false; + if (result->fg.r > 0x0100 || result->fg.g > 0x0100 || result->fg.b > 0x0100) + result->fg.r /= 0x0100, result->fg.g /= 0x0100, result->fg.b /= 0x0100; + } + else + return false; + + if (ffGetTerminalResponse("\e]11;?\e\\", "\e]%d;rgb:%" SCNx16 "/%" SCNx16 "/%" SCNx16 "\e\\", &command, &result->bg.r, &result->bg.g, &result->bg.b) == NULL) + { + if (command != 11) + return false; + if (result->bg.r > 0x0100 || result->bg.g > 0x0100 || result->bg.b > 0x0100) + result->bg.r /= 0x0100, result->bg.g /= 0x0100, result->bg.b /= 0x0100; + } + else + return false; + + return true; +} + +static FFTerminalThemeColor fgbgToColor(int num) +{ + // https://github.com/dalance/termbg/blob/13c478a433fa182e65c401d26a1e7792a7f7f453/src/lib.rs#L251 + switch (num) + { + case 0: return (FFTerminalThemeColor){ 0, 0, 0, false}; // black + case 1: return (FFTerminalThemeColor){205, 0, 0, false}; // red + case 2: return (FFTerminalThemeColor){ 0, 205, 0, false}; // green + case 3: return (FFTerminalThemeColor){205, 205, 0, false}; // yellow + case 4: return (FFTerminalThemeColor){ 0, 0, 238, false}; // blue + case 5: return (FFTerminalThemeColor){205, 0, 205, false}; // magenta + case 6: return (FFTerminalThemeColor){ 0, 205, 205, false}; // cyan + case 7: return (FFTerminalThemeColor){229, 229, 229, false}; // white + + case 8: return (FFTerminalThemeColor){127, 127, 127, false}; // bright black + case 9: return (FFTerminalThemeColor){255, 0, 0, false}; // bright red + case 10: return (FFTerminalThemeColor){ 0, 255, 0, false}; // bright green + case 11: return (FFTerminalThemeColor){255, 255, 0, false}; // bright yellow + case 12: return (FFTerminalThemeColor){ 92, 92, 255, false}; // bright blue + case 13: return (FFTerminalThemeColor){255, 0, 255, false}; // bright magenta + case 14: return (FFTerminalThemeColor){ 0, 255, 255, false}; // bright cyan + case 15: return (FFTerminalThemeColor){255, 255, 255, false}; // bright white + + default: return (FFTerminalThemeColor){ 0, 0, 0, false}; // invalid + } +} + +static bool detectByEnv(FFTerminalThemeResult* result) +{ + const char* color = getenv("COLORFGBG"); // 7;0 + + if (!ffStrSet(color)) + return false; + + int f, g; + if (sscanf(color, "%d;%d", &f, &g) != 2) + return false; + + result->fg = fgbgToColor(f); + result->bg = fgbgToColor(g); + return true; +} + +static inline bool detectColor(FFTerminalThemeResult* result) +{ + if (detectByEscapeCode(result)) + return true; + + return detectByEnv(result); +} + +bool ffDetectTerminalTheme(FFTerminalThemeResult* result) +{ + if (!detectColor(result)) return false; + result->fg.dark = result->fg.r * 299 + result->fg.g * 587 + result->fg.b * 114 < 128000; + result->bg.dark = result->bg.r * 299 + result->bg.g * 587 + result->bg.b * 114 < 128000; + return true; +} diff --git a/src/detection/terminaltheme/terminaltheme.h b/src/detection/terminaltheme/terminaltheme.h new file mode 100644 index 000000000..08bb4ea0f --- /dev/null +++ b/src/detection/terminaltheme/terminaltheme.h @@ -0,0 +1,19 @@ +#pragma once + +#include "fastfetch.h" + +typedef struct FFTerminalThemeColor +{ + uint16_t r; + uint16_t g; + uint16_t b; + bool dark; +} FFTerminalThemeColor; + +typedef struct FFTerminalThemeResult +{ + FFTerminalThemeColor fg; + FFTerminalThemeColor bg; +} FFTerminalThemeResult; + +bool ffDetectTerminalTheme(FFTerminalThemeResult* result); diff --git a/src/modules/modules.h b/src/modules/modules.h index 35d6523c4..78fe2f33b 100644 --- a/src/modules/modules.h +++ b/src/modules/modules.h @@ -49,6 +49,7 @@ #include "modules/terminal/terminal.h" #include "modules/terminalfont/terminalfont.h" #include "modules/terminalsize/terminalsize.h" +#include "modules/terminaltheme/terminaltheme.h" #include "modules/theme/theme.h" #include "modules/title/title.h" #include "modules/uptime/uptime.h" diff --git a/src/modules/options.h b/src/modules/options.h index aa124c24a..54dd7ca15 100644 --- a/src/modules/options.h +++ b/src/modules/options.h @@ -49,6 +49,7 @@ #include "modules/terminal/option.h" #include "modules/terminalfont/option.h" #include "modules/terminalsize/option.h" +#include "modules/terminaltheme/option.h" #include "modules/theme/option.h" #include "modules/title/option.h" #include "modules/uptime/option.h" diff --git a/src/modules/terminaltheme/option.h b/src/modules/terminaltheme/option.h new file mode 100644 index 000000000..aecbe18d7 --- /dev/null +++ b/src/modules/terminaltheme/option.h @@ -0,0 +1,11 @@ +#pragma once + +// This file will be included in "fastfetch.h", do NOT put unnecessary things here + +#include "common/option.h" + +typedef struct FFTerminalThemeOptions +{ + FFModuleBaseInfo moduleInfo; + FFModuleArgs moduleArgs; +} FFTerminalThemeOptions; diff --git a/src/modules/terminaltheme/terminaltheme.c b/src/modules/terminaltheme/terminaltheme.c new file mode 100644 index 000000000..43e76c65c --- /dev/null +++ b/src/modules/terminaltheme/terminaltheme.c @@ -0,0 +1,134 @@ +#include "common/printing.h" +#include "common/jsonconfig.h" +#include "detection/terminaltheme/terminaltheme.h" +#include "modules/terminaltheme/terminaltheme.h" +#include "util/stringUtils.h" + +#include + +#define FF_TERMINALTHEME_DISPLAY_NAME "Terminal Theme" +#define FF_TERMINALTHEME_NUM_FORMAT_ARGS 4 + +void ffPrintTerminalTheme(FFTerminalThemeOptions* options) +{ + FFTerminalThemeResult result = {}; + + if(!ffDetectTerminalTheme(&result)) + { + ffPrintError(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, "Failed to detect terminal theme"); + } + else + { + if(options->moduleArgs.outputFormat.length == 0) + { + ffPrintLogoAndKey(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + printf("#%02" PRIX16 "%02" PRIX16 "%02" PRIX16 " (FG) - #%02" PRIX16 "%02" PRIX16 "%02" PRIX16 " (BG) [%s]\n", + result.fg.r, result.fg.g, result.fg.b, + result.bg.r, result.bg.g, result.bg.b, + result.bg.dark ? "Dark" : "Light"); + } + else + { + char fg[32], bg[32]; + snprintf(fg, sizeof(fg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.fg.r, result.fg.g, result.fg.b); + snprintf(bg, sizeof(bg), "#%02" PRIX16 "%02" PRIX16 "%02" PRIX16, result.bg.r, result.bg.g, result.bg.b); + ffPrintFormat(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, FF_TERMINALTHEME_NUM_FORMAT_ARGS, (FFformatarg[]){ + {FF_FORMAT_ARG_TYPE_STRING, fg}, + {FF_FORMAT_ARG_TYPE_STRING, result.fg.dark ? "Dark" : "Light"}, + {FF_FORMAT_ARG_TYPE_STRING, bg}, + {FF_FORMAT_ARG_TYPE_STRING, result.bg.dark ? "Dark" : "Light"}, + }); + } + } +} + +bool ffParseTerminalThemeCommandOptions(FFTerminalThemeOptions* options, const char* key, const char* value) +{ + const char* subKey = ffOptionTestPrefix(key, FF_TERMINALTHEME_MODULE_NAME); + if (!subKey) return false; + if (ffOptionParseModuleArgs(key, subKey, value, &options->moduleArgs)) + return true; + + return false; +} + +void ffParseTerminalThemeJsonObject(FFTerminalThemeOptions* options, yyjson_val* module) +{ + yyjson_val *key_, *val; + size_t idx, max; + yyjson_obj_foreach(module, idx, max, key_, val) + { + const char* key = yyjson_get_str(key_); + if(ffStrEqualsIgnCase(key, "type")) + continue; + + if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) + continue; + + ffPrintError(FF_TERMINALTHEME_DISPLAY_NAME, 0, &options->moduleArgs, "Unknown JSON key %s", key); + } +} + +void ffGenerateTerminalThemeJsonConfig(FFTerminalThemeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) +{ + __attribute__((__cleanup__(ffDestroyTerminalThemeOptions))) FFTerminalThemeOptions defaultOptions; + ffInitTerminalThemeOptions(&defaultOptions); + + ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs); +} + +void ffGenerateTerminalThemeJsonResult(FF_MAYBE_UNUSED FFTerminalOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) +{ + FFTerminalThemeResult result = {}; + + if(!ffDetectTerminalTheme(&result)) + { + yyjson_mut_obj_add_str(doc, module, "error", "Failed to detect terminal theme"); + return; + } + + yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, module, "result"); + + yyjson_mut_val* fg = yyjson_mut_obj_add_obj(doc, obj, "fg"); + yyjson_mut_obj_add_uint(doc, fg, "r", result.fg.r); + yyjson_mut_obj_add_uint(doc, fg, "g", result.fg.g); + yyjson_mut_obj_add_uint(doc, fg, "b", result.fg.b); + yyjson_mut_obj_add_bool(doc, fg, "dark", result.fg.dark); + + yyjson_mut_val* bg = yyjson_mut_obj_add_obj(doc, obj, "bg"); + yyjson_mut_obj_add_uint(doc, bg, "r", result.bg.r); + yyjson_mut_obj_add_uint(doc, bg, "g", result.bg.g); + yyjson_mut_obj_add_uint(doc, bg, "b", result.bg.b); + yyjson_mut_obj_add_bool(doc, bg, "dark", result.bg.dark); +} + +void ffPrintTerminalThemeHelpFormat(void) +{ + ffPrintModuleFormatHelp(FF_TERMINALTHEME_MODULE_NAME, "{1} (FG) {3} (BG) [{4}]", FF_TERMINALTHEME_NUM_FORMAT_ARGS, (const char* []) { + "Terminal foreground color", + "Terminal foreground type (Dark / Light)", + "Terminal background color", + "Terminal background type (Dark / Light)", + }); +} + +void ffInitTerminalThemeOptions(FFTerminalThemeOptions* options) +{ + ffOptionInitModuleBaseInfo( + &options->moduleInfo, + FF_TERMINALTHEME_MODULE_NAME, + "Print current terminal theme (foreground and background colors)", + ffParseTerminalThemeCommandOptions, + ffParseTerminalThemeJsonObject, + ffPrintTerminalTheme, + ffGenerateTerminalThemeJsonResult, + ffPrintTerminalThemeHelpFormat, + ffGenerateTerminalThemeJsonConfig + ); + ffOptionInitModuleArg(&options->moduleArgs); +} + +void ffDestroyTerminalThemeOptions(FFTerminalThemeOptions* options) +{ + ffOptionDestroyModuleArg(&options->moduleArgs); +} diff --git a/src/modules/terminaltheme/terminaltheme.h b/src/modules/terminaltheme/terminaltheme.h new file mode 100644 index 000000000..fb5cbb58a --- /dev/null +++ b/src/modules/terminaltheme/terminaltheme.h @@ -0,0 +1,9 @@ +#pragma once + +#include "fastfetch.h" + +#define FF_TERMINALTHEME_MODULE_NAME "TerminalTheme" + +void ffPrintTerminalTheme(FFTerminalThemeOptions* options); +void ffInitTerminalThemeOptions(FFTerminalThemeOptions* options); +void ffDestroyTerminalThemeOptions(FFTerminalThemeOptions* options); diff --git a/src/options/modules.c b/src/options/modules.c index 68b835d82..bc636ff0c 100644 --- a/src/options/modules.c +++ b/src/options/modules.c @@ -47,9 +47,10 @@ void ffOptionsInitModules(FFOptionsModules* options) ffInitShellOptions(&options->shell); ffInitSoundOptions(&options->sound); ffInitSwapOptions(&options->swap); - ffInitTerminalFontOptions(&options->terminalFont); ffInitTerminalOptions(&options->terminal); + ffInitTerminalFontOptions(&options->terminalFont); ffInitTerminalSizeOptions(&options->terminalSize); + ffInitTerminalThemeOptions(&options->terminalTheme); ffInitThemeOptions(&options->theme); ffInitTitleOptions(&options->title); ffInitUptimeOptions(&options->uptime); @@ -109,9 +110,10 @@ void ffOptionsDestroyModules(FFOptionsModules* options) ffDestroyShellOptions(&options->shell); ffDestroySoundOptions(&options->sound); ffDestroySwapOptions(&options->swap); - ffDestroyTerminalFontOptions(&options->terminalFont); ffDestroyTerminalOptions(&options->terminal); + ffDestroyTerminalFontOptions(&options->terminalFont); ffDestroyTerminalSizeOptions(&options->terminalSize); + ffDestroyTerminalThemeOptions(&options->terminalTheme); ffDestroyThemeOptions(&options->theme); ffDestroyTitleOptions(&options->title); ffDestroyUptimeOptions(&options->uptime); diff --git a/src/options/modules.h b/src/options/modules.h index e9836e140..7a96a0f40 100644 --- a/src/options/modules.h +++ b/src/options/modules.h @@ -48,9 +48,10 @@ typedef struct FFOptionsModules FFShellOptions shell; FFSoundOptions sound; FFSwapOptions swap; - FFTerminalFontOptions terminalFont; FFTerminalOptions terminal; + FFTerminalFontOptions terminalFont; FFTerminalSizeOptions terminalSize; + FFTerminalThemeOptions terminalTheme; FFThemeOptions theme; FFTitleOptions title; FFUptimeOptions uptime; From bbf04f0d4081bec81242bade88d6da5cb005c158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 18:50:11 +0800 Subject: [PATCH 08/28] Doc: add TerminalTheme --- CHANGELOG.md | 5 +++++ doc/json_schema.json | 5 +++++ presets/all.jsonc | 1 + presets/ci.jsonc | 1 + src/fastfetch.c | 2 +- 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de29ac606..d01a10ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.6.4 + +Features: +* Add new module `TerminalTheme` + # 2.6.3 Bugfixes: diff --git a/doc/json_schema.json b/doc/json_schema.json index 88ffbec0b..ce10159d8 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -648,6 +648,7 @@ "terminal", "terminalfont", "terminalsize", + "terminaltheme", "title", "theme", "uptime", @@ -772,6 +773,10 @@ "const": "terminalsize", "description": "Print current terminal size" }, + { + "const": "terminaltheme", + "description": "Print current terminal theme (foreground and background colors)" + }, { "const": "theme", "description": "Print current theme of desktop environment" diff --git a/presets/all.jsonc b/presets/all.jsonc index 53b553aea..06a415963 100644 --- a/presets/all.jsonc +++ b/presets/all.jsonc @@ -28,6 +28,7 @@ "terminal", "terminalfont", "terminalsize", + "terminaltheme", "cpu", "cpuusage", "gpu", diff --git a/presets/ci.jsonc b/presets/ci.jsonc index 0283d9ec2..833f8a4d7 100644 --- a/presets/ci.jsonc +++ b/presets/ci.jsonc @@ -34,6 +34,7 @@ "terminal", "terminalfont", "terminalsize", + "terminaltheme", "cpu", "cpuusage", "gpu", diff --git a/src/fastfetch.c b/src/fastfetch.c index 68bcea67f..9fdfff513 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -300,7 +300,7 @@ static void listModules(bool pretty) { ++count; if (pretty) - printf("%d)%s%-13s: %s\n", count, count > 9 ? " " : " ", (*modules)->name, (*modules)->description); + printf("%d)%s%-14s: %s\n", count, count > 9 ? " " : " ", (*modules)->name, (*modules)->description); else printf("%s:%s\n", (*modules)->name, (*modules)->description); } From 5378d05bfbff2b4fca5768a8394d027015f95f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 22 Jan 2024 19:33:27 +0800 Subject: [PATCH 09/28] Doc: update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d01a10ccc..02c43f6c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ Features: * Add new module `TerminalTheme` +Bugfixes: +* Fix text formatting (Wifi, Linux) + # 2.6.3 Bugfixes: From 28ea765f193565c97e5c114910c429fb119d44ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 10:15:32 +0800 Subject: [PATCH 10/28] 3rdparty: use a newer wcwidch implementation --- CMakeLists.txt | 2 +- src/3rdparty/mk_wcwidch/repo.json | 7 - src/3rdparty/mk_wcwidch/wcwidth.c | 314 ----------------- src/3rdparty/wcwidch/repo.json | 6 + src/3rdparty/wcwidch/wcwidth.c | 543 ++++++++++++++++++++++++++++++ src/3rdparty/wcwidch/wcwidth.h | 12 + src/modules/separator/separator.c | 4 +- src/util/wcwidth.h | 19 +- 8 files changed, 573 insertions(+), 334 deletions(-) delete mode 100644 src/3rdparty/mk_wcwidch/repo.json delete mode 100644 src/3rdparty/mk_wcwidch/wcwidth.c create mode 100644 src/3rdparty/wcwidch/repo.json create mode 100644 src/3rdparty/wcwidch/wcwidth.c create mode 100644 src/3rdparty/wcwidch/wcwidth.h diff --git a/CMakeLists.txt b/CMakeLists.txt index fb5da6f14..62eab43e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -687,7 +687,7 @@ endif() include(CheckFunctionExists) check_function_exists(wcwidth HAVE_WCWIDTH) if(NOT HAVE_WCWIDTH) - list(APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c) + list(APPEND LIBFASTFETCH_SRC src/3rdparty/wcwidch/wcwidth.c) endif() if(ENABLE_SYSTEM_YYJSON) diff --git a/src/3rdparty/mk_wcwidch/repo.json b/src/3rdparty/mk_wcwidch/repo.json deleted file mode 100644 index 8a71b4b81..000000000 --- a/src/3rdparty/mk_wcwidch/repo.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "home": "https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c", - "license": "Embed in source", - "version": "2007-05-26 (Unicode 5.0)", - "author": "Markus Kuhn", - "modified": "CarterLi" -} diff --git a/src/3rdparty/mk_wcwidch/wcwidth.c b/src/3rdparty/mk_wcwidch/wcwidth.c deleted file mode 100644 index 7abd26f98..000000000 --- a/src/3rdparty/mk_wcwidch/wcwidth.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * This is an implementation of wcwidth() and wcswidth() (defined in - * IEEE Std 1002.1-2001) for Unicode. - * - * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html - * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html - * - * In fixed-width output devices, Latin characters all occupy a single - * "cell" position of equal width, whereas ideographic CJK characters - * occupy two such cells. Interoperability between terminal-line - * applications and (teletype-style) character terminals using the - * UTF-8 encoding requires agreement on which character should advance - * the cursor by how many cell positions. No established formal - * standards exist at present on which Unicode character shall occupy - * how many cell positions on character terminals. These routines are - * a first attempt of defining such behavior based on simple rules - * applied to data provided by the Unicode Consortium. - * - * For some graphical characters, the Unicode standard explicitly - * defines a character-cell width via the definition of the East Asian - * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. - * In all these cases, there is no ambiguity about which width a - * terminal shall use. For characters in the East Asian Ambiguous (A) - * class, the width choice depends purely on a preference of backward - * compatibility with either historic CJK or Western practice. - * Choosing single-width for these characters is easy to justify as - * the appropriate long-term solution, as the CJK practice of - * displaying these characters as double-width comes from historic - * implementation simplicity (8-bit encoded characters were displayed - * single-width and 16-bit ones double-width, even for Greek, - * Cyrillic, etc.) and not any typographic considerations. - * - * Much less clear is the choice of width for the Not East Asian - * (Neutral) class. Existing practice does not dictate a width for any - * of these characters. It would nevertheless make sense - * typographically to allocate two character cells to characters such - * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be - * represented adequately with a single-width glyph. The following - * routines at present merely assign a single-cell width to all - * neutral characters, in the interest of simplicity. This is not - * entirely satisfactory and should be reconsidered before - * establishing a formal standard in this area. At the moment, the - * decision which Not East Asian (Neutral) characters should be - * represented by double-width glyphs cannot yet be answered by - * applying a simple rule from the Unicode database content. Setting - * up a proper standard for the behavior of UTF-8 character terminals - * will require a careful analysis not only of each Unicode character, - * but also of each presentation form, something the author of these - * routines has avoided to do so far. - * - * http://www.unicode.org/unicode/reports/tr11/ - * - * Markus Kuhn -- 2007-05-26 (Unicode 5.0) - * - * Permission to use, copy, modify, and distribute this software - * for any purpose and without fee is hereby granted. The author - * disclaims all warranties with regard to this software. - * - * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c - */ - -#include - -struct interval { - int first; - int last; -}; - -/* auxiliary function for binary search in interval table */ -static int bisearch(wchar_t ucs, const struct interval *table, int max) { - int min = 0; - int mid; - - if (ucs < table[0].first || ucs > table[max].last) - return 0; - while (max >= min) { - mid = (min + max) / 2; - if (ucs > table[mid].last) - min = mid + 1; - else if (ucs < table[mid].first) - max = mid - 1; - else - return 1; - } - - return 0; -} - - -/* The following two functions define the column width of an ISO 10646 - * character as follows: - * - * - The null character (U+0000) has a column width of 0. - * - * - Other C0/C1 control characters and DEL will lead to a return - * value of -1. - * - * - Non-spacing and enclosing combining characters (general - * category code Mn or Me in the Unicode database) have a - * column width of 0. - * - * - SOFT HYPHEN (U+00AD) has a column width of 1. - * - * - Other format characters (general category code Cf in the Unicode - * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. - * - * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) - * have a column width of 0. - * - * - Spacing characters in the East Asian Wide (W) or East Asian - * Full-width (F) category as defined in Unicode Technical - * Report #11 have a column width of 2. - * - * - All remaining characters (including all printable - * ISO 8859-1 and WGL4 characters, Unicode control characters, - * etc.) have a column width of 1. - * - * This implementation assumes that wchar_t characters are encoded - * in ISO 10646. - */ - -int mk_wcwidth(wchar_t ucs) -{ - /* sorted list of non-overlapping intervals of non-spacing characters */ - /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ - static const struct interval combining[] = { - { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, - { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, - { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, - { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, - { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, - { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, - { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, - { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, - { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, - { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, - { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, - { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, - { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, - { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, - { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, - { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, - { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, - { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, - { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, - { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, - { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, - { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, - { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, - { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, - { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, - { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, - { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, - { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, - { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, - { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, - { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, - { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, - { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, - { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, - { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, - { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, - { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, - { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, - { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, - { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, - { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, - { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, - { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, - { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, - { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, - { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, - { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, - { 0xE0100, 0xE01EF } - }; - - /* test for 8-bit control characters */ - if (ucs == 0) - return 0; - if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) - return -1; - - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, combining, - sizeof(combining) / sizeof(struct interval) - 1)) - return 0; - - /* if we arrive here, ucs is not a combining or C0/C1 control character */ - - return 1 + - (ucs >= 0x1100 && - (ucs <= 0x115f || /* Hangul Jamo init. consonants */ - ucs == 0x2329 || ucs == 0x232a || - (ucs >= 0x2e80 && ucs <= 0xa4cf && - ucs != 0x303f) || /* CJK ... Yi */ - (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ - (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ - (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ - (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ - (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ - (ucs >= 0xffe0 && ucs <= 0xffe6) || - -#ifndef _WIN32 // sizeof(wchar_t) == 2 - (ucs >= 0x20000 && ucs <= 0x2fffd) || - (ucs >= 0x30000 && ucs <= 0x3fffd) || -#endif - 0 - )); -} - - -int mk_wcswidth(const wchar_t *pwcs, size_t n) -{ - int w, width = 0; - - for (;*pwcs && n-- > 0; pwcs++) - if ((w = mk_wcwidth(*pwcs)) < 0) - return -1; - else - width += w; - - return width; -} - - -/* - * The following functions are the same as mk_wcwidth() and - * mk_wcswidth(), except that spacing characters in the East Asian - * Ambiguous (A) category as defined in Unicode Technical Report #11 - * have a column width of 2. This variant might be useful for users of - * CJK legacy encodings who want to migrate to UCS without changing - * the traditional terminal character-width behaviour. It is not - * otherwise recommended for general use. - */ -int mk_wcwidth_cjk(wchar_t ucs) -{ - /* sorted list of non-overlapping intervals of East Asian Ambiguous - * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ - static const struct interval ambiguous[] = { - { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, - { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, - { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, - { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, - { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, - { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, - { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, - { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, - { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, - { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, - { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, - { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, - { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, - { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, - { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, - { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, - { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, - { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, - { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, - { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, - { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, - { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, - { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, - { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, - { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, - { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, - { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, - { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, - { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, - { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, - { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, - { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, - { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, - { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, - { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, - { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, - { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, - { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, - { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, - { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, - { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, - { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, - { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, - { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, - { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, - { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, - { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, - { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, - { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, - { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, - { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, - { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } - }; - - /* binary search in table of non-spacing characters */ - if (bisearch(ucs, ambiguous, - sizeof(ambiguous) / sizeof(struct interval) - 1)) - return 2; - - return mk_wcwidth(ucs); -} - - -int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) -{ - int w, width = 0; - - for (;*pwcs && n-- > 0; pwcs++) - if ((w = mk_wcwidth_cjk(*pwcs)) < 0) - return -1; - else - width += w; - - return width; -} diff --git a/src/3rdparty/wcwidch/repo.json b/src/3rdparty/wcwidch/repo.json new file mode 100644 index 000000000..24b6dc03c --- /dev/null +++ b/src/3rdparty/wcwidch/repo.json @@ -0,0 +1,6 @@ +{ + "home": "https://github.com/termux/wcwidth", + "license": "MIT", + "version": "Unicode 15", + "author": "termux" +} diff --git a/src/3rdparty/wcwidch/wcwidth.c b/src/3rdparty/wcwidch/wcwidth.c new file mode 100644 index 000000000..b62725b53 --- /dev/null +++ b/src/3rdparty/wcwidch/wcwidth.c @@ -0,0 +1,543 @@ +/* + * Copyright (C) Fredrik Fornwall 2016. + * Distributed under the MIT License. + * + * Implementation of wcwidth(3) as a C port of: + * https://github.com/jquast/wcwidth + * + * Report issues at: + * https://github.com/termux/wcwidth + * + * IMPORTANT: + * Must be kept in sync with the following: + * https://github.com/termux/termux-app/blob/master/terminal-emulator/src/main/java/com/termux/terminal/WcWidth.java + * https://github.com/termux/libandroid-support + * https://github.com/termux/termux-packages/tree/master/packages/libandroid-support + */ + +#include +#include + +struct width_interval { + int start; + int end; +}; + +// From https://github.com/jquast/wcwidth/blob/master/wcwidth/table_zero.py +// from https://github.com/jquast/wcwidth/pull/64 +// at commit 1b9b6585b0080ea5cb88dc9815796505724793fe (2022-12-16): +static struct width_interval ZERO_WIDTH[] = { + {0x00300, 0x0036f}, // Combining Grave Accent ..Combining Latin Small Le + {0x00483, 0x00489}, // Combining Cyrillic Titlo..Combining Cyrillic Milli + {0x00591, 0x005bd}, // Hebrew Accent Etnahta ..Hebrew Point Meteg + {0x005bf, 0x005bf}, // Hebrew Point Rafe ..Hebrew Point Rafe + {0x005c1, 0x005c2}, // Hebrew Point Shin Dot ..Hebrew Point Sin Dot + {0x005c4, 0x005c5}, // Hebrew Mark Upper Dot ..Hebrew Mark Lower Dot + {0x005c7, 0x005c7}, // Hebrew Point Qamats Qata..Hebrew Point Qamats Qata + {0x00610, 0x0061a}, // Arabic Sign Sallallahou ..Arabic Small Kasra + {0x0064b, 0x0065f}, // Arabic Fathatan ..Arabic Wavy Hamza Below + {0x00670, 0x00670}, // Arabic Letter Superscrip..Arabic Letter Superscrip + {0x006d6, 0x006dc}, // Arabic Small High Ligatu..Arabic Small High Seen + {0x006df, 0x006e4}, // Arabic Small High Rounde..Arabic Small High Madda + {0x006e7, 0x006e8}, // Arabic Small High Yeh ..Arabic Small High Noon + {0x006ea, 0x006ed}, // Arabic Empty Centre Low ..Arabic Small Low Meem + {0x00711, 0x00711}, // Syriac Letter Superscrip..Syriac Letter Superscrip + {0x00730, 0x0074a}, // Syriac Pthaha Above ..Syriac Barrekh + {0x007a6, 0x007b0}, // Thaana Abafili ..Thaana Sukun + {0x007eb, 0x007f3}, // Nko Combining Short High..Nko Combining Double Dot + {0x007fd, 0x007fd}, // Nko Dantayalan ..Nko Dantayalan + {0x00816, 0x00819}, // Samaritan Mark In ..Samaritan Mark Dagesh + {0x0081b, 0x00823}, // Samaritan Mark Epentheti..Samaritan Vowel Sign A + {0x00825, 0x00827}, // Samaritan Vowel Sign Sho..Samaritan Vowel Sign U + {0x00829, 0x0082d}, // Samaritan Vowel Sign Lon..Samaritan Mark Nequdaa + {0x00859, 0x0085b}, // Mandaic Affrication Mark..Mandaic Gemination Mark + {0x00898, 0x0089f}, // Arabic Small High Word A..Arabic Half Madda Over M + {0x008ca, 0x008e1}, // Arabic Small High Farsi ..Arabic Small High Sign S + {0x008e3, 0x00902}, // Arabic Turned Damma Belo..Devanagari Sign Anusvara + {0x0093a, 0x0093a}, // Devanagari Vowel Sign Oe..Devanagari Vowel Sign Oe + {0x0093c, 0x0093c}, // Devanagari Sign Nukta ..Devanagari Sign Nukta + {0x00941, 0x00948}, // Devanagari Vowel Sign U ..Devanagari Vowel Sign Ai + {0x0094d, 0x0094d}, // Devanagari Sign Virama ..Devanagari Sign Virama + {0x00951, 0x00957}, // Devanagari Stress Sign U..Devanagari Vowel Sign Uu + {0x00962, 0x00963}, // Devanagari Vowel Sign Vo..Devanagari Vowel Sign Vo + {0x00981, 0x00981}, // Bengali Sign Candrabindu..Bengali Sign Candrabindu + {0x009bc, 0x009bc}, // Bengali Sign Nukta ..Bengali Sign Nukta + {0x009c1, 0x009c4}, // Bengali Vowel Sign U ..Bengali Vowel Sign Vocal + {0x009cd, 0x009cd}, // Bengali Sign Virama ..Bengali Sign Virama + {0x009e2, 0x009e3}, // Bengali Vowel Sign Vocal..Bengali Vowel Sign Vocal + {0x009fe, 0x009fe}, // Bengali Sandhi Mark ..Bengali Sandhi Mark + {0x00a01, 0x00a02}, // Gurmukhi Sign Adak Bindi..Gurmukhi Sign Bindi + {0x00a3c, 0x00a3c}, // Gurmukhi Sign Nukta ..Gurmukhi Sign Nukta + {0x00a41, 0x00a42}, // Gurmukhi Vowel Sign U ..Gurmukhi Vowel Sign Uu + {0x00a47, 0x00a48}, // Gurmukhi Vowel Sign Ee ..Gurmukhi Vowel Sign Ai + {0x00a4b, 0x00a4d}, // Gurmukhi Vowel Sign Oo ..Gurmukhi Sign Virama + {0x00a51, 0x00a51}, // Gurmukhi Sign Udaat ..Gurmukhi Sign Udaat + {0x00a70, 0x00a71}, // Gurmukhi Tippi ..Gurmukhi Addak + {0x00a75, 0x00a75}, // Gurmukhi Sign Yakash ..Gurmukhi Sign Yakash + {0x00a81, 0x00a82}, // Gujarati Sign Candrabind..Gujarati Sign Anusvara + {0x00abc, 0x00abc}, // Gujarati Sign Nukta ..Gujarati Sign Nukta + {0x00ac1, 0x00ac5}, // Gujarati Vowel Sign U ..Gujarati Vowel Sign Cand + {0x00ac7, 0x00ac8}, // Gujarati Vowel Sign E ..Gujarati Vowel Sign Ai + {0x00acd, 0x00acd}, // Gujarati Sign Virama ..Gujarati Sign Virama + {0x00ae2, 0x00ae3}, // Gujarati Vowel Sign Voca..Gujarati Vowel Sign Voca + {0x00afa, 0x00aff}, // Gujarati Sign Sukun ..Gujarati Sign Two-circle + {0x00b01, 0x00b01}, // Oriya Sign Candrabindu ..Oriya Sign Candrabindu + {0x00b3c, 0x00b3c}, // Oriya Sign Nukta ..Oriya Sign Nukta + {0x00b3f, 0x00b3f}, // Oriya Vowel Sign I ..Oriya Vowel Sign I + {0x00b41, 0x00b44}, // Oriya Vowel Sign U ..Oriya Vowel Sign Vocalic + {0x00b4d, 0x00b4d}, // Oriya Sign Virama ..Oriya Sign Virama + {0x00b55, 0x00b56}, // Oriya Sign Overline ..Oriya Ai Length Mark + {0x00b62, 0x00b63}, // Oriya Vowel Sign Vocalic..Oriya Vowel Sign Vocalic + {0x00b82, 0x00b82}, // Tamil Sign Anusvara ..Tamil Sign Anusvara + {0x00bc0, 0x00bc0}, // Tamil Vowel Sign Ii ..Tamil Vowel Sign Ii + {0x00bcd, 0x00bcd}, // Tamil Sign Virama ..Tamil Sign Virama + {0x00c00, 0x00c00}, // Telugu Sign Combining Ca..Telugu Sign Combining Ca + {0x00c04, 0x00c04}, // Telugu Sign Combining An..Telugu Sign Combining An + {0x00c3c, 0x00c3c}, // Telugu Sign Nukta ..Telugu Sign Nukta + {0x00c3e, 0x00c40}, // Telugu Vowel Sign Aa ..Telugu Vowel Sign Ii + {0x00c46, 0x00c48}, // Telugu Vowel Sign E ..Telugu Vowel Sign Ai + {0x00c4a, 0x00c4d}, // Telugu Vowel Sign O ..Telugu Sign Virama + {0x00c55, 0x00c56}, // Telugu Length Mark ..Telugu Ai Length Mark + {0x00c62, 0x00c63}, // Telugu Vowel Sign Vocali..Telugu Vowel Sign Vocali + {0x00c81, 0x00c81}, // Kannada Sign Candrabindu..Kannada Sign Candrabindu + {0x00cbc, 0x00cbc}, // Kannada Sign Nukta ..Kannada Sign Nukta + {0x00cbf, 0x00cbf}, // Kannada Vowel Sign I ..Kannada Vowel Sign I + {0x00cc6, 0x00cc6}, // Kannada Vowel Sign E ..Kannada Vowel Sign E + {0x00ccc, 0x00ccd}, // Kannada Vowel Sign Au ..Kannada Sign Virama + {0x00ce2, 0x00ce3}, // Kannada Vowel Sign Vocal..Kannada Vowel Sign Vocal + {0x00d00, 0x00d01}, // Malayalam Sign Combining..Malayalam Sign Candrabin + {0x00d3b, 0x00d3c}, // Malayalam Sign Vertical ..Malayalam Sign Circular + {0x00d41, 0x00d44}, // Malayalam Vowel Sign U ..Malayalam Vowel Sign Voc + {0x00d4d, 0x00d4d}, // Malayalam Sign Virama ..Malayalam Sign Virama + {0x00d62, 0x00d63}, // Malayalam Vowel Sign Voc..Malayalam Vowel Sign Voc + {0x00d81, 0x00d81}, // Sinhala Sign Candrabindu..Sinhala Sign Candrabindu + {0x00dca, 0x00dca}, // Sinhala Sign Al-lakuna ..Sinhala Sign Al-lakuna + {0x00dd2, 0x00dd4}, // Sinhala Vowel Sign Ketti..Sinhala Vowel Sign Ketti + {0x00dd6, 0x00dd6}, // Sinhala Vowel Sign Diga ..Sinhala Vowel Sign Diga + {0x00e31, 0x00e31}, // Thai Character Mai Han-a..Thai Character Mai Han-a + {0x00e34, 0x00e3a}, // Thai Character Sara I ..Thai Character Phinthu + {0x00e47, 0x00e4e}, // Thai Character Maitaikhu..Thai Character Yamakkan + {0x00eb1, 0x00eb1}, // Lao Vowel Sign Mai Kan ..Lao Vowel Sign Mai Kan + {0x00eb4, 0x00ebc}, // Lao Vowel Sign I ..Lao Semivowel Sign Lo + {0x00ec8, 0x00ece}, // Lao Tone Mai Ek ..(nil) + {0x00f18, 0x00f19}, // Tibetan Astrological Sig..Tibetan Astrological Sig + {0x00f35, 0x00f35}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung + {0x00f37, 0x00f37}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung + {0x00f39, 0x00f39}, // Tibetan Mark Tsa -phru ..Tibetan Mark Tsa -phru + {0x00f71, 0x00f7e}, // Tibetan Vowel Sign Aa ..Tibetan Sign Rjes Su Nga + {0x00f80, 0x00f84}, // Tibetan Vowel Sign Rever..Tibetan Mark Halanta + {0x00f86, 0x00f87}, // Tibetan Sign Lci Rtags ..Tibetan Sign Yang Rtags + {0x00f8d, 0x00f97}, // Tibetan Subjoined Sign L..Tibetan Subjoined Letter + {0x00f99, 0x00fbc}, // Tibetan Subjoined Letter..Tibetan Subjoined Letter + {0x00fc6, 0x00fc6}, // Tibetan Symbol Padma Gda..Tibetan Symbol Padma Gda + {0x0102d, 0x01030}, // Myanmar Vowel Sign I ..Myanmar Vowel Sign Uu + {0x01032, 0x01037}, // Myanmar Vowel Sign Ai ..Myanmar Sign Dot Below + {0x01039, 0x0103a}, // Myanmar Sign Virama ..Myanmar Sign Asat + {0x0103d, 0x0103e}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M + {0x01058, 0x01059}, // Myanmar Vowel Sign Vocal..Myanmar Vowel Sign Vocal + {0x0105e, 0x01060}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M + {0x01071, 0x01074}, // Myanmar Vowel Sign Geba ..Myanmar Vowel Sign Kayah + {0x01082, 0x01082}, // Myanmar Consonant Sign S..Myanmar Consonant Sign S + {0x01085, 0x01086}, // Myanmar Vowel Sign Shan ..Myanmar Vowel Sign Shan + {0x0108d, 0x0108d}, // Myanmar Sign Shan Counci..Myanmar Sign Shan Counci + {0x0109d, 0x0109d}, // Myanmar Vowel Sign Aiton..Myanmar Vowel Sign Aiton + {0x0135d, 0x0135f}, // Ethiopic Combining Gemin..Ethiopic Combining Gemin + {0x01712, 0x01714}, // Tagalog Vowel Sign I ..Tagalog Sign Virama + {0x01732, 0x01733}, // Hanunoo Vowel Sign I ..Hanunoo Vowel Sign U + {0x01752, 0x01753}, // Buhid Vowel Sign I ..Buhid Vowel Sign U + {0x01772, 0x01773}, // Tagbanwa Vowel Sign I ..Tagbanwa Vowel Sign U + {0x017b4, 0x017b5}, // Khmer Vowel Inherent Aq ..Khmer Vowel Inherent Aa + {0x017b7, 0x017bd}, // Khmer Vowel Sign I ..Khmer Vowel Sign Ua + {0x017c6, 0x017c6}, // Khmer Sign Nikahit ..Khmer Sign Nikahit + {0x017c9, 0x017d3}, // Khmer Sign Muusikatoan ..Khmer Sign Bathamasat + {0x017dd, 0x017dd}, // Khmer Sign Atthacan ..Khmer Sign Atthacan + {0x0180b, 0x0180d}, // Mongolian Free Variation..Mongolian Free Variation + {0x0180f, 0x0180f}, // Mongolian Free Variation..Mongolian Free Variation + {0x01885, 0x01886}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal + {0x018a9, 0x018a9}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal + {0x01920, 0x01922}, // Limbu Vowel Sign A ..Limbu Vowel Sign U + {0x01927, 0x01928}, // Limbu Vowel Sign E ..Limbu Vowel Sign O + {0x01932, 0x01932}, // Limbu Small Letter Anusv..Limbu Small Letter Anusv + {0x01939, 0x0193b}, // Limbu Sign Mukphreng ..Limbu Sign Sa-i + {0x01a17, 0x01a18}, // Buginese Vowel Sign I ..Buginese Vowel Sign U + {0x01a1b, 0x01a1b}, // Buginese Vowel Sign Ae ..Buginese Vowel Sign Ae + {0x01a56, 0x01a56}, // Tai Tham Consonant Sign ..Tai Tham Consonant Sign + {0x01a58, 0x01a5e}, // Tai Tham Sign Mai Kang L..Tai Tham Consonant Sign + {0x01a60, 0x01a60}, // Tai Tham Sign Sakot ..Tai Tham Sign Sakot + {0x01a62, 0x01a62}, // Tai Tham Vowel Sign Mai ..Tai Tham Vowel Sign Mai + {0x01a65, 0x01a6c}, // Tai Tham Vowel Sign I ..Tai Tham Vowel Sign Oa B + {0x01a73, 0x01a7c}, // Tai Tham Vowel Sign Oa A..Tai Tham Sign Khuen-lue + {0x01a7f, 0x01a7f}, // Tai Tham Combining Crypt..Tai Tham Combining Crypt + {0x01ab0, 0x01ace}, // Combining Doubled Circum..Combining Latin Small Le + {0x01b00, 0x01b03}, // Balinese Sign Ulu Ricem ..Balinese Sign Surang + {0x01b34, 0x01b34}, // Balinese Sign Rerekan ..Balinese Sign Rerekan + {0x01b36, 0x01b3a}, // Balinese Vowel Sign Ulu ..Balinese Vowel Sign Ra R + {0x01b3c, 0x01b3c}, // Balinese Vowel Sign La L..Balinese Vowel Sign La L + {0x01b42, 0x01b42}, // Balinese Vowel Sign Pepe..Balinese Vowel Sign Pepe + {0x01b6b, 0x01b73}, // Balinese Musical Symbol ..Balinese Musical Symbol + {0x01b80, 0x01b81}, // Sundanese Sign Panyecek ..Sundanese Sign Panglayar + {0x01ba2, 0x01ba5}, // Sundanese Consonant Sign..Sundanese Vowel Sign Pan + {0x01ba8, 0x01ba9}, // Sundanese Vowel Sign Pam..Sundanese Vowel Sign Pan + {0x01bab, 0x01bad}, // Sundanese Sign Virama ..Sundanese Consonant Sign + {0x01be6, 0x01be6}, // Batak Sign Tompi ..Batak Sign Tompi + {0x01be8, 0x01be9}, // Batak Vowel Sign Pakpak ..Batak Vowel Sign Ee + {0x01bed, 0x01bed}, // Batak Vowel Sign Karo O ..Batak Vowel Sign Karo O + {0x01bef, 0x01bf1}, // Batak Vowel Sign U For S..Batak Consonant Sign H + {0x01c2c, 0x01c33}, // Lepcha Vowel Sign E ..Lepcha Consonant Sign T + {0x01c36, 0x01c37}, // Lepcha Sign Ran ..Lepcha Sign Nukta + {0x01cd0, 0x01cd2}, // Vedic Tone Karshana ..Vedic Tone Prenkha + {0x01cd4, 0x01ce0}, // Vedic Sign Yajurvedic Mi..Vedic Tone Rigvedic Kash + {0x01ce2, 0x01ce8}, // Vedic Sign Visarga Svari..Vedic Sign Visarga Anuda + {0x01ced, 0x01ced}, // Vedic Sign Tiryak ..Vedic Sign Tiryak + {0x01cf4, 0x01cf4}, // Vedic Tone Candra Above ..Vedic Tone Candra Above + {0x01cf8, 0x01cf9}, // Vedic Tone Ring Above ..Vedic Tone Double Ring A + {0x01dc0, 0x01dff}, // Combining Dotted Grave A..Combining Right Arrowhea + {0x020d0, 0x020f0}, // Combining Left Harpoon A..Combining Asterisk Above + {0x02cef, 0x02cf1}, // Coptic Combining Ni Abov..Coptic Combining Spiritu + {0x02d7f, 0x02d7f}, // Tifinagh Consonant Joine..Tifinagh Consonant Joine + {0x02de0, 0x02dff}, // Combining Cyrillic Lette..Combining Cyrillic Lette + {0x0302a, 0x0302d}, // Ideographic Level Tone M..Ideographic Entering Ton + {0x03099, 0x0309a}, // Combining Katakana-hirag..Combining Katakana-hirag + {0x0a66f, 0x0a672}, // Combining Cyrillic Vzmet..Combining Cyrillic Thous + {0x0a674, 0x0a67d}, // Combining Cyrillic Lette..Combining Cyrillic Payer + {0x0a69e, 0x0a69f}, // Combining Cyrillic Lette..Combining Cyrillic Lette + {0x0a6f0, 0x0a6f1}, // Bamum Combining Mark Koq..Bamum Combining Mark Tuk + {0x0a802, 0x0a802}, // Syloti Nagri Sign Dvisva..Syloti Nagri Sign Dvisva + {0x0a806, 0x0a806}, // Syloti Nagri Sign Hasant..Syloti Nagri Sign Hasant + {0x0a80b, 0x0a80b}, // Syloti Nagri Sign Anusva..Syloti Nagri Sign Anusva + {0x0a825, 0x0a826}, // Syloti Nagri Vowel Sign ..Syloti Nagri Vowel Sign + {0x0a82c, 0x0a82c}, // Syloti Nagri Sign Altern..Syloti Nagri Sign Altern + {0x0a8c4, 0x0a8c5}, // Saurashtra Sign Virama ..Saurashtra Sign Candrabi + {0x0a8e0, 0x0a8f1}, // Combining Devanagari Dig..Combining Devanagari Sig + {0x0a8ff, 0x0a8ff}, // Devanagari Vowel Sign Ay..Devanagari Vowel Sign Ay + {0x0a926, 0x0a92d}, // Kayah Li Vowel Ue ..Kayah Li Tone Calya Plop + {0x0a947, 0x0a951}, // Rejang Vowel Sign I ..Rejang Consonant Sign R + {0x0a980, 0x0a982}, // Javanese Sign Panyangga ..Javanese Sign Layar + {0x0a9b3, 0x0a9b3}, // Javanese Sign Cecak Telu..Javanese Sign Cecak Telu + {0x0a9b6, 0x0a9b9}, // Javanese Vowel Sign Wulu..Javanese Vowel Sign Suku + {0x0a9bc, 0x0a9bd}, // Javanese Vowel Sign Pepe..Javanese Consonant Sign + {0x0a9e5, 0x0a9e5}, // Myanmar Sign Shan Saw ..Myanmar Sign Shan Saw + {0x0aa29, 0x0aa2e}, // Cham Vowel Sign Aa ..Cham Vowel Sign Oe + {0x0aa31, 0x0aa32}, // Cham Vowel Sign Au ..Cham Vowel Sign Ue + {0x0aa35, 0x0aa36}, // Cham Consonant Sign La ..Cham Consonant Sign Wa + {0x0aa43, 0x0aa43}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina + {0x0aa4c, 0x0aa4c}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina + {0x0aa7c, 0x0aa7c}, // Myanmar Sign Tai Laing T..Myanmar Sign Tai Laing T + {0x0aab0, 0x0aab0}, // Tai Viet Mai Kang ..Tai Viet Mai Kang + {0x0aab2, 0x0aab4}, // Tai Viet Vowel I ..Tai Viet Vowel U + {0x0aab7, 0x0aab8}, // Tai Viet Mai Khit ..Tai Viet Vowel Ia + {0x0aabe, 0x0aabf}, // Tai Viet Vowel Am ..Tai Viet Tone Mai Ek + {0x0aac1, 0x0aac1}, // Tai Viet Tone Mai Tho ..Tai Viet Tone Mai Tho + {0x0aaec, 0x0aaed}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign + {0x0aaf6, 0x0aaf6}, // Meetei Mayek Virama ..Meetei Mayek Virama + {0x0abe5, 0x0abe5}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign + {0x0abe8, 0x0abe8}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign + {0x0abed, 0x0abed}, // Meetei Mayek Apun Iyek ..Meetei Mayek Apun Iyek + {0x0fb1e, 0x0fb1e}, // Hebrew Point Judeo-spani..Hebrew Point Judeo-spani + {0x0fe00, 0x0fe0f}, // Variation Selector-1 ..Variation Selector-16 + {0x0fe20, 0x0fe2f}, // Combining Ligature Left ..Combining Cyrillic Titlo + {0x101fd, 0x101fd}, // Phaistos Disc Sign Combi..Phaistos Disc Sign Combi + {0x102e0, 0x102e0}, // Coptic Epact Thousands M..Coptic Epact Thousands M + {0x10376, 0x1037a}, // Combining Old Permic Let..Combining Old Permic Let + {0x10a01, 0x10a03}, // Kharoshthi Vowel Sign I ..Kharoshthi Vowel Sign Vo + {0x10a05, 0x10a06}, // Kharoshthi Vowel Sign E ..Kharoshthi Vowel Sign O + {0x10a0c, 0x10a0f}, // Kharoshthi Vowel Length ..Kharoshthi Sign Visarga + {0x10a38, 0x10a3a}, // Kharoshthi Sign Bar Abov..Kharoshthi Sign Dot Belo + {0x10a3f, 0x10a3f}, // Kharoshthi Virama ..Kharoshthi Virama + {0x10ae5, 0x10ae6}, // Manichaean Abbreviation ..Manichaean Abbreviation + {0x10d24, 0x10d27}, // Hanifi Rohingya Sign Har..Hanifi Rohingya Sign Tas + {0x10eab, 0x10eac}, // Yezidi Combining Hamza M..Yezidi Combining Madda M + {0x10efd, 0x10eff}, // (nil) ..(nil) + {0x10f46, 0x10f50}, // Sogdian Combining Dot Be..Sogdian Combining Stroke + {0x10f82, 0x10f85}, // Old Uyghur Combining Dot..Old Uyghur Combining Two + {0x11001, 0x11001}, // Brahmi Sign Anusvara ..Brahmi Sign Anusvara + {0x11038, 0x11046}, // Brahmi Vowel Sign Aa ..Brahmi Virama + {0x11070, 0x11070}, // Brahmi Sign Old Tamil Vi..Brahmi Sign Old Tamil Vi + {0x11073, 0x11074}, // Brahmi Vowel Sign Old Ta..Brahmi Vowel Sign Old Ta + {0x1107f, 0x11081}, // Brahmi Number Joiner ..Kaithi Sign Anusvara + {0x110b3, 0x110b6}, // Kaithi Vowel Sign U ..Kaithi Vowel Sign Ai + {0x110b9, 0x110ba}, // Kaithi Sign Virama ..Kaithi Sign Nukta + {0x110c2, 0x110c2}, // Kaithi Vowel Sign Vocali..Kaithi Vowel Sign Vocali + {0x11100, 0x11102}, // Chakma Sign Candrabindu ..Chakma Sign Visarga + {0x11127, 0x1112b}, // Chakma Vowel Sign A ..Chakma Vowel Sign Uu + {0x1112d, 0x11134}, // Chakma Vowel Sign Ai ..Chakma Maayyaa + {0x11173, 0x11173}, // Mahajani Sign Nukta ..Mahajani Sign Nukta + {0x11180, 0x11181}, // Sharada Sign Candrabindu..Sharada Sign Anusvara + {0x111b6, 0x111be}, // Sharada Vowel Sign U ..Sharada Vowel Sign O + {0x111c9, 0x111cc}, // Sharada Sandhi Mark ..Sharada Extra Short Vowe + {0x111cf, 0x111cf}, // Sharada Sign Inverted Ca..Sharada Sign Inverted Ca + {0x1122f, 0x11231}, // Khojki Vowel Sign U ..Khojki Vowel Sign Ai + {0x11234, 0x11234}, // Khojki Sign Anusvara ..Khojki Sign Anusvara + {0x11236, 0x11237}, // Khojki Sign Nukta ..Khojki Sign Shadda + {0x1123e, 0x1123e}, // Khojki Sign Sukun ..Khojki Sign Sukun + {0x11241, 0x11241}, // (nil) ..(nil) + {0x112df, 0x112df}, // Khudawadi Sign Anusvara ..Khudawadi Sign Anusvara + {0x112e3, 0x112ea}, // Khudawadi Vowel Sign U ..Khudawadi Sign Virama + {0x11300, 0x11301}, // Grantha Sign Combining A..Grantha Sign Candrabindu + {0x1133b, 0x1133c}, // Combining Bindu Below ..Grantha Sign Nukta + {0x11340, 0x11340}, // Grantha Vowel Sign Ii ..Grantha Vowel Sign Ii + {0x11366, 0x1136c}, // Combining Grantha Digit ..Combining Grantha Digit + {0x11370, 0x11374}, // Combining Grantha Letter..Combining Grantha Letter + {0x11438, 0x1143f}, // Newa Vowel Sign U ..Newa Vowel Sign Ai + {0x11442, 0x11444}, // Newa Sign Virama ..Newa Sign Anusvara + {0x11446, 0x11446}, // Newa Sign Nukta ..Newa Sign Nukta + {0x1145e, 0x1145e}, // Newa Sandhi Mark ..Newa Sandhi Mark + {0x114b3, 0x114b8}, // Tirhuta Vowel Sign U ..Tirhuta Vowel Sign Vocal + {0x114ba, 0x114ba}, // Tirhuta Vowel Sign Short..Tirhuta Vowel Sign Short + {0x114bf, 0x114c0}, // Tirhuta Sign Candrabindu..Tirhuta Sign Anusvara + {0x114c2, 0x114c3}, // Tirhuta Sign Virama ..Tirhuta Sign Nukta + {0x115b2, 0x115b5}, // Siddham Vowel Sign U ..Siddham Vowel Sign Vocal + {0x115bc, 0x115bd}, // Siddham Sign Candrabindu..Siddham Sign Anusvara + {0x115bf, 0x115c0}, // Siddham Sign Virama ..Siddham Sign Nukta + {0x115dc, 0x115dd}, // Siddham Vowel Sign Alter..Siddham Vowel Sign Alter + {0x11633, 0x1163a}, // Modi Vowel Sign U ..Modi Vowel Sign Ai + {0x1163d, 0x1163d}, // Modi Sign Anusvara ..Modi Sign Anusvara + {0x1163f, 0x11640}, // Modi Sign Virama ..Modi Sign Ardhacandra + {0x116ab, 0x116ab}, // Takri Sign Anusvara ..Takri Sign Anusvara + {0x116ad, 0x116ad}, // Takri Vowel Sign Aa ..Takri Vowel Sign Aa + {0x116b0, 0x116b5}, // Takri Vowel Sign U ..Takri Vowel Sign Au + {0x116b7, 0x116b7}, // Takri Sign Nukta ..Takri Sign Nukta + {0x1171d, 0x1171f}, // Ahom Consonant Sign Medi..Ahom Consonant Sign Medi + {0x11722, 0x11725}, // Ahom Vowel Sign I ..Ahom Vowel Sign Uu + {0x11727, 0x1172b}, // Ahom Vowel Sign Aw ..Ahom Sign Killer + {0x1182f, 0x11837}, // Dogra Vowel Sign U ..Dogra Sign Anusvara + {0x11839, 0x1183a}, // Dogra Sign Virama ..Dogra Sign Nukta + {0x1193b, 0x1193c}, // Dives Akuru Sign Anusvar..Dives Akuru Sign Candrab + {0x1193e, 0x1193e}, // Dives Akuru Virama ..Dives Akuru Virama + {0x11943, 0x11943}, // Dives Akuru Sign Nukta ..Dives Akuru Sign Nukta + {0x119d4, 0x119d7}, // Nandinagari Vowel Sign U..Nandinagari Vowel Sign V + {0x119da, 0x119db}, // Nandinagari Vowel Sign E..Nandinagari Vowel Sign A + {0x119e0, 0x119e0}, // Nandinagari Sign Virama ..Nandinagari Sign Virama + {0x11a01, 0x11a0a}, // Zanabazar Square Vowel S..Zanabazar Square Vowel L + {0x11a33, 0x11a38}, // Zanabazar Square Final C..Zanabazar Square Sign An + {0x11a3b, 0x11a3e}, // Zanabazar Square Cluster..Zanabazar Square Cluster + {0x11a47, 0x11a47}, // Zanabazar Square Subjoin..Zanabazar Square Subjoin + {0x11a51, 0x11a56}, // Soyombo Vowel Sign I ..Soyombo Vowel Sign Oe + {0x11a59, 0x11a5b}, // Soyombo Vowel Sign Vocal..Soyombo Vowel Length Mar + {0x11a8a, 0x11a96}, // Soyombo Final Consonant ..Soyombo Sign Anusvara + {0x11a98, 0x11a99}, // Soyombo Gemination Mark ..Soyombo Subjoiner + {0x11c30, 0x11c36}, // Bhaiksuki Vowel Sign I ..Bhaiksuki Vowel Sign Voc + {0x11c38, 0x11c3d}, // Bhaiksuki Vowel Sign E ..Bhaiksuki Sign Anusvara + {0x11c3f, 0x11c3f}, // Bhaiksuki Sign Virama ..Bhaiksuki Sign Virama + {0x11c92, 0x11ca7}, // Marchen Subjoined Letter..Marchen Subjoined Letter + {0x11caa, 0x11cb0}, // Marchen Subjoined Letter..Marchen Vowel Sign Aa + {0x11cb2, 0x11cb3}, // Marchen Vowel Sign U ..Marchen Vowel Sign E + {0x11cb5, 0x11cb6}, // Marchen Sign Anusvara ..Marchen Sign Candrabindu + {0x11d31, 0x11d36}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign + {0x11d3a, 0x11d3a}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign + {0x11d3c, 0x11d3d}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign + {0x11d3f, 0x11d45}, // Masaram Gondi Vowel Sign..Masaram Gondi Virama + {0x11d47, 0x11d47}, // Masaram Gondi Ra-kara ..Masaram Gondi Ra-kara + {0x11d90, 0x11d91}, // Gunjala Gondi Vowel Sign..Gunjala Gondi Vowel Sign + {0x11d95, 0x11d95}, // Gunjala Gondi Sign Anusv..Gunjala Gondi Sign Anusv + {0x11d97, 0x11d97}, // Gunjala Gondi Virama ..Gunjala Gondi Virama + {0x11ef3, 0x11ef4}, // Makasar Vowel Sign I ..Makasar Vowel Sign U + {0x11f00, 0x11f01}, // (nil) ..(nil) + {0x11f36, 0x11f3a}, // (nil) ..(nil) + {0x11f40, 0x11f40}, // (nil) ..(nil) + {0x11f42, 0x11f42}, // (nil) ..(nil) + {0x13440, 0x13440}, // (nil) ..(nil) + {0x13447, 0x13455}, // (nil) ..(nil) + {0x16af0, 0x16af4}, // Bassa Vah Combining High..Bassa Vah Combining High + {0x16b30, 0x16b36}, // Pahawh Hmong Mark Cim Tu..Pahawh Hmong Mark Cim Ta + {0x16f4f, 0x16f4f}, // Miao Sign Consonant Modi..Miao Sign Consonant Modi + {0x16f8f, 0x16f92}, // Miao Tone Right ..Miao Tone Below + {0x16fe4, 0x16fe4}, // Khitan Small Script Fill..Khitan Small Script Fill + {0x1bc9d, 0x1bc9e}, // Duployan Thick Letter Se..Duployan Double Mark + {0x1cf00, 0x1cf2d}, // Znamenny Combining Mark ..Znamenny Combining Mark + {0x1cf30, 0x1cf46}, // Znamenny Combining Tonal..Znamenny Priznak Modifie + {0x1d167, 0x1d169}, // Musical Symbol Combining..Musical Symbol Combining + {0x1d17b, 0x1d182}, // Musical Symbol Combining..Musical Symbol Combining + {0x1d185, 0x1d18b}, // Musical Symbol Combining..Musical Symbol Combining + {0x1d1aa, 0x1d1ad}, // Musical Symbol Combining..Musical Symbol Combining + {0x1d242, 0x1d244}, // Combining Greek Musical ..Combining Greek Musical + {0x1da00, 0x1da36}, // Signwriting Head Rim ..Signwriting Air Sucking + {0x1da3b, 0x1da6c}, // Signwriting Mouth Closed..Signwriting Excitement + {0x1da75, 0x1da75}, // Signwriting Upper Body T..Signwriting Upper Body T + {0x1da84, 0x1da84}, // Signwriting Location Hea..Signwriting Location Hea + {0x1da9b, 0x1da9f}, // Signwriting Fill Modifie..Signwriting Fill Modifie + {0x1daa1, 0x1daaf}, // Signwriting Rotation Mod..Signwriting Rotation Mod + {0x1e000, 0x1e006}, // Combining Glagolitic Let..Combining Glagolitic Let + {0x1e008, 0x1e018}, // Combining Glagolitic Let..Combining Glagolitic Let + {0x1e01b, 0x1e021}, // Combining Glagolitic Let..Combining Glagolitic Let + {0x1e023, 0x1e024}, // Combining Glagolitic Let..Combining Glagolitic Let + {0x1e026, 0x1e02a}, // Combining Glagolitic Let..Combining Glagolitic Let + {0x1e08f, 0x1e08f}, // (nil) ..(nil) + {0x1e130, 0x1e136}, // Nyiakeng Puachue Hmong T..Nyiakeng Puachue Hmong T + {0x1e2ae, 0x1e2ae}, // Toto Sign Rising Tone ..Toto Sign Rising Tone + {0x1e2ec, 0x1e2ef}, // Wancho Tone Tup ..Wancho Tone Koini + {0x1e4ec, 0x1e4ef}, // (nil) ..(nil) + {0x1e8d0, 0x1e8d6}, // Mende Kikakui Combining ..Mende Kikakui Combining + {0x1e944, 0x1e94a}, // Adlam Alif Lengthener ..Adlam Nukta + {0xe0100, 0xe01ef}, // Variation Selector-17 ..Variation Selector-256 +}; + +// https://github.com/jquast/wcwidth/blob/master/wcwidth/table_wide.py +// from https://github.com/jquast/wcwidth/pull/64 +// at commit 1b9b6585b0080ea5cb88dc9815796505724793fe (2022-12-16): +static struct width_interval WIDE_EASTASIAN[] = { + {0x01100, 0x0115f}, // Hangul Choseong Kiyeok ..Hangul Choseong Filler + {0x0231a, 0x0231b}, // Watch ..Hourglass + {0x02329, 0x0232a}, // Left-pointing Angle Brac..Right-pointing Angle Bra + {0x023e9, 0x023ec}, // Black Right-pointing Dou..Black Down-pointing Doub + {0x023f0, 0x023f0}, // Alarm Clock ..Alarm Clock + {0x023f3, 0x023f3}, // Hourglass With Flowing S..Hourglass With Flowing S + {0x025fd, 0x025fe}, // White Medium Small Squar..Black Medium Small Squar + {0x02614, 0x02615}, // Umbrella With Rain Drops..Hot Beverage + {0x02648, 0x02653}, // Aries ..Pisces + {0x0267f, 0x0267f}, // Wheelchair Symbol ..Wheelchair Symbol + {0x02693, 0x02693}, // Anchor ..Anchor + {0x026a1, 0x026a1}, // High Voltage Sign ..High Voltage Sign + {0x026aa, 0x026ab}, // Medium White Circle ..Medium Black Circle + {0x026bd, 0x026be}, // Soccer Ball ..Baseball + {0x026c4, 0x026c5}, // Snowman Without Snow ..Sun Behind Cloud + {0x026ce, 0x026ce}, // Ophiuchus ..Ophiuchus + {0x026d4, 0x026d4}, // No Entry ..No Entry + {0x026ea, 0x026ea}, // Church ..Church + {0x026f2, 0x026f3}, // Fountain ..Flag In Hole + {0x026f5, 0x026f5}, // Sailboat ..Sailboat + {0x026fa, 0x026fa}, // Tent ..Tent + {0x026fd, 0x026fd}, // Fuel Pump ..Fuel Pump + {0x02705, 0x02705}, // White Heavy Check Mark ..White Heavy Check Mark + {0x0270a, 0x0270b}, // Raised Fist ..Raised Hand + {0x02728, 0x02728}, // Sparkles ..Sparkles + {0x0274c, 0x0274c}, // Cross Mark ..Cross Mark + {0x0274e, 0x0274e}, // Negative Squared Cross M..Negative Squared Cross M + {0x02753, 0x02755}, // Black Question Mark Orna..White Exclamation Mark O + {0x02757, 0x02757}, // Heavy Exclamation Mark S..Heavy Exclamation Mark S + {0x02795, 0x02797}, // Heavy Plus Sign ..Heavy Division Sign + {0x027b0, 0x027b0}, // Curly Loop ..Curly Loop + {0x027bf, 0x027bf}, // Double Curly Loop ..Double Curly Loop + {0x02b1b, 0x02b1c}, // Black Large Square ..White Large Square + {0x02b50, 0x02b50}, // White Medium Star ..White Medium Star + {0x02b55, 0x02b55}, // Heavy Large Circle ..Heavy Large Circle + {0x02e80, 0x02e99}, // Cjk Radical Repeat ..Cjk Radical Rap + {0x02e9b, 0x02ef3}, // Cjk Radical Choke ..Cjk Radical C-simplified + {0x02f00, 0x02fd5}, // Kangxi Radical One ..Kangxi Radical Flute + {0x02ff0, 0x02ffb}, // Ideographic Description ..Ideographic Description + {0x03000, 0x0303e}, // Ideographic Space ..Ideographic Variation In + {0x03041, 0x03096}, // Hiragana Letter Small A ..Hiragana Letter Small Ke + {0x03099, 0x030ff}, // Combining Katakana-hirag..Katakana Digraph Koto + {0x03105, 0x0312f}, // Bopomofo Letter B ..Bopomofo Letter Nn + {0x03131, 0x0318e}, // Hangul Letter Kiyeok ..Hangul Letter Araeae + {0x03190, 0x031e3}, // Ideographic Annotation L..Cjk Stroke Q + {0x031f0, 0x0321e}, // Katakana Letter Small Ku..Parenthesized Korean Cha + {0x03220, 0x03247}, // Parenthesized Ideograph ..Circled Ideograph Koto + {0x03250, 0x04dbf}, // Partnership Sign ..Cjk Unified Ideograph-4d + {0x04e00, 0x0a48c}, // Cjk Unified Ideograph-4e..Yi Syllable Yyr + {0x0a490, 0x0a4c6}, // Yi Radical Qot ..Yi Radical Ke + {0x0a960, 0x0a97c}, // Hangul Choseong Tikeut-m..Hangul Choseong Ssangyeo + {0x0ac00, 0x0d7a3}, // Hangul Syllable Ga ..Hangul Syllable Hih + {0x0f900, 0x0faff}, // Cjk Compatibility Ideogr..(nil) + {0x0fe10, 0x0fe19}, // Presentation Form For Ve..Presentation Form For Ve + {0x0fe30, 0x0fe52}, // Presentation Form For Ve..Small Full Stop + {0x0fe54, 0x0fe66}, // Small Semicolon ..Small Equals Sign + {0x0fe68, 0x0fe6b}, // Small Reverse Solidus ..Small Commercial At + {0x0ff01, 0x0ff60}, // Fullwidth Exclamation Ma..Fullwidth Right White Pa + {0x0ffe0, 0x0ffe6}, // Fullwidth Cent Sign ..Fullwidth Won Sign + {0x16fe0, 0x16fe4}, // Tangut Iteration Mark ..Khitan Small Script Fill + {0x16ff0, 0x16ff1}, // Vietnamese Alternate Rea..Vietnamese Alternate Rea + {0x17000, 0x187f7}, // (nil) ..(nil) + {0x18800, 0x18cd5}, // Tangut Component-001 ..Khitan Small Script Char + {0x18d00, 0x18d08}, // (nil) ..(nil) + {0x1aff0, 0x1aff3}, // Katakana Letter Minnan T..Katakana Letter Minnan T + {0x1aff5, 0x1affb}, // Katakana Letter Minnan T..Katakana Letter Minnan N + {0x1affd, 0x1affe}, // Katakana Letter Minnan N..Katakana Letter Minnan N + {0x1b000, 0x1b122}, // Katakana Letter Archaic ..Katakana Letter Archaic + {0x1b132, 0x1b132}, // (nil) ..(nil) + {0x1b150, 0x1b152}, // Hiragana Letter Small Wi..Hiragana Letter Small Wo + {0x1b155, 0x1b155}, // (nil) ..(nil) + {0x1b164, 0x1b167}, // Katakana Letter Small Wi..Katakana Letter Small N + {0x1b170, 0x1b2fb}, // Nushu Character-1b170 ..Nushu Character-1b2fb + {0x1f004, 0x1f004}, // Mahjong Tile Red Dragon ..Mahjong Tile Red Dragon + {0x1f0cf, 0x1f0cf}, // Playing Card Black Joker..Playing Card Black Joker + {0x1f18e, 0x1f18e}, // Negative Squared Ab ..Negative Squared Ab + {0x1f191, 0x1f19a}, // Squared Cl ..Squared Vs + {0x1f200, 0x1f202}, // Square Hiragana Hoka ..Squared Katakana Sa + {0x1f210, 0x1f23b}, // Squared Cjk Unified Ideo..Squared Cjk Unified Ideo + {0x1f240, 0x1f248}, // Tortoise Shell Bracketed..Tortoise Shell Bracketed + {0x1f250, 0x1f251}, // Circled Ideograph Advant..Circled Ideograph Accept + {0x1f260, 0x1f265}, // Rounded Symbol For Fu ..Rounded Symbol For Cai + {0x1f300, 0x1f320}, // Cyclone ..Shooting Star + {0x1f32d, 0x1f335}, // Hot Dog ..Cactus + {0x1f337, 0x1f37c}, // Tulip ..Baby Bottle + {0x1f37e, 0x1f393}, // Bottle With Popping Cork..Graduation Cap + {0x1f3a0, 0x1f3ca}, // Carousel Horse ..Swimmer + {0x1f3cf, 0x1f3d3}, // Cricket Bat And Ball ..Table Tennis Paddle And + {0x1f3e0, 0x1f3f0}, // House Building ..European Castle + {0x1f3f4, 0x1f3f4}, // Waving Black Flag ..Waving Black Flag + {0x1f3f8, 0x1f43e}, // Badminton Racquet And Sh..Paw Prints + {0x1f440, 0x1f440}, // Eyes ..Eyes + {0x1f442, 0x1f4fc}, // Ear ..Videocassette + {0x1f4ff, 0x1f53d}, // Prayer Beads ..Down-pointing Small Red + {0x1f54b, 0x1f54e}, // Kaaba ..Menorah With Nine Branch + {0x1f550, 0x1f567}, // Clock Face One Oclock ..Clock Face Twelve-thirty + {0x1f57a, 0x1f57a}, // Man Dancing ..Man Dancing + {0x1f595, 0x1f596}, // Reversed Hand With Middl..Raised Hand With Part Be + {0x1f5a4, 0x1f5a4}, // Black Heart ..Black Heart + {0x1f5fb, 0x1f64f}, // Mount Fuji ..Person With Folded Hands + {0x1f680, 0x1f6c5}, // Rocket ..Left Luggage + {0x1f6cc, 0x1f6cc}, // Sleeping Accommodation ..Sleeping Accommodation + {0x1f6d0, 0x1f6d2}, // Place Of Worship ..Shopping Trolley + {0x1f6d5, 0x1f6d7}, // Hindu Temple ..Elevator + {0x1f6dc, 0x1f6df}, // (nil) ..Ring Buoy + {0x1f6eb, 0x1f6ec}, // Airplane Departure ..Airplane Arriving + {0x1f6f4, 0x1f6fc}, // Scooter ..Roller Skate + {0x1f7e0, 0x1f7eb}, // Large Orange Circle ..Large Brown Square + {0x1f7f0, 0x1f7f0}, // Heavy Equals Sign ..Heavy Equals Sign + {0x1f90c, 0x1f93a}, // Pinched Fingers ..Fencer + {0x1f93c, 0x1f945}, // Wrestlers ..Goal Net + {0x1f947, 0x1f9ff}, // First Place Medal ..Nazar Amulet + {0x1fa70, 0x1fa7c}, // Ballet Shoes ..Crutch + {0x1fa80, 0x1fa88}, // Yo-yo ..(nil) + {0x1fa90, 0x1fabd}, // Ringed Planet ..(nil) + {0x1fabf, 0x1fac5}, // (nil) ..Person With Crown + {0x1face, 0x1fadb}, // (nil) ..(nil) + {0x1fae0, 0x1fae8}, // Melting Face ..(nil) + {0x1faf0, 0x1faf8}, // Hand With Index Finger A..(nil) + {0x20000, 0x2fffd}, // Cjk Unified Ideograph-20..(nil) + {0x30000, 0x3fffd}, // Cjk Unified Ideograph-30..(nil) +}; + +static bool intable(struct width_interval* table, int table_length, int c) { + // First quick check for Latin1 etc. characters. + if (c < table[0].start) return false; + + // Binary search in table. + int bot = 0; + int top = table_length - 1; + while (top >= bot) { + int mid = (bot + top) / 2; + if (table[mid].end < c) { + bot = mid + 1; + } else if (table[mid].start > c) { + top = mid - 1; + } else { + return true; + } + } + return false; +} + +int wcwidth(wchar_t ucs) { + // NOTE: created by hand, there isn't anything identifiable other than + // general Cf category code to identify these, and some characters in Cf + // category code are of non-zero width. + if (ucs == 0 || + ucs == 0x034F || + (0x200B <= ucs && ucs <= 0x200F) || + ucs == 0x2028 || + ucs == 0x2029 || + (0x202A <= ucs && ucs <= 0x202E) || + (0x2060 <= ucs && ucs <= 0x2063)) { + return 0; + } + + // C0/C1 control characters. + if (ucs < 32 || (0x07F <= ucs && ucs < 0x0A0)) return -1; + + // Combining characters with zero width. + if (intable(ZERO_WIDTH, sizeof(ZERO_WIDTH)/sizeof(struct width_interval), ucs)) return 0; + + return intable(WIDE_EASTASIAN, sizeof(WIDE_EASTASIAN)/sizeof(struct width_interval), ucs) ? 2 : 1; +} diff --git a/src/3rdparty/wcwidch/wcwidth.h b/src/3rdparty/wcwidch/wcwidth.h new file mode 100644 index 000000000..38c17acd9 --- /dev/null +++ b/src/3rdparty/wcwidch/wcwidth.h @@ -0,0 +1,12 @@ +#ifndef WCWIDTH_H_INCLUDED +#define WCWIDTH_H_INCLUDED + +#include + +__BEGIN_DECLS + +int wcwidth(wchar_t ucs); + +__END_DECLS + +#endif diff --git a/src/modules/separator/separator.c b/src/modules/separator/separator.c index fc675438d..97437c4c4 100644 --- a/src/modules/separator/separator.c +++ b/src/modules/separator/separator.c @@ -14,7 +14,7 @@ static inline uint32_t getWcsWidth(const FFstrbuf* mbstr, wchar_t* wstr, mbstate { const char* str = mbstr->chars; uint32_t wstrLength = (uint32_t) mbsrtowcs(wstr, &str, mbstr->length, state); - int result = mk_wcswidth(wstr, wstrLength); + int result = wcswidth(wstr, wstrLength); return result > 0 ? (uint32_t) result : mbstr->length; } @@ -61,7 +61,7 @@ void ffPrintSeparator(FFSeparatorOptions* options) #else putwchar(wstr[i]); #endif - int width = mk_wcwidth(wstr[i]); + int width = wcwidth(wstr[i]); remaining -= width < 0 ? 0 : width; } } diff --git a/src/util/wcwidth.h b/src/util/wcwidth.h index 4252e0f36..bc7f19499 100644 --- a/src/util/wcwidth.h +++ b/src/util/wcwidth.h @@ -2,15 +2,14 @@ #include -#ifdef FF_HAVE_WCWIDTH -static inline int mk_wcwidth(wchar_t ucs) { - return wcwidth(ucs); +#ifndef FF_HAVE_WCWIDTH +#include "3rdparty/wcwidch/wcwidth.h" + +static inline int wcswidth(const wchar_t *pwcs, size_t n) +{ + int res = 0; + while (n-- > 0) + res += wcwidth(*pwcs++); + return res; } -static inline int mk_wcswidth(const wchar_t *pwcs, size_t n) { - return wcswidth(pwcs, n); -} -#else -// https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c -int mk_wcwidth(wchar_t ucs); -int mk_wcswidth(const wchar_t *pwcs, size_t n); #endif From 8f51763374688653e9253b3927d92cf7b10be18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 13:13:30 +0800 Subject: [PATCH 11/28] Linux: allow command substitution when expanding paths Ref: https://github.com/fastfetch-cli/fastfetch/discussions/698 --- src/common/io/io_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/io/io_unix.c b/src/common/io/io_unix.c index 029aaab62..2f1205260 100644 --- a/src/common/io/io_unix.c +++ b/src/common/io/io_unix.c @@ -115,7 +115,7 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o #if __has_include() // https://github.com/termux/termux-packages/pull/7056 wordexp_t exp; - if(wordexp(in, &exp, WRDE_NOCMD) != 0) + if(wordexp(in, &exp, 0) != 0) return false; if (exp.we_wordc == 1) From 0b98a14977b7fbdcc64dbabd17fc5929b5ee215a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 13:14:53 +0800 Subject: [PATCH 12/28] Fastfetch: don't expand envs in `--config` Since it can only be used in command line --- src/fastfetch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fastfetch.c b/src/fastfetch.c index 9fdfff513..affd59aad 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -483,10 +483,8 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val if(isJsonConfig ? parseJsoncFile(value) : parseConfigFile(data, value)) return; - FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA(128); - if (ffPathExpandEnv(value, &absolutePath)) { - bool success = isJsonConfig ? parseJsoncFile(absolutePath.chars) : parseConfigFile(data, absolutePath.chars); + bool success = isJsonConfig ? parseJsoncFile(value) : parseConfigFile(data, value); if(success) return; @@ -494,6 +492,7 @@ static void optionParseConfigFile(FFdata* data, const char* key, const char* val //Try to load as a relative path + FF_STRBUF_AUTO_DESTROY absolutePath = ffStrbufCreateA(128); FF_LIST_FOR_EACH(FFstrbuf, path, instance.state.platform.dataDirs) { //We need to copy it, because if a config file loads a config file, the value of path must be unchanged From 9d7cbb0fe3b096862f6d96e9326d719f0cbdedc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 14:42:00 +0800 Subject: [PATCH 13/28] Revert "3rdparty: use a newer wcwidch implementation" Unwanted change This reverts commit 28ea765f193565c97e5c114910c429fb119d44ee. --- CMakeLists.txt | 2 +- src/3rdparty/mk_wcwidch/repo.json | 7 + src/3rdparty/mk_wcwidch/wcwidth.c | 314 +++++++++++++++++ src/3rdparty/wcwidch/repo.json | 6 - src/3rdparty/wcwidch/wcwidth.c | 543 ------------------------------ src/3rdparty/wcwidch/wcwidth.h | 12 - src/modules/separator/separator.c | 4 +- src/util/wcwidth.h | 19 +- 8 files changed, 334 insertions(+), 573 deletions(-) create mode 100644 src/3rdparty/mk_wcwidch/repo.json create mode 100644 src/3rdparty/mk_wcwidch/wcwidth.c delete mode 100644 src/3rdparty/wcwidch/repo.json delete mode 100644 src/3rdparty/wcwidch/wcwidth.c delete mode 100644 src/3rdparty/wcwidch/wcwidth.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 62eab43e7..fb5da6f14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -687,7 +687,7 @@ endif() include(CheckFunctionExists) check_function_exists(wcwidth HAVE_WCWIDTH) if(NOT HAVE_WCWIDTH) - list(APPEND LIBFASTFETCH_SRC src/3rdparty/wcwidch/wcwidth.c) + list(APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c) endif() if(ENABLE_SYSTEM_YYJSON) diff --git a/src/3rdparty/mk_wcwidch/repo.json b/src/3rdparty/mk_wcwidch/repo.json new file mode 100644 index 000000000..8a71b4b81 --- /dev/null +++ b/src/3rdparty/mk_wcwidch/repo.json @@ -0,0 +1,7 @@ +{ + "home": "https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c", + "license": "Embed in source", + "version": "2007-05-26 (Unicode 5.0)", + "author": "Markus Kuhn", + "modified": "CarterLi" +} diff --git a/src/3rdparty/mk_wcwidch/wcwidth.c b/src/3rdparty/mk_wcwidch/wcwidth.c new file mode 100644 index 000000000..7abd26f98 --- /dev/null +++ b/src/3rdparty/mk_wcwidch/wcwidth.c @@ -0,0 +1,314 @@ +/* + * This is an implementation of wcwidth() and wcswidth() (defined in + * IEEE Std 1002.1-2001) for Unicode. + * + * http://www.opengroup.org/onlinepubs/007904975/functions/wcwidth.html + * http://www.opengroup.org/onlinepubs/007904975/functions/wcswidth.html + * + * In fixed-width output devices, Latin characters all occupy a single + * "cell" position of equal width, whereas ideographic CJK characters + * occupy two such cells. Interoperability between terminal-line + * applications and (teletype-style) character terminals using the + * UTF-8 encoding requires agreement on which character should advance + * the cursor by how many cell positions. No established formal + * standards exist at present on which Unicode character shall occupy + * how many cell positions on character terminals. These routines are + * a first attempt of defining such behavior based on simple rules + * applied to data provided by the Unicode Consortium. + * + * For some graphical characters, the Unicode standard explicitly + * defines a character-cell width via the definition of the East Asian + * FullWidth (F), Wide (W), Half-width (H), and Narrow (Na) classes. + * In all these cases, there is no ambiguity about which width a + * terminal shall use. For characters in the East Asian Ambiguous (A) + * class, the width choice depends purely on a preference of backward + * compatibility with either historic CJK or Western practice. + * Choosing single-width for these characters is easy to justify as + * the appropriate long-term solution, as the CJK practice of + * displaying these characters as double-width comes from historic + * implementation simplicity (8-bit encoded characters were displayed + * single-width and 16-bit ones double-width, even for Greek, + * Cyrillic, etc.) and not any typographic considerations. + * + * Much less clear is the choice of width for the Not East Asian + * (Neutral) class. Existing practice does not dictate a width for any + * of these characters. It would nevertheless make sense + * typographically to allocate two character cells to characters such + * as for instance EM SPACE or VOLUME INTEGRAL, which cannot be + * represented adequately with a single-width glyph. The following + * routines at present merely assign a single-cell width to all + * neutral characters, in the interest of simplicity. This is not + * entirely satisfactory and should be reconsidered before + * establishing a formal standard in this area. At the moment, the + * decision which Not East Asian (Neutral) characters should be + * represented by double-width glyphs cannot yet be answered by + * applying a simple rule from the Unicode database content. Setting + * up a proper standard for the behavior of UTF-8 character terminals + * will require a careful analysis not only of each Unicode character, + * but also of each presentation form, something the author of these + * routines has avoided to do so far. + * + * http://www.unicode.org/unicode/reports/tr11/ + * + * Markus Kuhn -- 2007-05-26 (Unicode 5.0) + * + * Permission to use, copy, modify, and distribute this software + * for any purpose and without fee is hereby granted. The author + * disclaims all warranties with regard to this software. + * + * Latest version: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c + */ + +#include + +struct interval { + int first; + int last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(wchar_t ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + + +/* The following two functions define the column width of an ISO 10646 + * character as follows: + * + * - The null character (U+0000) has a column width of 0. + * + * - Other C0/C1 control characters and DEL will lead to a return + * value of -1. + * + * - Non-spacing and enclosing combining characters (general + * category code Mn or Me in the Unicode database) have a + * column width of 0. + * + * - SOFT HYPHEN (U+00AD) has a column width of 1. + * + * - Other format characters (general category code Cf in the Unicode + * database) and ZERO WIDTH SPACE (U+200B) have a column width of 0. + * + * - Hangul Jamo medial vowels and final consonants (U+1160-U+11FF) + * have a column width of 0. + * + * - Spacing characters in the East Asian Wide (W) or East Asian + * Full-width (F) category as defined in Unicode Technical + * Report #11 have a column width of 2. + * + * - All remaining characters (including all printable + * ISO 8859-1 and WGL4 characters, Unicode control characters, + * etc.) have a column width of 1. + * + * This implementation assumes that wchar_t characters are encoded + * in ISO 10646. + */ + +int mk_wcwidth(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of non-spacing characters */ + /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ + static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, + { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } + }; + + /* test for 8-bit control characters */ + if (ucs == 0) + return 0; + if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0)) + return -1; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, combining, + sizeof(combining) / sizeof(struct interval) - 1)) + return 0; + + /* if we arrive here, ucs is not a combining or C0/C1 control character */ + + return 1 + + (ucs >= 0x1100 && + (ucs <= 0x115f || /* Hangul Jamo init. consonants */ + ucs == 0x2329 || ucs == 0x232a || + (ucs >= 0x2e80 && ucs <= 0xa4cf && + ucs != 0x303f) || /* CJK ... Yi */ + (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ + (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ + (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ + (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ + (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ + (ucs >= 0xffe0 && ucs <= 0xffe6) || + +#ifndef _WIN32 // sizeof(wchar_t) == 2 + (ucs >= 0x20000 && ucs <= 0x2fffd) || + (ucs >= 0x30000 && ucs <= 0x3fffd) || +#endif + 0 + )); +} + + +int mk_wcswidth(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} + + +/* + * The following functions are the same as mk_wcwidth() and + * mk_wcswidth(), except that spacing characters in the East Asian + * Ambiguous (A) category as defined in Unicode Technical Report #11 + * have a column width of 2. This variant might be useful for users of + * CJK legacy encodings who want to migrate to UCS without changing + * the traditional terminal character-width behaviour. It is not + * otherwise recommended for general use. + */ +int mk_wcwidth_cjk(wchar_t ucs) +{ + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + /* binary search in table of non-spacing characters */ + if (bisearch(ucs, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1)) + return 2; + + return mk_wcwidth(ucs); +} + + +int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n) +{ + int w, width = 0; + + for (;*pwcs && n-- > 0; pwcs++) + if ((w = mk_wcwidth_cjk(*pwcs)) < 0) + return -1; + else + width += w; + + return width; +} diff --git a/src/3rdparty/wcwidch/repo.json b/src/3rdparty/wcwidch/repo.json deleted file mode 100644 index 24b6dc03c..000000000 --- a/src/3rdparty/wcwidch/repo.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "home": "https://github.com/termux/wcwidth", - "license": "MIT", - "version": "Unicode 15", - "author": "termux" -} diff --git a/src/3rdparty/wcwidch/wcwidth.c b/src/3rdparty/wcwidch/wcwidth.c deleted file mode 100644 index b62725b53..000000000 --- a/src/3rdparty/wcwidch/wcwidth.c +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright (C) Fredrik Fornwall 2016. - * Distributed under the MIT License. - * - * Implementation of wcwidth(3) as a C port of: - * https://github.com/jquast/wcwidth - * - * Report issues at: - * https://github.com/termux/wcwidth - * - * IMPORTANT: - * Must be kept in sync with the following: - * https://github.com/termux/termux-app/blob/master/terminal-emulator/src/main/java/com/termux/terminal/WcWidth.java - * https://github.com/termux/libandroid-support - * https://github.com/termux/termux-packages/tree/master/packages/libandroid-support - */ - -#include -#include - -struct width_interval { - int start; - int end; -}; - -// From https://github.com/jquast/wcwidth/blob/master/wcwidth/table_zero.py -// from https://github.com/jquast/wcwidth/pull/64 -// at commit 1b9b6585b0080ea5cb88dc9815796505724793fe (2022-12-16): -static struct width_interval ZERO_WIDTH[] = { - {0x00300, 0x0036f}, // Combining Grave Accent ..Combining Latin Small Le - {0x00483, 0x00489}, // Combining Cyrillic Titlo..Combining Cyrillic Milli - {0x00591, 0x005bd}, // Hebrew Accent Etnahta ..Hebrew Point Meteg - {0x005bf, 0x005bf}, // Hebrew Point Rafe ..Hebrew Point Rafe - {0x005c1, 0x005c2}, // Hebrew Point Shin Dot ..Hebrew Point Sin Dot - {0x005c4, 0x005c5}, // Hebrew Mark Upper Dot ..Hebrew Mark Lower Dot - {0x005c7, 0x005c7}, // Hebrew Point Qamats Qata..Hebrew Point Qamats Qata - {0x00610, 0x0061a}, // Arabic Sign Sallallahou ..Arabic Small Kasra - {0x0064b, 0x0065f}, // Arabic Fathatan ..Arabic Wavy Hamza Below - {0x00670, 0x00670}, // Arabic Letter Superscrip..Arabic Letter Superscrip - {0x006d6, 0x006dc}, // Arabic Small High Ligatu..Arabic Small High Seen - {0x006df, 0x006e4}, // Arabic Small High Rounde..Arabic Small High Madda - {0x006e7, 0x006e8}, // Arabic Small High Yeh ..Arabic Small High Noon - {0x006ea, 0x006ed}, // Arabic Empty Centre Low ..Arabic Small Low Meem - {0x00711, 0x00711}, // Syriac Letter Superscrip..Syriac Letter Superscrip - {0x00730, 0x0074a}, // Syriac Pthaha Above ..Syriac Barrekh - {0x007a6, 0x007b0}, // Thaana Abafili ..Thaana Sukun - {0x007eb, 0x007f3}, // Nko Combining Short High..Nko Combining Double Dot - {0x007fd, 0x007fd}, // Nko Dantayalan ..Nko Dantayalan - {0x00816, 0x00819}, // Samaritan Mark In ..Samaritan Mark Dagesh - {0x0081b, 0x00823}, // Samaritan Mark Epentheti..Samaritan Vowel Sign A - {0x00825, 0x00827}, // Samaritan Vowel Sign Sho..Samaritan Vowel Sign U - {0x00829, 0x0082d}, // Samaritan Vowel Sign Lon..Samaritan Mark Nequdaa - {0x00859, 0x0085b}, // Mandaic Affrication Mark..Mandaic Gemination Mark - {0x00898, 0x0089f}, // Arabic Small High Word A..Arabic Half Madda Over M - {0x008ca, 0x008e1}, // Arabic Small High Farsi ..Arabic Small High Sign S - {0x008e3, 0x00902}, // Arabic Turned Damma Belo..Devanagari Sign Anusvara - {0x0093a, 0x0093a}, // Devanagari Vowel Sign Oe..Devanagari Vowel Sign Oe - {0x0093c, 0x0093c}, // Devanagari Sign Nukta ..Devanagari Sign Nukta - {0x00941, 0x00948}, // Devanagari Vowel Sign U ..Devanagari Vowel Sign Ai - {0x0094d, 0x0094d}, // Devanagari Sign Virama ..Devanagari Sign Virama - {0x00951, 0x00957}, // Devanagari Stress Sign U..Devanagari Vowel Sign Uu - {0x00962, 0x00963}, // Devanagari Vowel Sign Vo..Devanagari Vowel Sign Vo - {0x00981, 0x00981}, // Bengali Sign Candrabindu..Bengali Sign Candrabindu - {0x009bc, 0x009bc}, // Bengali Sign Nukta ..Bengali Sign Nukta - {0x009c1, 0x009c4}, // Bengali Vowel Sign U ..Bengali Vowel Sign Vocal - {0x009cd, 0x009cd}, // Bengali Sign Virama ..Bengali Sign Virama - {0x009e2, 0x009e3}, // Bengali Vowel Sign Vocal..Bengali Vowel Sign Vocal - {0x009fe, 0x009fe}, // Bengali Sandhi Mark ..Bengali Sandhi Mark - {0x00a01, 0x00a02}, // Gurmukhi Sign Adak Bindi..Gurmukhi Sign Bindi - {0x00a3c, 0x00a3c}, // Gurmukhi Sign Nukta ..Gurmukhi Sign Nukta - {0x00a41, 0x00a42}, // Gurmukhi Vowel Sign U ..Gurmukhi Vowel Sign Uu - {0x00a47, 0x00a48}, // Gurmukhi Vowel Sign Ee ..Gurmukhi Vowel Sign Ai - {0x00a4b, 0x00a4d}, // Gurmukhi Vowel Sign Oo ..Gurmukhi Sign Virama - {0x00a51, 0x00a51}, // Gurmukhi Sign Udaat ..Gurmukhi Sign Udaat - {0x00a70, 0x00a71}, // Gurmukhi Tippi ..Gurmukhi Addak - {0x00a75, 0x00a75}, // Gurmukhi Sign Yakash ..Gurmukhi Sign Yakash - {0x00a81, 0x00a82}, // Gujarati Sign Candrabind..Gujarati Sign Anusvara - {0x00abc, 0x00abc}, // Gujarati Sign Nukta ..Gujarati Sign Nukta - {0x00ac1, 0x00ac5}, // Gujarati Vowel Sign U ..Gujarati Vowel Sign Cand - {0x00ac7, 0x00ac8}, // Gujarati Vowel Sign E ..Gujarati Vowel Sign Ai - {0x00acd, 0x00acd}, // Gujarati Sign Virama ..Gujarati Sign Virama - {0x00ae2, 0x00ae3}, // Gujarati Vowel Sign Voca..Gujarati Vowel Sign Voca - {0x00afa, 0x00aff}, // Gujarati Sign Sukun ..Gujarati Sign Two-circle - {0x00b01, 0x00b01}, // Oriya Sign Candrabindu ..Oriya Sign Candrabindu - {0x00b3c, 0x00b3c}, // Oriya Sign Nukta ..Oriya Sign Nukta - {0x00b3f, 0x00b3f}, // Oriya Vowel Sign I ..Oriya Vowel Sign I - {0x00b41, 0x00b44}, // Oriya Vowel Sign U ..Oriya Vowel Sign Vocalic - {0x00b4d, 0x00b4d}, // Oriya Sign Virama ..Oriya Sign Virama - {0x00b55, 0x00b56}, // Oriya Sign Overline ..Oriya Ai Length Mark - {0x00b62, 0x00b63}, // Oriya Vowel Sign Vocalic..Oriya Vowel Sign Vocalic - {0x00b82, 0x00b82}, // Tamil Sign Anusvara ..Tamil Sign Anusvara - {0x00bc0, 0x00bc0}, // Tamil Vowel Sign Ii ..Tamil Vowel Sign Ii - {0x00bcd, 0x00bcd}, // Tamil Sign Virama ..Tamil Sign Virama - {0x00c00, 0x00c00}, // Telugu Sign Combining Ca..Telugu Sign Combining Ca - {0x00c04, 0x00c04}, // Telugu Sign Combining An..Telugu Sign Combining An - {0x00c3c, 0x00c3c}, // Telugu Sign Nukta ..Telugu Sign Nukta - {0x00c3e, 0x00c40}, // Telugu Vowel Sign Aa ..Telugu Vowel Sign Ii - {0x00c46, 0x00c48}, // Telugu Vowel Sign E ..Telugu Vowel Sign Ai - {0x00c4a, 0x00c4d}, // Telugu Vowel Sign O ..Telugu Sign Virama - {0x00c55, 0x00c56}, // Telugu Length Mark ..Telugu Ai Length Mark - {0x00c62, 0x00c63}, // Telugu Vowel Sign Vocali..Telugu Vowel Sign Vocali - {0x00c81, 0x00c81}, // Kannada Sign Candrabindu..Kannada Sign Candrabindu - {0x00cbc, 0x00cbc}, // Kannada Sign Nukta ..Kannada Sign Nukta - {0x00cbf, 0x00cbf}, // Kannada Vowel Sign I ..Kannada Vowel Sign I - {0x00cc6, 0x00cc6}, // Kannada Vowel Sign E ..Kannada Vowel Sign E - {0x00ccc, 0x00ccd}, // Kannada Vowel Sign Au ..Kannada Sign Virama - {0x00ce2, 0x00ce3}, // Kannada Vowel Sign Vocal..Kannada Vowel Sign Vocal - {0x00d00, 0x00d01}, // Malayalam Sign Combining..Malayalam Sign Candrabin - {0x00d3b, 0x00d3c}, // Malayalam Sign Vertical ..Malayalam Sign Circular - {0x00d41, 0x00d44}, // Malayalam Vowel Sign U ..Malayalam Vowel Sign Voc - {0x00d4d, 0x00d4d}, // Malayalam Sign Virama ..Malayalam Sign Virama - {0x00d62, 0x00d63}, // Malayalam Vowel Sign Voc..Malayalam Vowel Sign Voc - {0x00d81, 0x00d81}, // Sinhala Sign Candrabindu..Sinhala Sign Candrabindu - {0x00dca, 0x00dca}, // Sinhala Sign Al-lakuna ..Sinhala Sign Al-lakuna - {0x00dd2, 0x00dd4}, // Sinhala Vowel Sign Ketti..Sinhala Vowel Sign Ketti - {0x00dd6, 0x00dd6}, // Sinhala Vowel Sign Diga ..Sinhala Vowel Sign Diga - {0x00e31, 0x00e31}, // Thai Character Mai Han-a..Thai Character Mai Han-a - {0x00e34, 0x00e3a}, // Thai Character Sara I ..Thai Character Phinthu - {0x00e47, 0x00e4e}, // Thai Character Maitaikhu..Thai Character Yamakkan - {0x00eb1, 0x00eb1}, // Lao Vowel Sign Mai Kan ..Lao Vowel Sign Mai Kan - {0x00eb4, 0x00ebc}, // Lao Vowel Sign I ..Lao Semivowel Sign Lo - {0x00ec8, 0x00ece}, // Lao Tone Mai Ek ..(nil) - {0x00f18, 0x00f19}, // Tibetan Astrological Sig..Tibetan Astrological Sig - {0x00f35, 0x00f35}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung - {0x00f37, 0x00f37}, // Tibetan Mark Ngas Bzung ..Tibetan Mark Ngas Bzung - {0x00f39, 0x00f39}, // Tibetan Mark Tsa -phru ..Tibetan Mark Tsa -phru - {0x00f71, 0x00f7e}, // Tibetan Vowel Sign Aa ..Tibetan Sign Rjes Su Nga - {0x00f80, 0x00f84}, // Tibetan Vowel Sign Rever..Tibetan Mark Halanta - {0x00f86, 0x00f87}, // Tibetan Sign Lci Rtags ..Tibetan Sign Yang Rtags - {0x00f8d, 0x00f97}, // Tibetan Subjoined Sign L..Tibetan Subjoined Letter - {0x00f99, 0x00fbc}, // Tibetan Subjoined Letter..Tibetan Subjoined Letter - {0x00fc6, 0x00fc6}, // Tibetan Symbol Padma Gda..Tibetan Symbol Padma Gda - {0x0102d, 0x01030}, // Myanmar Vowel Sign I ..Myanmar Vowel Sign Uu - {0x01032, 0x01037}, // Myanmar Vowel Sign Ai ..Myanmar Sign Dot Below - {0x01039, 0x0103a}, // Myanmar Sign Virama ..Myanmar Sign Asat - {0x0103d, 0x0103e}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M - {0x01058, 0x01059}, // Myanmar Vowel Sign Vocal..Myanmar Vowel Sign Vocal - {0x0105e, 0x01060}, // Myanmar Consonant Sign M..Myanmar Consonant Sign M - {0x01071, 0x01074}, // Myanmar Vowel Sign Geba ..Myanmar Vowel Sign Kayah - {0x01082, 0x01082}, // Myanmar Consonant Sign S..Myanmar Consonant Sign S - {0x01085, 0x01086}, // Myanmar Vowel Sign Shan ..Myanmar Vowel Sign Shan - {0x0108d, 0x0108d}, // Myanmar Sign Shan Counci..Myanmar Sign Shan Counci - {0x0109d, 0x0109d}, // Myanmar Vowel Sign Aiton..Myanmar Vowel Sign Aiton - {0x0135d, 0x0135f}, // Ethiopic Combining Gemin..Ethiopic Combining Gemin - {0x01712, 0x01714}, // Tagalog Vowel Sign I ..Tagalog Sign Virama - {0x01732, 0x01733}, // Hanunoo Vowel Sign I ..Hanunoo Vowel Sign U - {0x01752, 0x01753}, // Buhid Vowel Sign I ..Buhid Vowel Sign U - {0x01772, 0x01773}, // Tagbanwa Vowel Sign I ..Tagbanwa Vowel Sign U - {0x017b4, 0x017b5}, // Khmer Vowel Inherent Aq ..Khmer Vowel Inherent Aa - {0x017b7, 0x017bd}, // Khmer Vowel Sign I ..Khmer Vowel Sign Ua - {0x017c6, 0x017c6}, // Khmer Sign Nikahit ..Khmer Sign Nikahit - {0x017c9, 0x017d3}, // Khmer Sign Muusikatoan ..Khmer Sign Bathamasat - {0x017dd, 0x017dd}, // Khmer Sign Atthacan ..Khmer Sign Atthacan - {0x0180b, 0x0180d}, // Mongolian Free Variation..Mongolian Free Variation - {0x0180f, 0x0180f}, // Mongolian Free Variation..Mongolian Free Variation - {0x01885, 0x01886}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal - {0x018a9, 0x018a9}, // Mongolian Letter Ali Gal..Mongolian Letter Ali Gal - {0x01920, 0x01922}, // Limbu Vowel Sign A ..Limbu Vowel Sign U - {0x01927, 0x01928}, // Limbu Vowel Sign E ..Limbu Vowel Sign O - {0x01932, 0x01932}, // Limbu Small Letter Anusv..Limbu Small Letter Anusv - {0x01939, 0x0193b}, // Limbu Sign Mukphreng ..Limbu Sign Sa-i - {0x01a17, 0x01a18}, // Buginese Vowel Sign I ..Buginese Vowel Sign U - {0x01a1b, 0x01a1b}, // Buginese Vowel Sign Ae ..Buginese Vowel Sign Ae - {0x01a56, 0x01a56}, // Tai Tham Consonant Sign ..Tai Tham Consonant Sign - {0x01a58, 0x01a5e}, // Tai Tham Sign Mai Kang L..Tai Tham Consonant Sign - {0x01a60, 0x01a60}, // Tai Tham Sign Sakot ..Tai Tham Sign Sakot - {0x01a62, 0x01a62}, // Tai Tham Vowel Sign Mai ..Tai Tham Vowel Sign Mai - {0x01a65, 0x01a6c}, // Tai Tham Vowel Sign I ..Tai Tham Vowel Sign Oa B - {0x01a73, 0x01a7c}, // Tai Tham Vowel Sign Oa A..Tai Tham Sign Khuen-lue - {0x01a7f, 0x01a7f}, // Tai Tham Combining Crypt..Tai Tham Combining Crypt - {0x01ab0, 0x01ace}, // Combining Doubled Circum..Combining Latin Small Le - {0x01b00, 0x01b03}, // Balinese Sign Ulu Ricem ..Balinese Sign Surang - {0x01b34, 0x01b34}, // Balinese Sign Rerekan ..Balinese Sign Rerekan - {0x01b36, 0x01b3a}, // Balinese Vowel Sign Ulu ..Balinese Vowel Sign Ra R - {0x01b3c, 0x01b3c}, // Balinese Vowel Sign La L..Balinese Vowel Sign La L - {0x01b42, 0x01b42}, // Balinese Vowel Sign Pepe..Balinese Vowel Sign Pepe - {0x01b6b, 0x01b73}, // Balinese Musical Symbol ..Balinese Musical Symbol - {0x01b80, 0x01b81}, // Sundanese Sign Panyecek ..Sundanese Sign Panglayar - {0x01ba2, 0x01ba5}, // Sundanese Consonant Sign..Sundanese Vowel Sign Pan - {0x01ba8, 0x01ba9}, // Sundanese Vowel Sign Pam..Sundanese Vowel Sign Pan - {0x01bab, 0x01bad}, // Sundanese Sign Virama ..Sundanese Consonant Sign - {0x01be6, 0x01be6}, // Batak Sign Tompi ..Batak Sign Tompi - {0x01be8, 0x01be9}, // Batak Vowel Sign Pakpak ..Batak Vowel Sign Ee - {0x01bed, 0x01bed}, // Batak Vowel Sign Karo O ..Batak Vowel Sign Karo O - {0x01bef, 0x01bf1}, // Batak Vowel Sign U For S..Batak Consonant Sign H - {0x01c2c, 0x01c33}, // Lepcha Vowel Sign E ..Lepcha Consonant Sign T - {0x01c36, 0x01c37}, // Lepcha Sign Ran ..Lepcha Sign Nukta - {0x01cd0, 0x01cd2}, // Vedic Tone Karshana ..Vedic Tone Prenkha - {0x01cd4, 0x01ce0}, // Vedic Sign Yajurvedic Mi..Vedic Tone Rigvedic Kash - {0x01ce2, 0x01ce8}, // Vedic Sign Visarga Svari..Vedic Sign Visarga Anuda - {0x01ced, 0x01ced}, // Vedic Sign Tiryak ..Vedic Sign Tiryak - {0x01cf4, 0x01cf4}, // Vedic Tone Candra Above ..Vedic Tone Candra Above - {0x01cf8, 0x01cf9}, // Vedic Tone Ring Above ..Vedic Tone Double Ring A - {0x01dc0, 0x01dff}, // Combining Dotted Grave A..Combining Right Arrowhea - {0x020d0, 0x020f0}, // Combining Left Harpoon A..Combining Asterisk Above - {0x02cef, 0x02cf1}, // Coptic Combining Ni Abov..Coptic Combining Spiritu - {0x02d7f, 0x02d7f}, // Tifinagh Consonant Joine..Tifinagh Consonant Joine - {0x02de0, 0x02dff}, // Combining Cyrillic Lette..Combining Cyrillic Lette - {0x0302a, 0x0302d}, // Ideographic Level Tone M..Ideographic Entering Ton - {0x03099, 0x0309a}, // Combining Katakana-hirag..Combining Katakana-hirag - {0x0a66f, 0x0a672}, // Combining Cyrillic Vzmet..Combining Cyrillic Thous - {0x0a674, 0x0a67d}, // Combining Cyrillic Lette..Combining Cyrillic Payer - {0x0a69e, 0x0a69f}, // Combining Cyrillic Lette..Combining Cyrillic Lette - {0x0a6f0, 0x0a6f1}, // Bamum Combining Mark Koq..Bamum Combining Mark Tuk - {0x0a802, 0x0a802}, // Syloti Nagri Sign Dvisva..Syloti Nagri Sign Dvisva - {0x0a806, 0x0a806}, // Syloti Nagri Sign Hasant..Syloti Nagri Sign Hasant - {0x0a80b, 0x0a80b}, // Syloti Nagri Sign Anusva..Syloti Nagri Sign Anusva - {0x0a825, 0x0a826}, // Syloti Nagri Vowel Sign ..Syloti Nagri Vowel Sign - {0x0a82c, 0x0a82c}, // Syloti Nagri Sign Altern..Syloti Nagri Sign Altern - {0x0a8c4, 0x0a8c5}, // Saurashtra Sign Virama ..Saurashtra Sign Candrabi - {0x0a8e0, 0x0a8f1}, // Combining Devanagari Dig..Combining Devanagari Sig - {0x0a8ff, 0x0a8ff}, // Devanagari Vowel Sign Ay..Devanagari Vowel Sign Ay - {0x0a926, 0x0a92d}, // Kayah Li Vowel Ue ..Kayah Li Tone Calya Plop - {0x0a947, 0x0a951}, // Rejang Vowel Sign I ..Rejang Consonant Sign R - {0x0a980, 0x0a982}, // Javanese Sign Panyangga ..Javanese Sign Layar - {0x0a9b3, 0x0a9b3}, // Javanese Sign Cecak Telu..Javanese Sign Cecak Telu - {0x0a9b6, 0x0a9b9}, // Javanese Vowel Sign Wulu..Javanese Vowel Sign Suku - {0x0a9bc, 0x0a9bd}, // Javanese Vowel Sign Pepe..Javanese Consonant Sign - {0x0a9e5, 0x0a9e5}, // Myanmar Sign Shan Saw ..Myanmar Sign Shan Saw - {0x0aa29, 0x0aa2e}, // Cham Vowel Sign Aa ..Cham Vowel Sign Oe - {0x0aa31, 0x0aa32}, // Cham Vowel Sign Au ..Cham Vowel Sign Ue - {0x0aa35, 0x0aa36}, // Cham Consonant Sign La ..Cham Consonant Sign Wa - {0x0aa43, 0x0aa43}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina - {0x0aa4c, 0x0aa4c}, // Cham Consonant Sign Fina..Cham Consonant Sign Fina - {0x0aa7c, 0x0aa7c}, // Myanmar Sign Tai Laing T..Myanmar Sign Tai Laing T - {0x0aab0, 0x0aab0}, // Tai Viet Mai Kang ..Tai Viet Mai Kang - {0x0aab2, 0x0aab4}, // Tai Viet Vowel I ..Tai Viet Vowel U - {0x0aab7, 0x0aab8}, // Tai Viet Mai Khit ..Tai Viet Vowel Ia - {0x0aabe, 0x0aabf}, // Tai Viet Vowel Am ..Tai Viet Tone Mai Ek - {0x0aac1, 0x0aac1}, // Tai Viet Tone Mai Tho ..Tai Viet Tone Mai Tho - {0x0aaec, 0x0aaed}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign - {0x0aaf6, 0x0aaf6}, // Meetei Mayek Virama ..Meetei Mayek Virama - {0x0abe5, 0x0abe5}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign - {0x0abe8, 0x0abe8}, // Meetei Mayek Vowel Sign ..Meetei Mayek Vowel Sign - {0x0abed, 0x0abed}, // Meetei Mayek Apun Iyek ..Meetei Mayek Apun Iyek - {0x0fb1e, 0x0fb1e}, // Hebrew Point Judeo-spani..Hebrew Point Judeo-spani - {0x0fe00, 0x0fe0f}, // Variation Selector-1 ..Variation Selector-16 - {0x0fe20, 0x0fe2f}, // Combining Ligature Left ..Combining Cyrillic Titlo - {0x101fd, 0x101fd}, // Phaistos Disc Sign Combi..Phaistos Disc Sign Combi - {0x102e0, 0x102e0}, // Coptic Epact Thousands M..Coptic Epact Thousands M - {0x10376, 0x1037a}, // Combining Old Permic Let..Combining Old Permic Let - {0x10a01, 0x10a03}, // Kharoshthi Vowel Sign I ..Kharoshthi Vowel Sign Vo - {0x10a05, 0x10a06}, // Kharoshthi Vowel Sign E ..Kharoshthi Vowel Sign O - {0x10a0c, 0x10a0f}, // Kharoshthi Vowel Length ..Kharoshthi Sign Visarga - {0x10a38, 0x10a3a}, // Kharoshthi Sign Bar Abov..Kharoshthi Sign Dot Belo - {0x10a3f, 0x10a3f}, // Kharoshthi Virama ..Kharoshthi Virama - {0x10ae5, 0x10ae6}, // Manichaean Abbreviation ..Manichaean Abbreviation - {0x10d24, 0x10d27}, // Hanifi Rohingya Sign Har..Hanifi Rohingya Sign Tas - {0x10eab, 0x10eac}, // Yezidi Combining Hamza M..Yezidi Combining Madda M - {0x10efd, 0x10eff}, // (nil) ..(nil) - {0x10f46, 0x10f50}, // Sogdian Combining Dot Be..Sogdian Combining Stroke - {0x10f82, 0x10f85}, // Old Uyghur Combining Dot..Old Uyghur Combining Two - {0x11001, 0x11001}, // Brahmi Sign Anusvara ..Brahmi Sign Anusvara - {0x11038, 0x11046}, // Brahmi Vowel Sign Aa ..Brahmi Virama - {0x11070, 0x11070}, // Brahmi Sign Old Tamil Vi..Brahmi Sign Old Tamil Vi - {0x11073, 0x11074}, // Brahmi Vowel Sign Old Ta..Brahmi Vowel Sign Old Ta - {0x1107f, 0x11081}, // Brahmi Number Joiner ..Kaithi Sign Anusvara - {0x110b3, 0x110b6}, // Kaithi Vowel Sign U ..Kaithi Vowel Sign Ai - {0x110b9, 0x110ba}, // Kaithi Sign Virama ..Kaithi Sign Nukta - {0x110c2, 0x110c2}, // Kaithi Vowel Sign Vocali..Kaithi Vowel Sign Vocali - {0x11100, 0x11102}, // Chakma Sign Candrabindu ..Chakma Sign Visarga - {0x11127, 0x1112b}, // Chakma Vowel Sign A ..Chakma Vowel Sign Uu - {0x1112d, 0x11134}, // Chakma Vowel Sign Ai ..Chakma Maayyaa - {0x11173, 0x11173}, // Mahajani Sign Nukta ..Mahajani Sign Nukta - {0x11180, 0x11181}, // Sharada Sign Candrabindu..Sharada Sign Anusvara - {0x111b6, 0x111be}, // Sharada Vowel Sign U ..Sharada Vowel Sign O - {0x111c9, 0x111cc}, // Sharada Sandhi Mark ..Sharada Extra Short Vowe - {0x111cf, 0x111cf}, // Sharada Sign Inverted Ca..Sharada Sign Inverted Ca - {0x1122f, 0x11231}, // Khojki Vowel Sign U ..Khojki Vowel Sign Ai - {0x11234, 0x11234}, // Khojki Sign Anusvara ..Khojki Sign Anusvara - {0x11236, 0x11237}, // Khojki Sign Nukta ..Khojki Sign Shadda - {0x1123e, 0x1123e}, // Khojki Sign Sukun ..Khojki Sign Sukun - {0x11241, 0x11241}, // (nil) ..(nil) - {0x112df, 0x112df}, // Khudawadi Sign Anusvara ..Khudawadi Sign Anusvara - {0x112e3, 0x112ea}, // Khudawadi Vowel Sign U ..Khudawadi Sign Virama - {0x11300, 0x11301}, // Grantha Sign Combining A..Grantha Sign Candrabindu - {0x1133b, 0x1133c}, // Combining Bindu Below ..Grantha Sign Nukta - {0x11340, 0x11340}, // Grantha Vowel Sign Ii ..Grantha Vowel Sign Ii - {0x11366, 0x1136c}, // Combining Grantha Digit ..Combining Grantha Digit - {0x11370, 0x11374}, // Combining Grantha Letter..Combining Grantha Letter - {0x11438, 0x1143f}, // Newa Vowel Sign U ..Newa Vowel Sign Ai - {0x11442, 0x11444}, // Newa Sign Virama ..Newa Sign Anusvara - {0x11446, 0x11446}, // Newa Sign Nukta ..Newa Sign Nukta - {0x1145e, 0x1145e}, // Newa Sandhi Mark ..Newa Sandhi Mark - {0x114b3, 0x114b8}, // Tirhuta Vowel Sign U ..Tirhuta Vowel Sign Vocal - {0x114ba, 0x114ba}, // Tirhuta Vowel Sign Short..Tirhuta Vowel Sign Short - {0x114bf, 0x114c0}, // Tirhuta Sign Candrabindu..Tirhuta Sign Anusvara - {0x114c2, 0x114c3}, // Tirhuta Sign Virama ..Tirhuta Sign Nukta - {0x115b2, 0x115b5}, // Siddham Vowel Sign U ..Siddham Vowel Sign Vocal - {0x115bc, 0x115bd}, // Siddham Sign Candrabindu..Siddham Sign Anusvara - {0x115bf, 0x115c0}, // Siddham Sign Virama ..Siddham Sign Nukta - {0x115dc, 0x115dd}, // Siddham Vowel Sign Alter..Siddham Vowel Sign Alter - {0x11633, 0x1163a}, // Modi Vowel Sign U ..Modi Vowel Sign Ai - {0x1163d, 0x1163d}, // Modi Sign Anusvara ..Modi Sign Anusvara - {0x1163f, 0x11640}, // Modi Sign Virama ..Modi Sign Ardhacandra - {0x116ab, 0x116ab}, // Takri Sign Anusvara ..Takri Sign Anusvara - {0x116ad, 0x116ad}, // Takri Vowel Sign Aa ..Takri Vowel Sign Aa - {0x116b0, 0x116b5}, // Takri Vowel Sign U ..Takri Vowel Sign Au - {0x116b7, 0x116b7}, // Takri Sign Nukta ..Takri Sign Nukta - {0x1171d, 0x1171f}, // Ahom Consonant Sign Medi..Ahom Consonant Sign Medi - {0x11722, 0x11725}, // Ahom Vowel Sign I ..Ahom Vowel Sign Uu - {0x11727, 0x1172b}, // Ahom Vowel Sign Aw ..Ahom Sign Killer - {0x1182f, 0x11837}, // Dogra Vowel Sign U ..Dogra Sign Anusvara - {0x11839, 0x1183a}, // Dogra Sign Virama ..Dogra Sign Nukta - {0x1193b, 0x1193c}, // Dives Akuru Sign Anusvar..Dives Akuru Sign Candrab - {0x1193e, 0x1193e}, // Dives Akuru Virama ..Dives Akuru Virama - {0x11943, 0x11943}, // Dives Akuru Sign Nukta ..Dives Akuru Sign Nukta - {0x119d4, 0x119d7}, // Nandinagari Vowel Sign U..Nandinagari Vowel Sign V - {0x119da, 0x119db}, // Nandinagari Vowel Sign E..Nandinagari Vowel Sign A - {0x119e0, 0x119e0}, // Nandinagari Sign Virama ..Nandinagari Sign Virama - {0x11a01, 0x11a0a}, // Zanabazar Square Vowel S..Zanabazar Square Vowel L - {0x11a33, 0x11a38}, // Zanabazar Square Final C..Zanabazar Square Sign An - {0x11a3b, 0x11a3e}, // Zanabazar Square Cluster..Zanabazar Square Cluster - {0x11a47, 0x11a47}, // Zanabazar Square Subjoin..Zanabazar Square Subjoin - {0x11a51, 0x11a56}, // Soyombo Vowel Sign I ..Soyombo Vowel Sign Oe - {0x11a59, 0x11a5b}, // Soyombo Vowel Sign Vocal..Soyombo Vowel Length Mar - {0x11a8a, 0x11a96}, // Soyombo Final Consonant ..Soyombo Sign Anusvara - {0x11a98, 0x11a99}, // Soyombo Gemination Mark ..Soyombo Subjoiner - {0x11c30, 0x11c36}, // Bhaiksuki Vowel Sign I ..Bhaiksuki Vowel Sign Voc - {0x11c38, 0x11c3d}, // Bhaiksuki Vowel Sign E ..Bhaiksuki Sign Anusvara - {0x11c3f, 0x11c3f}, // Bhaiksuki Sign Virama ..Bhaiksuki Sign Virama - {0x11c92, 0x11ca7}, // Marchen Subjoined Letter..Marchen Subjoined Letter - {0x11caa, 0x11cb0}, // Marchen Subjoined Letter..Marchen Vowel Sign Aa - {0x11cb2, 0x11cb3}, // Marchen Vowel Sign U ..Marchen Vowel Sign E - {0x11cb5, 0x11cb6}, // Marchen Sign Anusvara ..Marchen Sign Candrabindu - {0x11d31, 0x11d36}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign - {0x11d3a, 0x11d3a}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign - {0x11d3c, 0x11d3d}, // Masaram Gondi Vowel Sign..Masaram Gondi Vowel Sign - {0x11d3f, 0x11d45}, // Masaram Gondi Vowel Sign..Masaram Gondi Virama - {0x11d47, 0x11d47}, // Masaram Gondi Ra-kara ..Masaram Gondi Ra-kara - {0x11d90, 0x11d91}, // Gunjala Gondi Vowel Sign..Gunjala Gondi Vowel Sign - {0x11d95, 0x11d95}, // Gunjala Gondi Sign Anusv..Gunjala Gondi Sign Anusv - {0x11d97, 0x11d97}, // Gunjala Gondi Virama ..Gunjala Gondi Virama - {0x11ef3, 0x11ef4}, // Makasar Vowel Sign I ..Makasar Vowel Sign U - {0x11f00, 0x11f01}, // (nil) ..(nil) - {0x11f36, 0x11f3a}, // (nil) ..(nil) - {0x11f40, 0x11f40}, // (nil) ..(nil) - {0x11f42, 0x11f42}, // (nil) ..(nil) - {0x13440, 0x13440}, // (nil) ..(nil) - {0x13447, 0x13455}, // (nil) ..(nil) - {0x16af0, 0x16af4}, // Bassa Vah Combining High..Bassa Vah Combining High - {0x16b30, 0x16b36}, // Pahawh Hmong Mark Cim Tu..Pahawh Hmong Mark Cim Ta - {0x16f4f, 0x16f4f}, // Miao Sign Consonant Modi..Miao Sign Consonant Modi - {0x16f8f, 0x16f92}, // Miao Tone Right ..Miao Tone Below - {0x16fe4, 0x16fe4}, // Khitan Small Script Fill..Khitan Small Script Fill - {0x1bc9d, 0x1bc9e}, // Duployan Thick Letter Se..Duployan Double Mark - {0x1cf00, 0x1cf2d}, // Znamenny Combining Mark ..Znamenny Combining Mark - {0x1cf30, 0x1cf46}, // Znamenny Combining Tonal..Znamenny Priznak Modifie - {0x1d167, 0x1d169}, // Musical Symbol Combining..Musical Symbol Combining - {0x1d17b, 0x1d182}, // Musical Symbol Combining..Musical Symbol Combining - {0x1d185, 0x1d18b}, // Musical Symbol Combining..Musical Symbol Combining - {0x1d1aa, 0x1d1ad}, // Musical Symbol Combining..Musical Symbol Combining - {0x1d242, 0x1d244}, // Combining Greek Musical ..Combining Greek Musical - {0x1da00, 0x1da36}, // Signwriting Head Rim ..Signwriting Air Sucking - {0x1da3b, 0x1da6c}, // Signwriting Mouth Closed..Signwriting Excitement - {0x1da75, 0x1da75}, // Signwriting Upper Body T..Signwriting Upper Body T - {0x1da84, 0x1da84}, // Signwriting Location Hea..Signwriting Location Hea - {0x1da9b, 0x1da9f}, // Signwriting Fill Modifie..Signwriting Fill Modifie - {0x1daa1, 0x1daaf}, // Signwriting Rotation Mod..Signwriting Rotation Mod - {0x1e000, 0x1e006}, // Combining Glagolitic Let..Combining Glagolitic Let - {0x1e008, 0x1e018}, // Combining Glagolitic Let..Combining Glagolitic Let - {0x1e01b, 0x1e021}, // Combining Glagolitic Let..Combining Glagolitic Let - {0x1e023, 0x1e024}, // Combining Glagolitic Let..Combining Glagolitic Let - {0x1e026, 0x1e02a}, // Combining Glagolitic Let..Combining Glagolitic Let - {0x1e08f, 0x1e08f}, // (nil) ..(nil) - {0x1e130, 0x1e136}, // Nyiakeng Puachue Hmong T..Nyiakeng Puachue Hmong T - {0x1e2ae, 0x1e2ae}, // Toto Sign Rising Tone ..Toto Sign Rising Tone - {0x1e2ec, 0x1e2ef}, // Wancho Tone Tup ..Wancho Tone Koini - {0x1e4ec, 0x1e4ef}, // (nil) ..(nil) - {0x1e8d0, 0x1e8d6}, // Mende Kikakui Combining ..Mende Kikakui Combining - {0x1e944, 0x1e94a}, // Adlam Alif Lengthener ..Adlam Nukta - {0xe0100, 0xe01ef}, // Variation Selector-17 ..Variation Selector-256 -}; - -// https://github.com/jquast/wcwidth/blob/master/wcwidth/table_wide.py -// from https://github.com/jquast/wcwidth/pull/64 -// at commit 1b9b6585b0080ea5cb88dc9815796505724793fe (2022-12-16): -static struct width_interval WIDE_EASTASIAN[] = { - {0x01100, 0x0115f}, // Hangul Choseong Kiyeok ..Hangul Choseong Filler - {0x0231a, 0x0231b}, // Watch ..Hourglass - {0x02329, 0x0232a}, // Left-pointing Angle Brac..Right-pointing Angle Bra - {0x023e9, 0x023ec}, // Black Right-pointing Dou..Black Down-pointing Doub - {0x023f0, 0x023f0}, // Alarm Clock ..Alarm Clock - {0x023f3, 0x023f3}, // Hourglass With Flowing S..Hourglass With Flowing S - {0x025fd, 0x025fe}, // White Medium Small Squar..Black Medium Small Squar - {0x02614, 0x02615}, // Umbrella With Rain Drops..Hot Beverage - {0x02648, 0x02653}, // Aries ..Pisces - {0x0267f, 0x0267f}, // Wheelchair Symbol ..Wheelchair Symbol - {0x02693, 0x02693}, // Anchor ..Anchor - {0x026a1, 0x026a1}, // High Voltage Sign ..High Voltage Sign - {0x026aa, 0x026ab}, // Medium White Circle ..Medium Black Circle - {0x026bd, 0x026be}, // Soccer Ball ..Baseball - {0x026c4, 0x026c5}, // Snowman Without Snow ..Sun Behind Cloud - {0x026ce, 0x026ce}, // Ophiuchus ..Ophiuchus - {0x026d4, 0x026d4}, // No Entry ..No Entry - {0x026ea, 0x026ea}, // Church ..Church - {0x026f2, 0x026f3}, // Fountain ..Flag In Hole - {0x026f5, 0x026f5}, // Sailboat ..Sailboat - {0x026fa, 0x026fa}, // Tent ..Tent - {0x026fd, 0x026fd}, // Fuel Pump ..Fuel Pump - {0x02705, 0x02705}, // White Heavy Check Mark ..White Heavy Check Mark - {0x0270a, 0x0270b}, // Raised Fist ..Raised Hand - {0x02728, 0x02728}, // Sparkles ..Sparkles - {0x0274c, 0x0274c}, // Cross Mark ..Cross Mark - {0x0274e, 0x0274e}, // Negative Squared Cross M..Negative Squared Cross M - {0x02753, 0x02755}, // Black Question Mark Orna..White Exclamation Mark O - {0x02757, 0x02757}, // Heavy Exclamation Mark S..Heavy Exclamation Mark S - {0x02795, 0x02797}, // Heavy Plus Sign ..Heavy Division Sign - {0x027b0, 0x027b0}, // Curly Loop ..Curly Loop - {0x027bf, 0x027bf}, // Double Curly Loop ..Double Curly Loop - {0x02b1b, 0x02b1c}, // Black Large Square ..White Large Square - {0x02b50, 0x02b50}, // White Medium Star ..White Medium Star - {0x02b55, 0x02b55}, // Heavy Large Circle ..Heavy Large Circle - {0x02e80, 0x02e99}, // Cjk Radical Repeat ..Cjk Radical Rap - {0x02e9b, 0x02ef3}, // Cjk Radical Choke ..Cjk Radical C-simplified - {0x02f00, 0x02fd5}, // Kangxi Radical One ..Kangxi Radical Flute - {0x02ff0, 0x02ffb}, // Ideographic Description ..Ideographic Description - {0x03000, 0x0303e}, // Ideographic Space ..Ideographic Variation In - {0x03041, 0x03096}, // Hiragana Letter Small A ..Hiragana Letter Small Ke - {0x03099, 0x030ff}, // Combining Katakana-hirag..Katakana Digraph Koto - {0x03105, 0x0312f}, // Bopomofo Letter B ..Bopomofo Letter Nn - {0x03131, 0x0318e}, // Hangul Letter Kiyeok ..Hangul Letter Araeae - {0x03190, 0x031e3}, // Ideographic Annotation L..Cjk Stroke Q - {0x031f0, 0x0321e}, // Katakana Letter Small Ku..Parenthesized Korean Cha - {0x03220, 0x03247}, // Parenthesized Ideograph ..Circled Ideograph Koto - {0x03250, 0x04dbf}, // Partnership Sign ..Cjk Unified Ideograph-4d - {0x04e00, 0x0a48c}, // Cjk Unified Ideograph-4e..Yi Syllable Yyr - {0x0a490, 0x0a4c6}, // Yi Radical Qot ..Yi Radical Ke - {0x0a960, 0x0a97c}, // Hangul Choseong Tikeut-m..Hangul Choseong Ssangyeo - {0x0ac00, 0x0d7a3}, // Hangul Syllable Ga ..Hangul Syllable Hih - {0x0f900, 0x0faff}, // Cjk Compatibility Ideogr..(nil) - {0x0fe10, 0x0fe19}, // Presentation Form For Ve..Presentation Form For Ve - {0x0fe30, 0x0fe52}, // Presentation Form For Ve..Small Full Stop - {0x0fe54, 0x0fe66}, // Small Semicolon ..Small Equals Sign - {0x0fe68, 0x0fe6b}, // Small Reverse Solidus ..Small Commercial At - {0x0ff01, 0x0ff60}, // Fullwidth Exclamation Ma..Fullwidth Right White Pa - {0x0ffe0, 0x0ffe6}, // Fullwidth Cent Sign ..Fullwidth Won Sign - {0x16fe0, 0x16fe4}, // Tangut Iteration Mark ..Khitan Small Script Fill - {0x16ff0, 0x16ff1}, // Vietnamese Alternate Rea..Vietnamese Alternate Rea - {0x17000, 0x187f7}, // (nil) ..(nil) - {0x18800, 0x18cd5}, // Tangut Component-001 ..Khitan Small Script Char - {0x18d00, 0x18d08}, // (nil) ..(nil) - {0x1aff0, 0x1aff3}, // Katakana Letter Minnan T..Katakana Letter Minnan T - {0x1aff5, 0x1affb}, // Katakana Letter Minnan T..Katakana Letter Minnan N - {0x1affd, 0x1affe}, // Katakana Letter Minnan N..Katakana Letter Minnan N - {0x1b000, 0x1b122}, // Katakana Letter Archaic ..Katakana Letter Archaic - {0x1b132, 0x1b132}, // (nil) ..(nil) - {0x1b150, 0x1b152}, // Hiragana Letter Small Wi..Hiragana Letter Small Wo - {0x1b155, 0x1b155}, // (nil) ..(nil) - {0x1b164, 0x1b167}, // Katakana Letter Small Wi..Katakana Letter Small N - {0x1b170, 0x1b2fb}, // Nushu Character-1b170 ..Nushu Character-1b2fb - {0x1f004, 0x1f004}, // Mahjong Tile Red Dragon ..Mahjong Tile Red Dragon - {0x1f0cf, 0x1f0cf}, // Playing Card Black Joker..Playing Card Black Joker - {0x1f18e, 0x1f18e}, // Negative Squared Ab ..Negative Squared Ab - {0x1f191, 0x1f19a}, // Squared Cl ..Squared Vs - {0x1f200, 0x1f202}, // Square Hiragana Hoka ..Squared Katakana Sa - {0x1f210, 0x1f23b}, // Squared Cjk Unified Ideo..Squared Cjk Unified Ideo - {0x1f240, 0x1f248}, // Tortoise Shell Bracketed..Tortoise Shell Bracketed - {0x1f250, 0x1f251}, // Circled Ideograph Advant..Circled Ideograph Accept - {0x1f260, 0x1f265}, // Rounded Symbol For Fu ..Rounded Symbol For Cai - {0x1f300, 0x1f320}, // Cyclone ..Shooting Star - {0x1f32d, 0x1f335}, // Hot Dog ..Cactus - {0x1f337, 0x1f37c}, // Tulip ..Baby Bottle - {0x1f37e, 0x1f393}, // Bottle With Popping Cork..Graduation Cap - {0x1f3a0, 0x1f3ca}, // Carousel Horse ..Swimmer - {0x1f3cf, 0x1f3d3}, // Cricket Bat And Ball ..Table Tennis Paddle And - {0x1f3e0, 0x1f3f0}, // House Building ..European Castle - {0x1f3f4, 0x1f3f4}, // Waving Black Flag ..Waving Black Flag - {0x1f3f8, 0x1f43e}, // Badminton Racquet And Sh..Paw Prints - {0x1f440, 0x1f440}, // Eyes ..Eyes - {0x1f442, 0x1f4fc}, // Ear ..Videocassette - {0x1f4ff, 0x1f53d}, // Prayer Beads ..Down-pointing Small Red - {0x1f54b, 0x1f54e}, // Kaaba ..Menorah With Nine Branch - {0x1f550, 0x1f567}, // Clock Face One Oclock ..Clock Face Twelve-thirty - {0x1f57a, 0x1f57a}, // Man Dancing ..Man Dancing - {0x1f595, 0x1f596}, // Reversed Hand With Middl..Raised Hand With Part Be - {0x1f5a4, 0x1f5a4}, // Black Heart ..Black Heart - {0x1f5fb, 0x1f64f}, // Mount Fuji ..Person With Folded Hands - {0x1f680, 0x1f6c5}, // Rocket ..Left Luggage - {0x1f6cc, 0x1f6cc}, // Sleeping Accommodation ..Sleeping Accommodation - {0x1f6d0, 0x1f6d2}, // Place Of Worship ..Shopping Trolley - {0x1f6d5, 0x1f6d7}, // Hindu Temple ..Elevator - {0x1f6dc, 0x1f6df}, // (nil) ..Ring Buoy - {0x1f6eb, 0x1f6ec}, // Airplane Departure ..Airplane Arriving - {0x1f6f4, 0x1f6fc}, // Scooter ..Roller Skate - {0x1f7e0, 0x1f7eb}, // Large Orange Circle ..Large Brown Square - {0x1f7f0, 0x1f7f0}, // Heavy Equals Sign ..Heavy Equals Sign - {0x1f90c, 0x1f93a}, // Pinched Fingers ..Fencer - {0x1f93c, 0x1f945}, // Wrestlers ..Goal Net - {0x1f947, 0x1f9ff}, // First Place Medal ..Nazar Amulet - {0x1fa70, 0x1fa7c}, // Ballet Shoes ..Crutch - {0x1fa80, 0x1fa88}, // Yo-yo ..(nil) - {0x1fa90, 0x1fabd}, // Ringed Planet ..(nil) - {0x1fabf, 0x1fac5}, // (nil) ..Person With Crown - {0x1face, 0x1fadb}, // (nil) ..(nil) - {0x1fae0, 0x1fae8}, // Melting Face ..(nil) - {0x1faf0, 0x1faf8}, // Hand With Index Finger A..(nil) - {0x20000, 0x2fffd}, // Cjk Unified Ideograph-20..(nil) - {0x30000, 0x3fffd}, // Cjk Unified Ideograph-30..(nil) -}; - -static bool intable(struct width_interval* table, int table_length, int c) { - // First quick check for Latin1 etc. characters. - if (c < table[0].start) return false; - - // Binary search in table. - int bot = 0; - int top = table_length - 1; - while (top >= bot) { - int mid = (bot + top) / 2; - if (table[mid].end < c) { - bot = mid + 1; - } else if (table[mid].start > c) { - top = mid - 1; - } else { - return true; - } - } - return false; -} - -int wcwidth(wchar_t ucs) { - // NOTE: created by hand, there isn't anything identifiable other than - // general Cf category code to identify these, and some characters in Cf - // category code are of non-zero width. - if (ucs == 0 || - ucs == 0x034F || - (0x200B <= ucs && ucs <= 0x200F) || - ucs == 0x2028 || - ucs == 0x2029 || - (0x202A <= ucs && ucs <= 0x202E) || - (0x2060 <= ucs && ucs <= 0x2063)) { - return 0; - } - - // C0/C1 control characters. - if (ucs < 32 || (0x07F <= ucs && ucs < 0x0A0)) return -1; - - // Combining characters with zero width. - if (intable(ZERO_WIDTH, sizeof(ZERO_WIDTH)/sizeof(struct width_interval), ucs)) return 0; - - return intable(WIDE_EASTASIAN, sizeof(WIDE_EASTASIAN)/sizeof(struct width_interval), ucs) ? 2 : 1; -} diff --git a/src/3rdparty/wcwidch/wcwidth.h b/src/3rdparty/wcwidch/wcwidth.h deleted file mode 100644 index 38c17acd9..000000000 --- a/src/3rdparty/wcwidch/wcwidth.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef WCWIDTH_H_INCLUDED -#define WCWIDTH_H_INCLUDED - -#include - -__BEGIN_DECLS - -int wcwidth(wchar_t ucs); - -__END_DECLS - -#endif diff --git a/src/modules/separator/separator.c b/src/modules/separator/separator.c index 97437c4c4..fc675438d 100644 --- a/src/modules/separator/separator.c +++ b/src/modules/separator/separator.c @@ -14,7 +14,7 @@ static inline uint32_t getWcsWidth(const FFstrbuf* mbstr, wchar_t* wstr, mbstate { const char* str = mbstr->chars; uint32_t wstrLength = (uint32_t) mbsrtowcs(wstr, &str, mbstr->length, state); - int result = wcswidth(wstr, wstrLength); + int result = mk_wcswidth(wstr, wstrLength); return result > 0 ? (uint32_t) result : mbstr->length; } @@ -61,7 +61,7 @@ void ffPrintSeparator(FFSeparatorOptions* options) #else putwchar(wstr[i]); #endif - int width = wcwidth(wstr[i]); + int width = mk_wcwidth(wstr[i]); remaining -= width < 0 ? 0 : width; } } diff --git a/src/util/wcwidth.h b/src/util/wcwidth.h index bc7f19499..4252e0f36 100644 --- a/src/util/wcwidth.h +++ b/src/util/wcwidth.h @@ -2,14 +2,15 @@ #include -#ifndef FF_HAVE_WCWIDTH -#include "3rdparty/wcwidch/wcwidth.h" - -static inline int wcswidth(const wchar_t *pwcs, size_t n) -{ - int res = 0; - while (n-- > 0) - res += wcwidth(*pwcs++); - return res; +#ifdef FF_HAVE_WCWIDTH +static inline int mk_wcwidth(wchar_t ucs) { + return wcwidth(ucs); } +static inline int mk_wcswidth(const wchar_t *pwcs, size_t n) { + return wcswidth(pwcs, n); +} +#else +// https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c +int mk_wcwidth(wchar_t ucs); +int mk_wcswidth(const wchar_t *pwcs, size_t n); #endif From ee60ec3530b0e2ba04211f89b09871a51eea1a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 16:38:43 +0800 Subject: [PATCH 14/28] TerminalShell: don't detect `sh` as a terminal --- src/detection/terminalshell/terminalshell_linux.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index c8c500ee3..e0615a418 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -123,6 +123,9 @@ static void getProcessInformation(pid_t pid, FFstrbuf* processName, FFstrbuf* ex static const char* getProcessNameAndPpid(pid_t pid, char* name, pid_t* ppid, int32_t* tty) { + if (pid <= 0) + return "Invalid pid"; + #ifdef __linux__ char statFilePath[64]; @@ -146,6 +149,8 @@ static const char* getProcessNameAndPpid(pid_t pid, char* name, pid_t* ppid, int if (tty && (tty_ >> 8) == 0x88) *tty = tty_ & 0xFF; + else + *tty = -1; #elif defined(__APPLE__) @@ -209,11 +214,13 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid) name[0] = '\0'; pid_t ppid = 0; + int32_t tty = -1; - while (getProcessNameAndPpid(pid, name, &ppid, &result->tty) == NULL) + while (getProcessNameAndPpid(pid, name, &ppid, &tty) == NULL) { //Common programs that are between terminal and own process, but are not the shell if( + // tty < 0 || //A shell should connect to a tty ffStrEquals(name, "sh") || //This prevents us from detecting things like pipes and redirects, i hope nobody uses plain `sh` as shell ffStrEquals(name, "sudo") || ffStrEquals(name, "su") || @@ -237,6 +244,7 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid) result->pid = (uint32_t) pid; result->ppid = (uint32_t) ppid; + result->tty = tty; ffStrbufSetS(&result->processName, name); getProcessInformation(pid, &result->processName, &result->exe, &result->exeName, &result->exePath); break; @@ -255,6 +263,7 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid) { //Known shells if ( + ffStrEquals(name, "sh") || ffStrEquals(name, "ash") || ffStrEquals(name, "bash") || ffStrEquals(name, "zsh") || From 79ba9d7a68e7697b83b36b997137e946d2dd4eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Tue, 23 Jan 2024 18:51:00 +0800 Subject: [PATCH 15/28] TerminalShell (Linux): fix segfault --- src/detection/terminalshell/terminalshell_linux.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index e0615a418..1366ae686 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -147,10 +147,13 @@ static const char* getProcessNameAndPpid(pid_t pid, char* name, pid_t* ppid, int ) return "sscanf(stat) failed"; - if (tty && (tty_ >> 8) == 0x88) - *tty = tty_ & 0xFF; - else - *tty = -1; + if (tty) + { + if ((tty_ >> 8) == 0x88) + *tty = tty_ & 0xFF; + else + *tty = -1; + } #elif defined(__APPLE__) From 4e2c1244423b1df1627d904af67d8ce1d4c32626 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Tue, 23 Jan 2024 22:38:41 -0700 Subject: [PATCH 16/28] ASCII logos for fedora immutable variants (#700) Container Linux is also deprecated and continued as Fedora CoreOS --- ...{container_linux.txt => fedora_coreos.txt} | 0 src/logo/ascii/fedora_kinoite.txt | 18 ++++++ src/logo/ascii/fedora_sericea.txt | 17 +++++ src/logo/ascii/fedora_silverblue.txt | 17 +++++ src/logo/builtin.c | 64 ++++++++++++++++++- 5 files changed, 115 insertions(+), 1 deletion(-) rename src/logo/ascii/{container_linux.txt => fedora_coreos.txt} (100%) create mode 100644 src/logo/ascii/fedora_kinoite.txt create mode 100644 src/logo/ascii/fedora_sericea.txt create mode 100644 src/logo/ascii/fedora_silverblue.txt diff --git a/src/logo/ascii/container_linux.txt b/src/logo/ascii/fedora_coreos.txt similarity index 100% rename from src/logo/ascii/container_linux.txt rename to src/logo/ascii/fedora_coreos.txt diff --git a/src/logo/ascii/fedora_kinoite.txt b/src/logo/ascii/fedora_kinoite.txt new file mode 100644 index 000000000..1d21a87b9 --- /dev/null +++ b/src/logo/ascii/fedora_kinoite.txt @@ -0,0 +1,18 @@ + ,clll:.$2 .,::::::::::::' +$1:ooooooo$2 .;:::::::::::::: +$1looooooo$2 ,:::::::::::::::' +$1looooooo$2 .:::::::::::::::: +$1looooooo$2 ;:::::::::::::::. +$1looooooo$2 .:::::::::::::::: +$1looooool$2;;;;,:::::::::::::::: +$1looool$2::, .:::::::::::::: +$1looooc$2:: ;:: +$1looooc$2::;. .::; +$1loooool$2:::::::::::. +$1looooooo$2. .::::::' +$1looooooo$2 .::::::,;,.. +$1looooooo$2 :::;' ';:;. +$1looooooo$2 ::: ::: +$1cooooooo$2 .::' '::. +$1 .ooooc $2 ::, ,:: + '''' diff --git a/src/logo/ascii/fedora_sericea.txt b/src/logo/ascii/fedora_sericea.txt new file mode 100644 index 000000000..69f01778c --- /dev/null +++ b/src/logo/ascii/fedora_sericea.txt @@ -0,0 +1,17 @@ + :oooo, .',' + .';;;.;oooooooolooooo' + coooooooooooooooooooooooolc' + .':oooooooooooo$2ll$1ooooooooooooool +.oooooooooooooooo$2ll$1oooooooooooo$2l$1ool +ooooooooooooooooo$2ll$1ooooooooooo$2ll$1oo' + oooo$2l$1oooooooooo$2lll$1ooooooooo$2lll$1oo + .ooooo$2lll$1ooooo$2lll$1ooooooooo$2lll$1ool + .ooooooo$2lll$1oo$2llll$1oooo$2lllll$1ooooo: + 'oooooooo$2llllllllllll$1oooooooo' + .c,.oo$2lllll$1oooooooo.$2 + 'll; + 'll. + lll + lll + ;ll, + .l: diff --git a/src/logo/ascii/fedora_silverblue.txt b/src/logo/ascii/fedora_silverblue.txt new file mode 100644 index 000000000..af96ca6cb --- /dev/null +++ b/src/logo/ascii/fedora_silverblue.txt @@ -0,0 +1,17 @@ + .;ooooooooooooooooooooooooooo. + ,dddddddddddddddddddddddddddddd'$3; +$1 lddddddddddddddddddddddddddddd'$3;;; +$1ddddd$2,XXX.$1ddddd$2,XXX.$1dddd'$2,XXX.$3;;;;; +$1ddddd$2XX$1x$2XX$1ddddd$2XX$1x$2XX$1ddd'$2,XX$3x$2XX$3;;;;; +$1ddddd$2'XXX'$1ddddd$2'XXX'$1dd'$2XXXXXX'$3;;;;; +$1dddddd$2;X;$1ddddddd$2;X:$1d'$2XXX$3;;;;;;;;;;; +$1dddddd$2;X;$1ddddddd$2;X:$2XXX$3;;;;;;;;;;;;; +$1dddddd$2;X;$1dddddd'$2;XXX,,,,,,XXX.$3;;;;; +$1dddddd$2;X;$1dddd'$2XXXX$2XXXXXXXXX$3x$2XX$3;;;;; +$1dddddd$2;X;$1dd'$2XXX$3;;;;;;;;;;;$2XXX$3;;;;;; +$1dddddd$2;X;$1'$2XXX$3;;;;;;;;;;;;;;;;;;;;;; +$1dddddd$2;XXXXX,,,,,,,,,,,,,;XXX:$3;;;;; +$1dddddd$2:XXXXXXXXXXXXXXXXXXXX$3x$2XX$3;;;;; +$1ddddd'$3;;;;;;;;;;;;;;;;;;;$2'XXX'$3;;;;' +$1ddd'$3;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +$1o'$3;;;;;;;;;;;;;;;;;;;;;;;;;;;;' diff --git a/src/logo/builtin.c b/src/logo/builtin.c index 62d141fd1..42bddf865 100644 --- a/src/logo/builtin.c +++ b/src/logo/builtin.c @@ -974,7 +974,7 @@ static const FFlogo C[] = { // ContainerLinux { .names = {"ContainerLinux", "Container Linux", "Container Linux by CoreOS"}, - .lines = FASTFETCH_DATATEXT_LOGO_CONTAINER_LINUX, + .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS, .colors = { FF_COLOR_FG_BLUE, FF_COLOR_FG_WHITE, @@ -1468,6 +1468,68 @@ static const FFlogo F[] = { .colorKeys = FF_COLOR_FG_BLUE, .colorTitle = FF_COLOR_FG_BLUE, }, + // FedoraSilverblue + { + .names = {"Fedora_silverblue", "fedora-silverblue", "fedora-linux-silverblue", "fedora-linux_silverblue"}, + .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SILVERBLUE, + .colors = { + FF_COLOR_FG_BLUE, + FF_COLOR_FG_WHITE, + FF_COLOR_FG_CYAN, + }, + .colorKeys = FF_COLOR_FG_BLUE, + .colorTitle = FF_COLOR_FG_BLUE, + }, + // FedoraKinoite + { + .names = {"Fedora_kinoite", "fedora-kinoite", "fedora-linux-kinoite", "fedora-linux_kinoite"}, + .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_KINOITE, + .colors = { + FF_COLOR_FG_BLUE, + FF_COLOR_FG_WHITE, + }, + .colorKeys = FF_COLOR_FG_BLUE, + .colorTitle = FF_COLOR_FG_BLUE, + }, + // FedoraSericea + { + .names = {"Fedora_sericea", "fedora-sericea", "fedora-linux-sericea", "fedora-linux_sericea"}, + .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_SERICEA, + .colors = { + FF_COLOR_FG_BLUE, + FF_COLOR_FG_WHITE, + }, + .colorKeys = FF_COLOR_FG_BLUE, + .colorTitle = FF_COLOR_FG_BLUE, + }, + // FedoraOnyx placeholder - Currently does not have a logo + //{ + //.names = {"Fedora_onyx", "fedora-onyx", "fedora-linux-onyx", "fedora-linux_onyx"}, + //.type = FF_LOGO_LINE_TYPE_ALTER_BIT, + //.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_ONYX, + //.colors = { + //FF_COLOR_FG_BLUE, + //FF_COLOR_FG_WHITE, + //}, + //.colorKeys = FF_COLOR_FG_BLUE, + //.colorTitle = FF_COLOR_FG_BLUE, + //}, + // FedoraCoreOS + { + .names = {"Fedora_coreos", "fedora-coreos", "fedora-linux-coreos", "fedora-linux_coreos"}, + .type = FF_LOGO_LINE_TYPE_ALTER_BIT, + .lines = FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS, + .colors = { + FF_COLOR_FG_BLUE, + FF_COLOR_FG_WHITE, + FF_COLOR_FG_RED, + }, + .colorKeys = FF_COLOR_FG_BLUE, + .colorTitle = FF_COLOR_FG_WHITE, + }, // FemboyOS { .names = {"FemboyOS"}, From 025a708ecb17e5e72a89e096c716bc4f736f5120 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Wed, 24 Jan 2024 09:27:50 +0800 Subject: [PATCH 17/28] Shell: remove trailing `\0` in JSON output --- src/detection/terminalshell/terminalshell_linux.c | 2 +- src/util/platform/FFPlatform_unix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 1366ae686..02a86baa9 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -86,7 +86,7 @@ static void getProcessInformation(pid_t pid, FFstrbuf* processName, FFstrbuf* ex args, &size, NULL, 0 ) == 0) - ffStrbufSetS(exePath, args); + ffStrbufSetNS(exePath, (uint32_t) (size - 1), args); size = ARG_MAX; if(sysctl( diff --git a/src/util/platform/FFPlatform_unix.c b/src/util/platform/FFPlatform_unix.c index f224c84eb..7500261a4 100644 --- a/src/util/platform/FFPlatform_unix.c +++ b/src/util/platform/FFPlatform_unix.c @@ -33,7 +33,7 @@ static void getExePath(FFPlatform* platform) exePathLen = 0; #endif if (exePathLen > 0) - exePath->length = (uint32_t) exePathLen; + exePath->length = (uint32_t) (exePathLen - 1); } static void platformPathAddEnv(FFlist* dirs, const char* env) From d2a41bdfe10d98d9207a2d8f9c6a21e51d46d810 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 25 Jan 2024 10:18:19 +0800 Subject: [PATCH 18/28] GPU (FreeBSD): drop pciutils dep --- CMakeLists.txt | 3 +- src/detection/gpu/gpu_bsd.c | 150 ++++++++++++++++++++++++++++++++++++ 2 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 src/detection/gpu/gpu_bsd.c diff --git a/CMakeLists.txt b/CMakeLists.txt index fb5da6f14..aafd5745e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -516,7 +516,7 @@ elseif(BSD) src/detection/displayserver/linux/xcb.c src/detection/displayserver/linux/xlib.c src/detection/font/font_linux.c - src/detection/gpu/gpu_linux.c + src/detection/gpu/gpu_bsd.c src/detection/gtk_qt/gtk.c src/detection/host/host_bsd.c src/detection/lm/lm_linux.c @@ -956,6 +956,7 @@ elseif(BSD) PRIVATE "m" PRIVATE "usbhid" PRIVATE "geom" + PRIVATE "devinfo" ) elseif(ANDROID) CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC) diff --git a/src/detection/gpu/gpu_bsd.c b/src/detection/gpu/gpu_bsd.c new file mode 100644 index 000000000..3d26022d1 --- /dev/null +++ b/src/detection/gpu/gpu_bsd.c @@ -0,0 +1,150 @@ +#include "gpu_driver_specific.h" + +#include "common/io/io.h" +#include "3rdparty/nvml/nvml.h" +#include "util/mallocHelper.h" +#include "common/io/io.h" + +#include +#include +#include +#include + +static bool loadPciIds(FFstrbuf* pciids) +{ + // https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/pciconf/pathnames.h + + ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", pciids); + if (pciids->length > 0) return true; + + ffReadFileBuffer("/usr/share/pciids/pci.ids", pciids); + if (pciids->length > 0) return true; + + return false; +} + +const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) +{ + FF_AUTO_CLOSE_FD int fd = open("/dev/pci", O_RDONLY, 0); + struct pci_conf confs[128]; + struct pci_match_conf match = { + .pc_class = PCIC_DISPLAY, + .flags = PCI_GETCONF_MATCH_CLASS, + }; + struct pci_conf_io pcio = { + .pat_buf_len = sizeof(match), + .num_patterns = 1, + .patterns = &match, + .match_buf_len = sizeof(confs), + .matches = confs, + }; + + if (ioctl(fd, PCIOCGETCONF, &pcio) < 0) + return "ioctl(fd, PCIOCGETCONF, &pc) failed"; + + if (pcio.status == PCI_GETCONF_ERROR) + return "ioctl(fd, PCIOCGETCONF, &pc) returned error"; + + FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate(); + loadPciIds(&pciids); + + for (uint32_t i = 0; i < pcio.num_matches; ++i) + { + const struct pci_conf* pc = &confs[i]; + + FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus); + ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString(pc->pc_vendor)); + ffStrbufInit(&gpu->name); + ffStrbufInitS(&gpu->driver, pc->pd_name); + ffStrbufInit(&gpu->platformApi); + gpu->temperature = FF_GPU_TEMP_UNSET; + gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; + gpu->type = FF_GPU_TYPE_UNKNOWN; + gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET; + gpu->deviceId = ((uint64_t) pc->pc_vendor << 16) + pc->pc_device; + gpu->frequency = FF_GPU_FREQUENCY_UNSET; + + if (pciids.length) + { + char buffer[32]; + uint32_t len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n%04x ", pc->pc_vendor); + char* start = (char*) memmem(pciids.chars, pciids.length, buffer, len); + char* end = pciids.chars + pciids.length; + if (start) + { + start += len; + end = memchr(start, '\n', (uint32_t) (end - start)); + if (!end) + end = pciids.chars + pciids.length; + if (!gpu->vendor.length) + ffStrbufSetNS(&gpu->vendor, (uint32_t) (end - start), start); + + start = end; // point to '\n' of vendor + end = start + 1; // point to start of devices + // find the start of next vendor + while (end[0] == '\t' || end[0] == '#') + { + end = strchr(end, '\n'); + if (!end) + { + end = pciids.chars + pciids.length; + break; + } + else + end++; + } + + len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t%04x ", pc->pc_device); + start = memmem(start, (size_t) (end - start), buffer, len); + if (start) + { + start += len; + end = memchr(start, '\n', (uint32_t) (end - start)); + if (!end) + end = pciids.chars + pciids.length; + ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start); + } + } + } + + if (!gpu->name.length) + { + const char* subclass; + switch (pc->pc_subclass) + { + case PCIS_DISPLAY_VGA: subclass = " (VGA compatible)"; break; + case PCIS_DISPLAY_XGA: subclass = " (XGA compatible)"; break; + case PCIS_DISPLAY_3D: subclass = " (3D)"; break; + default: subclass = ""; break; + } + + ffStrbufSetF(&gpu->name, "%s Device %04X%s", gpu->vendor.length ? gpu->vendor.chars : "Unknown", pc->pc_device, subclass); + } + + #ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API + if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific)) + { + ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) { + .type = FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID, + .pciBusId = { + .domain = (uint32_t) pc->pc_sel.pc_domain, + .bus = pc->pc_sel.pc_bus, + .device = pc->pc_sel.pc_dev, + .func = pc->pc_sel.pc_func, + }, + }, (FFGpuDriverResult) { + .temp = options->temp ? &gpu->temperature : NULL, + .memory = options->driverSpecific ? &gpu->dedicated : NULL, + .coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL, + .type = &gpu->type, + .frequency = &gpu->frequency, + }, "libnvidia-ml.so"); + + if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET) + gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED; + } + #endif // FF_USE_PROPRIETARY_GPU_DRIVER_API + } + + return NULL; +} From 2041272f5f8cb73d5468f479cb3455fbb9d2e244 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 25 Jan 2024 16:27:18 +0800 Subject: [PATCH 19/28] GPU (Linux): simpify code --- src/detection/gpu/gpu_linux.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/detection/gpu/gpu_linux.c b/src/detection/gpu/gpu_linux.c index 340893090..1775295f7 100644 --- a/src/detection/gpu/gpu_linux.c +++ b/src/detection/gpu/gpu_linux.c @@ -209,16 +209,8 @@ static void pciHandleDevice(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* { pci->ffpci_fill_info(device, PCI_FILL_CLASS); - char class[1024]; - pci->ffpci_lookup_name(pci->access, class, sizeof(class) - 1, PCI_LOOKUP_CLASS, device->device_class); - - if( - //https://pci-ids.ucw.cz/read/PD/03 - strcasecmp("VGA compatible controller", class) != 0 && - strcasecmp("XGA compatible controller", class) != 0 && - strcasecmp("3D controller", class) != 0 && - strcasecmp("Display controller", class) != 0 - ) return; + if (device->device_class >> 8 != PCI_BASE_CLASS_DISPLAY) + return; pci->ffpci_fill_info(device, PCI_FILL_IDENT); From 77253a8d8139e49afaf4774bccef95e813fb9f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 25 Jan 2024 20:22:28 +0800 Subject: [PATCH 20/28] GPU (FreeBSD): better name detection --- src/detection/gpu/gpu_bsd.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/detection/gpu/gpu_bsd.c b/src/detection/gpu/gpu_bsd.c index 3d26022d1..a75f6cc27 100644 --- a/src/detection/gpu/gpu_bsd.c +++ b/src/detection/gpu/gpu_bsd.c @@ -50,7 +50,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) for (uint32_t i = 0; i < pcio.num_matches; ++i) { - const struct pci_conf* pc = &confs[i]; + struct pci_conf* pc = &confs[i]; FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus); ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString(pc->pc_vendor)); @@ -102,7 +102,17 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus) end = memchr(start, '\n', (uint32_t) (end - start)); if (!end) end = pciids.chars + pciids.length; - ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start); + + char* openingBracket = memchr(start, '[', (uint32_t) (end - start)); + if (openingBracket) + { + openingBracket++; + char* closingBracket = memchr(openingBracket, ']', (uint32_t) (end - openingBracket)); + if (closingBracket) + ffStrbufSetNS(&gpu->name, (uint32_t) (closingBracket - openingBracket), openingBracket); + } + if (!gpu->name.length) + ffStrbufSetNS(&gpu->name, (uint32_t) (end - start), start); } } } From ef7e6d0a6adcb5d8b672ed70ec455dfbdce1b54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 25 Jan 2024 20:22:50 +0800 Subject: [PATCH 21/28] GPU (WSL): fix uninitialized variables --- src/detection/gpu/gpu_wsl.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/detection/gpu/gpu_wsl.cpp b/src/detection/gpu/gpu_wsl.cpp index 91d67e54a..22bab850b 100644 --- a/src/detection/gpu/gpu_wsl.cpp +++ b/src/detection/gpu/gpu_wsl.cpp @@ -68,6 +68,7 @@ const char* ffGPUDetectByDirectX(FF_MAYBE_UNUSED const FFGPUOptions* options, FF gpu->coreCount = FF_GPU_CORE_COUNT_UNSET; gpu->temperature = FF_GPU_TEMP_UNSET; gpu->frequency = FF_GPU_FREQUENCY_UNSET; + ffStrbufInitStatic(&gpu->platformApi, "DXCore"); ffStrbufInit(&gpu->driver); uint64_t value = 0; From 0282b884ccb2bbcfbb895517829a5a23fbc8a54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 09:02:23 +0800 Subject: [PATCH 22/28] OpenCL: fix possible segfaults Found in Alpine Linux --- src/detection/opencl/opencl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/detection/opencl/opencl.c b/src/detection/opencl/opencl.c index 3402c9311..957c1c1dc 100644 --- a/src/detection/opencl/opencl.c +++ b/src/detection/opencl/opencl.c @@ -23,15 +23,15 @@ typedef struct OpenCLData static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result) { - cl_platform_id platformID; - cl_uint numPlatforms; + cl_platform_id platformID = NULL; + cl_uint numPlatforms = 0; data->ffclGetPlatformIDs(1, &platformID, &numPlatforms); if(numPlatforms == 0) return "clGetPlatformIDs returned 0 platforms"; - cl_device_id deviceID; - cl_uint numDevices; + cl_device_id deviceID = NULL; + cl_uint numDevices = 0; data->ffclGetDeviceIDs(platformID, CL_DEVICE_TYPE_GPU, 1, &deviceID, &numDevices); if(numDevices == 0) @@ -40,7 +40,7 @@ static const char* openCLHandleData(OpenCLData* data, FFOpenCLResult* result) if(numDevices == 0) return "clGetDeviceIDs returned 0 devices"; - char version[64]; + char version[64] = ""; data->ffclGetDeviceInfo(deviceID, CL_DEVICE_VERSION, sizeof(version), version, NULL); if(!ffStrSet(version)) return "clGetDeviceInfo returned NULL or empty string"; From 999f2170fe96616917ebdab4fa2dc372b8d3839f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 09:53:12 +0800 Subject: [PATCH 23/28] Terminal: ignore `sshd` --- src/detection/terminalshell/terminalshell_linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/detection/terminalshell/terminalshell_linux.c b/src/detection/terminalshell/terminalshell_linux.c index 02a86baa9..32ded8311 100644 --- a/src/detection/terminalshell/terminalshell_linux.c +++ b/src/detection/terminalshell/terminalshell_linux.c @@ -284,6 +284,7 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid) ffStrEquals(name, "oil.ovm") || ffStrEquals(name, "xonsh") || // works in Linux but not in macOS because kernel returns `Python` in this case ffStrEquals(name, "login") || + ffStrEquals(name, "sshd") || ffStrEndsWith(name, ".sh") ) { From 8e316eb080b120c1c9ef71c8baa99dfce6655033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 10:05:36 +0800 Subject: [PATCH 24/28] Release: v2.6.4 --- CHANGELOG.md | 11 ++++++++++- CMakeLists.txt | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02c43f6c4..771e68c85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,19 @@ # 2.6.4 Features: -* Add new module `TerminalTheme` +* Add new module `TerminalTheme`, which prints the foreground and background color of the current terminal window. Currently doesn't work on Windows. +* Allow command substitution when expanding paths. For example, now it's possible to use `"source": "$(ls ~/path/to/images/*.png | shuf -n 1)"` in JSONC config file to randomly choose an image to display. (#698) +* Use native methods instead of pciutils to detect GPUs in FreeBSD. (GPU, FreeBSD) Bugfixes: * Fix text formatting (Wifi, Linux) +* Fix terminal detection in some cases (Terminal) +* Remove trailing `\0` in JSON results (FreeBSD) +* Fix uninitialized variables (GPU, Linux) +* Fix a possible segfault (OpenCL) + +Logo: +* Add ASCII logos for fedora immutable variants (#700) # 2.6.3 diff --git a/CMakeLists.txt b/CMakeLists.txt index aafd5745e..02feb256b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.6.3 + VERSION 2.6.4 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" From 6b0314f14b3e7fe7e4a36ce1ca1fe5f466ad3fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 10:19:21 +0800 Subject: [PATCH 25/28] Platform: fix exe path detection --- src/util/platform/FFPlatform_unix.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/platform/FFPlatform_unix.c b/src/util/platform/FFPlatform_unix.c index 7500261a4..a233c3bc4 100644 --- a/src/util/platform/FFPlatform_unix.c +++ b/src/util/platform/FFPlatform_unix.c @@ -29,11 +29,13 @@ static void getExePath(FFPlatform* platform) (int[]){CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, (int) getpid()}, 4, exePath->chars, &exePathLen, NULL, 0 - )) + ) < 0) exePathLen = 0; + else + exePathLen--; // remove terminating NUL #endif if (exePathLen > 0) - exePath->length = (uint32_t) (exePathLen - 1); + exePath->length = (uint32_t) exePathLen; } static void platformPathAddEnv(FFlist* dirs, const char* env) From 391a3a043007982a0a25deec1741481b947d7159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 10:23:44 +0800 Subject: [PATCH 26/28] Release: v2.7.0 Bump minor version because of rewriting the FreeBSD GPU detection code --- CHANGELOG.md | 2 +- CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 771e68c85..4f9813b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 2.6.4 +# 2.7.0 Features: * Add new module `TerminalTheme`, which prints the foreground and background color of the current terminal window. Currently doesn't work on Windows. diff --git a/CMakeLists.txt b/CMakeLists.txt index 02feb256b..3fd718b43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url project(fastfetch - VERSION 2.6.4 + VERSION 2.7.0 LANGUAGES C DESCRIPTION "Fast neofetch-like system information tool" HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch" From ef9221f30503dd21d5c75d63fffff359058d7c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 10:41:31 +0800 Subject: [PATCH 27/28] CI: generate sha512sums [no ci] --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdbf5e67d..94dbc2ee0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -402,6 +402,9 @@ jobs: echo -e "\n---\n\n
SHA256SUMs
\n\n\`\`\`" >> fastfetch-release-notes.md sha256sum fastfetch-*/* >> fastfetch-release-notes.md echo -e "\`\`\`\n
" >> fastfetch-release-notes.md + echo -e "\n
SHA512SUMs
\n\n\`\`\`" >> fastfetch-release-notes.md + sha512sum fastfetch-*/* >> fastfetch-release-notes.md + echo -e "\`\`\`\n
" >> fastfetch-release-notes.md - name: update release body if: needs.linux.outputs.ffversion != steps.get_version_release.outputs.release From 9aad3e339a1e0d58131bb6e6099c8b81828927ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 26 Jan 2024 10:44:20 +0800 Subject: [PATCH 28/28] CMake: remove unused deps --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fd718b43..7889e3c42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -956,7 +956,6 @@ elseif(BSD) PRIVATE "m" PRIVATE "usbhid" PRIVATE "geom" - PRIVATE "devinfo" ) elseif(ANDROID) CHECK_LIBRARY_EXISTS(-l:libandroid-wordexp.a wordexp "" HAVE_LIBANDROID_WORDEXP_STATIC)