shared/shell: Remove readline color escapes
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 shared/shell: Remove readline color escapes
From: Luiz Augusto von Dentz <[email protected]>
This removes readline color escapes from color defines and instead only used them with prompt since they are only really useful when readline is rendering the text, so it can calculate the prompt length properly.
--- src/shared/shell.c | 10 +++++++++- src/shared/shell.h | 16 ++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-)
src/shared/shell.c +9 -1
@@ -1419,10 +1419,18 @@ bool bt_shell_add_submenu(const struct bt_shell_menu *menu)void bt_shell_set_prompt (const char *string) { +char *prompt; +if (!data.init || data.mode)return ; -rl_set_prompt (string); +if (asprintf (&prompt,"\001%s\002" , string) <0 ) +rl_set_prompt (string); +else { +rl_set_prompt (prompt); +free (prompt); + } +rl_redisplay (); }
src/shared/shell.h +8 -8
@@ -10,14 +10,14 @@#include <getopt.h> #include <stdbool.h> -#define COLOR_OFF "\001\x1B[0m\002" -#define COLOR_RED "\001\x1B[0;91m\002" -#define COLOR_GREEN "\001\x1B[0;92m\002" -#define COLOR_YELLOW "\001\x1B[0;93m\002" -#define COLOR_BLUE "\001\x1B[0;94m\002" -#define COLOR_BOLDGRAY "\001\x1B[1;30m\002" -#define COLOR_BOLDWHITE "\001\x1B[1;37m\002" -#define COLOR_HIGHLIGHT "\001\x1B[1;39m\002" +#define COLOR_OFF "\x1B[0m" +#define COLOR_RED "\x1B[0;91m" +#define COLOR_GREEN "\x1B[0;92m" +#define COLOR_YELLOW "\x1B[0;93m" +#define COLOR_BLUE "\x1B[0;94m" +#define COLOR_BOLDGRAY "\x1B[1;30m" +#define COLOR_BOLDWHITE "\x1B[1;37m" +#define COLOR_HIGHLIGHT "\x1B[1;39m"struct bt_shell_menu ;
Signature · 1 line
2.42.0
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=802082
---Test result---
Test Summary:
CheckPatch PASS 0.43 seconds GitLint PASS 0.30 seconds BuildEll PASS 24.42 seconds BluezMake PASS 560.91 seconds MakeCheck PASS 10.27 seconds MakeDistcheck PASS 152.66 seconds CheckValgrind PASS 212.26 seconds CheckSmatch WARNING 317.05 seconds bluezmakeextell PASS 97.32 seconds IncrementalBuild PASS 511.49 seconds ScanBuild PASS 944.20 seconds
Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Fri, 17 Nov 2023 17:05:06 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This removes readline color escapes from color defines and instead only used them with prompt since they are only really useful when readline is rendering the text, so it can calculate the prompt length properly.
[...]
Here is the summary with links:
- [BlueZ,v2] shared/shell: Remove readline color escapes
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d8fc0dd5942e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html