decopt 12 configurable

http-comm
Ondřej Hruška 7 years ago
parent d2fe37403f
commit 42d5f6bc89
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 9
      user/cgi_term_cfg.c
  2. 10
      user/screen.c
  3. 4
      user/screen.h

@ -216,6 +216,12 @@ cgiTermCfgSetParams(HttpdConnData *connData)
topics |= TOPIC_CHANGE_SCREEN_OPTS; topics |= TOPIC_CHANGE_SCREEN_OPTS;
} }
if (GET_ARG("allow_decopt_12")) {
cgi_dbg("DECOPT 12: %s", buff);
n = atoi(buff);
termconf->allow_decopt_12 = (bool)n;
}
if (GET_ARG("theme")) { if (GET_ARG("theme")) {
cgi_dbg("Screen color theme: %s", buff); cgi_dbg("Screen color theme: %s", buff);
n = atoi(buff); n = atoi(buff);
@ -444,6 +450,9 @@ tplTermCfg(HttpdConnData *connData, char *token, void **arg)
else if (streq(token, "show_config_links")) { else if (streq(token, "show_config_links")) {
sprintf(buff, "%d", (int)termconf->show_config_links); sprintf(buff, "%d", (int)termconf->show_config_links);
} }
else if (streq(token, "allow_decopt_12")) {
sprintf(buff, "%d", (int)termconf->allow_decopt_12);
}
else if (streq(token, "loopback")) { else if (streq(token, "loopback")) {
sprintf(buff, "%d", (int)termconf->loopback); sprintf(buff, "%d", (int)termconf->loopback);
} }

@ -211,6 +211,7 @@ terminal_restore_defaults(void)
termconf->crlf_mode = SCR_DEF_CRLF; termconf->crlf_mode = SCR_DEF_CRLF;
termconf->want_all_fn = SCR_DEF_ALLFN; termconf->want_all_fn = SCR_DEF_ALLFN;
termconf->debugbar = SCR_DEF_DEBUGBAR; termconf->debugbar = SCR_DEF_DEBUGBAR;
termconf->allow_decopt_12 = SCR_DEF_DECOPT12;
} }
/** /**
@ -229,12 +230,17 @@ terminal_apply_settings_noclear(void)
{ {
bool changed = false; bool changed = false;
// Migrate to v1 // Migrate
if (termconf->config_version < 1) { if (termconf->config_version < 1) {
persist_dbg("termconf: Updating to version %d", 1); persist_dbg("termconf: Updating to version %d", 1);
termconf->debugbar = SCR_DEF_DEBUGBAR; termconf->debugbar = SCR_DEF_DEBUGBAR;
changed = 1; changed = 1;
} }
if (termconf->config_version < 2) {
persist_dbg("termconf: Updating to version %d", 1);
termconf->allow_decopt_12 = SCR_DEF_DECOPT12;
changed = 1;
}
termconf->config_version = TERMCONF_VERSION; termconf->config_version = TERMCONF_VERSION;
@ -1099,6 +1105,8 @@ screen_cursor_shape(enum CursorShape shape)
void ICACHE_FLASH_ATTR void ICACHE_FLASH_ATTR
screen_cursor_blink(bool blink) screen_cursor_blink(bool blink)
{ {
if (!termconf->allow_decopt_12) return;
NOTIFY_LOCK(); NOTIFY_LOCK();
if (blink) { if (blink) {
if (termconf_live.cursor_shape == CURSOR_BLOCK) termconf_live.cursor_shape = CURSOR_BLOCK_BL; if (termconf_live.cursor_shape == CURSOR_BLOCK) termconf_live.cursor_shape = CURSOR_BLOCK_BL;

@ -66,6 +66,7 @@ enum CursorShape {
#define SCR_DEF_CRLF 0 // enter sends CRLF #define SCR_DEF_CRLF 0 // enter sends CRLF
#define SCR_DEF_ALLFN 0 // capture F5 etc #define SCR_DEF_ALLFN 0 // capture F5 etc
#define SCR_DEF_DEBUGBAR 0 #define SCR_DEF_DEBUGBAR 0
#define SCR_DEF_DECOPT12 0
// --- Persistent Settings --- // --- Persistent Settings ---
#define CURSOR_BLINKS(shape) ((shape)==CURSOR_BLOCK_BL||(shape)==CURSOR_UNDERLINE_BL||(shape)==CURSOR_BAR_BL) #define CURSOR_BLINKS(shape) ((shape)==CURSOR_BLOCK_BL||(shape)==CURSOR_UNDERLINE_BL||(shape)==CURSOR_BAR_BL)
@ -73,7 +74,7 @@ enum CursorShape {
// Size designed for the terminal config structure // Size designed for the terminal config structure
// Must be constant to avoid corrupting user config after upgrade // Must be constant to avoid corrupting user config after upgrade
#define TERMCONF_SIZE 300 #define TERMCONF_SIZE 300
#define TERMCONF_VERSION 1 #define TERMCONF_VERSION 2
typedef struct { typedef struct {
u32 width; u32 width;
@ -96,6 +97,7 @@ typedef struct {
bool crlf_mode; bool crlf_mode;
bool want_all_fn; bool want_all_fn;
bool debugbar; bool debugbar;
bool allow_decopt_12;
} TerminalConfigBundle; } TerminalConfigBundle;
// Live config // Live config

Loading…
Cancel
Save