mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Revert "Use UTF-8 for check buttons and tree open/closed"
This reverts commit 5d5913d355b3a9f03da589b3542b8f55467b4ed6.
This commit is contained in:
parent
47a7d0bd74
commit
f861a2c616
@ -55,20 +55,20 @@ static void MaskItem_delete(Object* cast) {
|
||||
static void MaskItem_display(Object* cast, RichString* out) {
|
||||
MaskItem* this = (MaskItem*)cast;
|
||||
assert (this != NULL);
|
||||
RichString_append(out, CRT_colors[CHECK_BOX], "[");
|
||||
if (this->value == 2)
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], CRT_checkStr[CHECK_STR_FULL]);
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], "x");
|
||||
else if (this->value == 1)
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], CRT_checkStr[CHECK_STR_PARTIAL]);
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], "o");
|
||||
else
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], CRT_checkStr[CHECK_STR_NONE]);
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], " ");
|
||||
RichString_append(out, CRT_colors[CHECK_BOX], "]");
|
||||
RichString_append(out, CRT_colors[CHECK_TEXT], " ");
|
||||
if (this->indent)
|
||||
RichString_append(out, CRT_colors[PROCESS_TREE], this->indent);
|
||||
if (this->sub_tree) {
|
||||
RichString_append(out, CRT_colors[PROCESS_TREE],
|
||||
this->sub_tree == 1
|
||||
? CRT_collapStr[COLLAP_STR_OPEN]
|
||||
: CRT_collapStr[COLLAP_STR_CLOSED]);
|
||||
RichString_append(out, CRT_colors[ PROCESS_TREE],
|
||||
this->sub_tree == 1 ? "[-]" : "[+]");
|
||||
RichString_append(out, CRT_colors[CHECK_TEXT], " ");
|
||||
}
|
||||
RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
|
||||
@ -303,7 +303,7 @@ static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u
|
||||
}
|
||||
|
||||
/* "[x] " + "|- " * depth + ("[+] ")? + name */
|
||||
unsigned width = (CRT_utf8 ? 2 : 4) + 3 * depth + (item->sub_tree ? (CRT_utf8 ? 2 : 4) : 0) + strlen(buf);
|
||||
unsigned width = 4 + 3 * depth + (item->sub_tree ? 4 : 0) + strlen(buf);
|
||||
if (width > this->width)
|
||||
this->width = width;
|
||||
|
||||
|
68
CRT.c
68
CRT.c
@ -59,19 +59,6 @@ typedef enum TreeStr_ {
|
||||
TREE_STR_COUNT
|
||||
} TreeStr;
|
||||
|
||||
typedef enum CheckStr_ {
|
||||
CHECK_STR_NONE,
|
||||
CHECK_STR_PARTIAL,
|
||||
CHECK_STR_FULL,
|
||||
CHECK_STR_COUNT
|
||||
} CheckStr;
|
||||
|
||||
typedef enum CollapStr_ {
|
||||
COLLAP_STR_OPEN,
|
||||
COLLAP_STR_CLOSED,
|
||||
COLLAP_STR_COUNT
|
||||
} CollapStr;
|
||||
|
||||
typedef enum ColorSchemes_ {
|
||||
COLORSCHEME_DEFAULT = 0,
|
||||
COLORSCHEME_MONOCHROME = 1,
|
||||
@ -126,6 +113,7 @@ typedef enum ColorElements_ {
|
||||
LOAD_AVERAGE_FIFTEEN,
|
||||
LOAD_AVERAGE_FIVE,
|
||||
LOAD_AVERAGE_ONE,
|
||||
CHECK_BOX,
|
||||
CHECK_MARK,
|
||||
CHECK_TEXT,
|
||||
CLOCK,
|
||||
@ -171,17 +159,6 @@ const char *CRT_treeStrAscii[TREE_STR_COUNT] = {
|
||||
"-", // TREE_STR_SHUT
|
||||
};
|
||||
|
||||
const char *CRT_checkStrAscii[CHECK_STR_COUNT] = {
|
||||
"[ ]", // CHECK_STR_NONE
|
||||
"[o]", // CHECK_STR_PARTIAL
|
||||
"[x]", // CHECK_STR_FULL
|
||||
};
|
||||
|
||||
const char *CRT_collapStrAscii[COLLAP_STR_COUNT] = {
|
||||
"[-]", // COLLAP_STR_OPEN
|
||||
"[+]", // COLLAP_STR_CLOSED
|
||||
};
|
||||
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
|
||||
const char *CRT_treeStrUtf8[TREE_STR_COUNT] = {
|
||||
@ -194,27 +171,12 @@ const char *CRT_treeStrUtf8[TREE_STR_COUNT] = {
|
||||
"\xe2\x94\x80", // TREE_STR_SHUT ─
|
||||
};
|
||||
|
||||
const char *CRT_checkStrUtf8[CHECK_STR_COUNT] = {
|
||||
"\xe2\x98\x90", // CHECK_STR_NONE ☐
|
||||
"\xe2\x98\x92", // CHECK_STR_PARTIAL ☒
|
||||
"\xe2\x98\x91", // CHECK_STR_FULL ☑
|
||||
};
|
||||
|
||||
const char *CRT_collapStrUtf8[COLLAP_STR_COUNT] = {
|
||||
"\xe2\x8a\x9f", // COLLAP_STR_OPEN ⊟
|
||||
"\xe2\x8a\x9e", // COLLAP_STR_CLOSED ⊞
|
||||
};
|
||||
bool CRT_utf8 = false;
|
||||
|
||||
#endif
|
||||
|
||||
bool CRT_utf8 = false;
|
||||
|
||||
const char **CRT_treeStr = CRT_treeStrAscii;
|
||||
|
||||
const char **CRT_checkStr = CRT_checkStrAscii;
|
||||
|
||||
const char **CRT_collapStr = CRT_collapStrAscii;
|
||||
|
||||
static bool CRT_hasColors;
|
||||
|
||||
int CRT_delay = 0;
|
||||
@ -267,7 +229,8 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = A_BOLD,
|
||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
||||
[CLOCK] = A_BOLD,
|
||||
[CHECK_MARK] = A_BOLD | ColorPair(Cyan,Black),
|
||||
[CHECK_BOX] = ColorPair(Cyan,Black),
|
||||
[CHECK_MARK] = A_BOLD,
|
||||
[CHECK_TEXT] = A_NORMAL,
|
||||
[HOSTNAME] = A_BOLD,
|
||||
[CPU_NICE] = ColorPair(Blue,Black),
|
||||
@ -335,7 +298,8 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = A_BOLD,
|
||||
[HELP_BOLD] = A_BOLD,
|
||||
[CLOCK] = A_BOLD,
|
||||
[CHECK_MARK] = A_BOLD,
|
||||
[CHECK_BOX] = A_BOLD,
|
||||
[CHECK_MARK] = A_NORMAL,
|
||||
[CHECK_TEXT] = A_NORMAL,
|
||||
[HOSTNAME] = A_BOLD,
|
||||
[CPU_NICE] = A_NORMAL,
|
||||
@ -403,6 +367,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = ColorPair(Black,White),
|
||||
[HELP_BOLD] = ColorPair(Blue,White),
|
||||
[CLOCK] = ColorPair(Black,White),
|
||||
[CHECK_BOX] = ColorPair(Blue,White),
|
||||
[CHECK_MARK] = ColorPair(Black,White),
|
||||
[CHECK_TEXT] = ColorPair(Black,White),
|
||||
[HOSTNAME] = ColorPair(Black,White),
|
||||
@ -471,6 +436,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = ColorPair(White,Black),
|
||||
[HELP_BOLD] = ColorPair(Blue,Black),
|
||||
[CLOCK] = ColorPair(White,Black),
|
||||
[CHECK_BOX] = ColorPair(Blue,Black),
|
||||
[CHECK_MARK] = ColorPair(Black,Black),
|
||||
[CHECK_TEXT] = ColorPair(Black,Black),
|
||||
[HOSTNAME] = ColorPair(White,Black),
|
||||
@ -539,7 +505,8 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = A_BOLD | ColorPair(White,Blue),
|
||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Blue),
|
||||
[CLOCK] = ColorPair(White,Blue),
|
||||
[CHECK_MARK] = A_BOLD | ColorPair(Cyan,Blue),
|
||||
[CHECK_BOX] = ColorPair(Cyan,Blue),
|
||||
[CHECK_MARK] = A_BOLD | ColorPair(White,Blue),
|
||||
[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue),
|
||||
[HOSTNAME] = ColorPair(White,Blue),
|
||||
[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue),
|
||||
@ -607,6 +574,7 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||
[LOAD] = A_BOLD,
|
||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
||||
[CLOCK] = ColorPair(Green,Black),
|
||||
[CHECK_BOX] = ColorPair(Green,Black),
|
||||
[CHECK_MARK] = A_BOLD | ColorPair(Green,Black),
|
||||
[CHECK_TEXT] = ColorPair(Cyan,Black),
|
||||
[HOSTNAME] = ColorPair(Green,Black),
|
||||
@ -763,14 +731,18 @@ void CRT_init(int delay, int colorScheme) {
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
||||
if(strcmp(nl_langinfo(CODESET), "UTF-8") == 0)
|
||||
CRT_utf8 = true;
|
||||
CRT_treeStr = CRT_treeStrUtf8;
|
||||
CRT_checkStr = CRT_checkStrUtf8;
|
||||
CRT_collapStr = CRT_collapStrUtf8;
|
||||
}
|
||||
else
|
||||
CRT_utf8 = false;
|
||||
#endif
|
||||
|
||||
CRT_treeStr =
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
CRT_utf8 ? CRT_treeStrUtf8 :
|
||||
#endif
|
||||
CRT_treeStrAscii;
|
||||
|
||||
#if NCURSES_MOUSE_VERSION > 1
|
||||
mousemask(BUTTON1_RELEASED | BUTTON4_PRESSED | BUTTON5_PRESSED, NULL);
|
||||
#else
|
||||
|
28
CRT.h
28
CRT.h
@ -47,19 +47,6 @@ typedef enum TreeStr_ {
|
||||
TREE_STR_COUNT
|
||||
} TreeStr;
|
||||
|
||||
typedef enum CheckStr_ {
|
||||
CHECK_STR_NONE,
|
||||
CHECK_STR_PARTIAL,
|
||||
CHECK_STR_FULL,
|
||||
CHECK_STR_COUNT
|
||||
} CheckStr;
|
||||
|
||||
typedef enum CollapStr_ {
|
||||
COLLAP_STR_OPEN,
|
||||
COLLAP_STR_CLOSED,
|
||||
COLLAP_STR_COUNT
|
||||
} CollapStr;
|
||||
|
||||
typedef enum ColorSchemes_ {
|
||||
COLORSCHEME_DEFAULT = 0,
|
||||
COLORSCHEME_MONOCHROME = 1,
|
||||
@ -114,6 +101,7 @@ typedef enum ColorElements_ {
|
||||
LOAD_AVERAGE_FIFTEEN,
|
||||
LOAD_AVERAGE_FIVE,
|
||||
LOAD_AVERAGE_ONE,
|
||||
CHECK_BOX,
|
||||
CHECK_MARK,
|
||||
CHECK_TEXT,
|
||||
CLOCK,
|
||||
@ -150,28 +138,16 @@ extern void CRT_handleSIGSEGV(int sgn);
|
||||
|
||||
extern const char *CRT_treeStrAscii[TREE_STR_COUNT];
|
||||
|
||||
extern const char *CRT_checkStrAscii[CHECK_STR_COUNT];
|
||||
|
||||
extern const char *CRT_collapStrAscii[COLLAP_STR_COUNT];
|
||||
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
|
||||
extern const char *CRT_treeStrUtf8[TREE_STR_COUNT];
|
||||
|
||||
extern const char *CRT_checkStrUtf8[CHECK_STR_COUNT];
|
||||
|
||||
extern const char *CRT_collapStrUtf8[COLLAP_STR_COUNT];
|
||||
extern bool CRT_utf8;
|
||||
|
||||
#endif
|
||||
|
||||
extern bool CRT_utf8;
|
||||
|
||||
extern const char **CRT_treeStr;
|
||||
|
||||
extern const char **CRT_checkStr;
|
||||
|
||||
extern const char **CRT_collapStr;
|
||||
|
||||
extern int CRT_delay;
|
||||
|
||||
extern int* CRT_colors;
|
||||
|
@ -35,11 +35,12 @@ static void CheckItem_delete(Object* cast) {
|
||||
static void CheckItem_display(Object* cast, RichString* out) {
|
||||
CheckItem* this = (CheckItem*)cast;
|
||||
assert (this != NULL);
|
||||
RichString_write(out, CRT_colors[CHECK_BOX], "[");
|
||||
if (CheckItem_get(this))
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], CRT_checkStr[CHECK_STR_FULL]);
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], "x");
|
||||
else
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], CRT_checkStr[CHECK_STR_NONE]);
|
||||
RichString_append(out, CRT_colors[CHECK_TEXT], " ");
|
||||
RichString_append(out, CRT_colors[CHECK_MARK], " ");
|
||||
RichString_append(out, CRT_colors[CHECK_BOX], "] ");
|
||||
RichString_append(out, CRT_colors[CHECK_TEXT], this->text);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user