Move termType check into its own function

Co-authored-by: Benny Baumann <BenBE@geshi.org>
wilder
Aaron John 2 years ago committed by BenBE
parent 58efa4e131
commit 733acad9c6
  1. 23
      CRT.c

23
CRT.c

@ -1001,6 +1001,27 @@ void CRT_setMouse(bool enabled) {
}
#endif
static bool terminalSupportsDefinedKeys(const char* termType) {
if (!termType) {
return false;
}
switch (termType[0]) {
case 'v':
if (String_eq(termType, "vt220")) {
return true;
}
break;
case 'x':
if (String_eq(termType, "xterm")) {
return true;
}
break;
}
return false;
}
void CRT_init(const Settings* settings, bool allowUnicode, bool retainScreenOnExit) {
initscr();
@ -1046,7 +1067,7 @@ void CRT_init(const Settings* settings, bool allowUnicode, bool retainScreenOnEx
CRT_scrollHAmount = 5;
}
if (termType && (String_startsWith(termType, "xterm") || String_eq(termType, "vt220"))) {
if (terminalSupportsDefinedKeys(termType)) {
#ifdef HTOP_NETBSD
#define define_key(s_, k_) define_key((char*)s_, k_)
IGNORE_WCASTQUAL_BEGIN

Loading…
Cancel
Save