From 42d5f6bc89eb339ab8dfcc0ac41c697a59e4fc73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 30 Sep 2017 19:11:34 +0200 Subject: [PATCH] decopt 12 configurable --- user/cgi_term_cfg.c | 9 +++++++++ user/screen.c | 10 +++++++++- user/screen.h | 4 +++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/user/cgi_term_cfg.c b/user/cgi_term_cfg.c index 2f5275a..5f62b31 100644 --- a/user/cgi_term_cfg.c +++ b/user/cgi_term_cfg.c @@ -216,6 +216,12 @@ cgiTermCfgSetParams(HttpdConnData *connData) 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")) { cgi_dbg("Screen color theme: %s", buff); n = atoi(buff); @@ -444,6 +450,9 @@ tplTermCfg(HttpdConnData *connData, char *token, void **arg) else if (streq(token, "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")) { sprintf(buff, "%d", (int)termconf->loopback); } diff --git a/user/screen.c b/user/screen.c index e5a6881..7a3a0c2 100644 --- a/user/screen.c +++ b/user/screen.c @@ -211,6 +211,7 @@ terminal_restore_defaults(void) termconf->crlf_mode = SCR_DEF_CRLF; termconf->want_all_fn = SCR_DEF_ALLFN; termconf->debugbar = SCR_DEF_DEBUGBAR; + termconf->allow_decopt_12 = SCR_DEF_DECOPT12; } /** @@ -229,12 +230,17 @@ terminal_apply_settings_noclear(void) { bool changed = false; - // Migrate to v1 + // Migrate if (termconf->config_version < 1) { persist_dbg("termconf: Updating to version %d", 1); termconf->debugbar = SCR_DEF_DEBUGBAR; 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; @@ -1099,6 +1105,8 @@ screen_cursor_shape(enum CursorShape shape) void ICACHE_FLASH_ATTR screen_cursor_blink(bool blink) { + if (!termconf->allow_decopt_12) return; + NOTIFY_LOCK(); if (blink) { if (termconf_live.cursor_shape == CURSOR_BLOCK) termconf_live.cursor_shape = CURSOR_BLOCK_BL; diff --git a/user/screen.h b/user/screen.h index 3f6540e..d69f711 100644 --- a/user/screen.h +++ b/user/screen.h @@ -66,6 +66,7 @@ enum CursorShape { #define SCR_DEF_CRLF 0 // enter sends CRLF #define SCR_DEF_ALLFN 0 // capture F5 etc #define SCR_DEF_DEBUGBAR 0 +#define SCR_DEF_DECOPT12 0 // --- Persistent Settings --- #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 // Must be constant to avoid corrupting user config after upgrade #define TERMCONF_SIZE 300 -#define TERMCONF_VERSION 1 +#define TERMCONF_VERSION 2 typedef struct { u32 width; @@ -96,6 +97,7 @@ typedef struct { bool crlf_mode; bool want_all_fn; bool debugbar; + bool allow_decopt_12; } TerminalConfigBundle; // Live config