allow zero redraw delay
This commit is contained in:
+1
-1
Submodule front-end updated: a5a157ad56...cee23ca951
+5
-2
@@ -87,12 +87,15 @@ apars_handle_plainchar(char c)
|
|||||||
else {
|
else {
|
||||||
bytes[utf_j++] = c;
|
bytes[utf_j++] = c;
|
||||||
if (utf_j >= utf_len) {
|
if (utf_j >= utf_len) {
|
||||||
// check for bad sequences
|
// check for bad sequences - overlong or some other problem
|
||||||
if (bytes[0] == 0xF4 && bytes[1] > 0x8F) goto fail;
|
if (bytes[0] == 0xF4 && bytes[1] > 0x8F) goto fail;
|
||||||
if (bytes[0] == 0xF0 && bytes[1] < 0x90) goto fail;
|
if (bytes[0] == 0xF0 && bytes[1] < 0x90) goto fail;
|
||||||
if (bytes[0] == 0xED && bytes[1] > 0x9F) goto fail;
|
if (bytes[0] == 0xED && bytes[1] > 0x9F) goto fail;
|
||||||
if (bytes[0] == 0xE0 && bytes[1] < 0xA0) goto fail;
|
if (bytes[0] == 0xE0 && bytes[1] < 0xA0) goto fail;
|
||||||
|
|
||||||
|
// trap for surrogates - those break javascript
|
||||||
|
if (bytes[0] == 0xED && bytes[1] >= 0xA0 && bytes[1] <= 0xBF) goto fail;
|
||||||
|
|
||||||
screen_putchar((const char *) bytes);
|
screen_putchar((const char *) bytes);
|
||||||
apars_reset_utf8buffer();
|
apars_reset_utf8buffer();
|
||||||
}
|
}
|
||||||
@@ -113,5 +116,5 @@ fail:
|
|||||||
apars_show_context();
|
apars_show_context();
|
||||||
apars_reset_utf8buffer();
|
apars_reset_utf8buffer();
|
||||||
ansi_dbg("Temporarily inhibiting parser...");
|
ansi_dbg("Temporarily inhibiting parser...");
|
||||||
TIMER_START(&timerResumeRx, resumeRxCb, 1000, 0);
|
TIMER_START(&timerResumeRx, resumeRxCb, 500, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-6
@@ -21,6 +21,7 @@ volatile ScreenNotifyTopics pendingBroadcastTopics = 0;
|
|||||||
// flags for screen update timeouts
|
// flags for screen update timeouts
|
||||||
volatile bool notify_available = true;
|
volatile bool notify_available = true;
|
||||||
volatile bool notify_cooldown = false;
|
volatile bool notify_cooldown = false;
|
||||||
|
volatile bool notify_scheduled = false;
|
||||||
|
|
||||||
/** True if we sent XOFF to browser to stop uploading,
|
/** True if we sent XOFF to browser to stop uploading,
|
||||||
* and we have to tell it we're ready again */
|
* and we have to tell it we're ready again */
|
||||||
@@ -109,6 +110,7 @@ updateNotifyCb(void *arg)
|
|||||||
|
|
||||||
updateNotify_do(arg, 0);
|
updateNotify_do(arg, 0);
|
||||||
|
|
||||||
|
notify_scheduled = false;
|
||||||
notify_cooldown = true;
|
notify_cooldown = true;
|
||||||
|
|
||||||
TIMER_START(¬ifyCooldownTim, notifyCooldownTimCb, termconf->display_cooldown_ms, 0);
|
TIMER_START(¬ifyCooldownTim, notifyCooldownTimCb, termconf->display_cooldown_ms, 0);
|
||||||
@@ -146,17 +148,16 @@ void ICACHE_FLASH_ATTR screen_notifyChange(ScreenNotifyTopics topics)
|
|||||||
{
|
{
|
||||||
if (term_active_clients == 0) return;
|
if (term_active_clients == 0) return;
|
||||||
|
|
||||||
// this is probably not needed here - ensure timeout is not 0
|
|
||||||
if (termconf->display_tout_ms == 0) {
|
|
||||||
termconf->display_tout_ms = SCR_DEF_DISPLAY_TOUT_MS;
|
|
||||||
}
|
|
||||||
|
|
||||||
inp_dbg("Notify +%02Xh", topics);
|
inp_dbg("Notify +%02Xh", topics);
|
||||||
|
|
||||||
pendingBroadcastTopics |= topics;
|
pendingBroadcastTopics |= topics;
|
||||||
|
|
||||||
|
int time = termconf->display_tout_ms;
|
||||||
|
if (time == 0 && notify_scheduled) return; // do not reset the timer if already scheduled
|
||||||
|
|
||||||
|
notify_scheduled = true;
|
||||||
// NOTE: the timer is restarted if already running
|
// NOTE: the timer is restarted if already running
|
||||||
TIMER_START(&updateNotifyTim, updateNotifyCb, termconf->display_tout_ms, 0); // note - this adds latency to beep
|
TIMER_START(&updateNotifyTim, updateNotifyCb, time, 0); // note - this adds latency to beep
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -148,7 +148,7 @@ cgiTermCfgSetParams(HttpdConnData *connData)
|
|||||||
if (GET_ARG("display_tout_ms")) {
|
if (GET_ARG("display_tout_ms")) {
|
||||||
cgi_dbg("Display update idle timeout: %s ms", buff);
|
cgi_dbg("Display update idle timeout: %s ms", buff);
|
||||||
n = atoi(buff);
|
n = atoi(buff);
|
||||||
if (n > 0) {
|
if (n >= 0) {
|
||||||
termconf->display_tout_ms = n;
|
termconf->display_tout_ms = n;
|
||||||
} else {
|
} else {
|
||||||
cgi_warn("Bad update timeout %s", buff);
|
cgi_warn("Bad update timeout %s", buff);
|
||||||
|
|||||||
+11
-11
@@ -239,12 +239,8 @@ terminal_apply_settings_noclear(void)
|
|||||||
termconf->config_version = TERMCONF_VERSION;
|
termconf->config_version = TERMCONF_VERSION;
|
||||||
|
|
||||||
// Validation...
|
// Validation...
|
||||||
if (termconf->display_tout_ms == 0) {
|
|
||||||
termconf->display_tout_ms = SCR_DEF_DISPLAY_TOUT_MS;
|
|
||||||
changed = 1;
|
|
||||||
}
|
|
||||||
if (termconf->display_cooldown_ms == 0) {
|
if (termconf->display_cooldown_ms == 0) {
|
||||||
termconf->display_cooldown_ms = SCR_DEF_DISPLAY_COOLDOWN_MS;
|
termconf->display_cooldown_ms = 1;
|
||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1781,7 +1777,7 @@ utf8_remap(char *out, char g, char charset)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
utf8_encode(out, utf);
|
utf8_encode(out, utf, false);
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
@@ -1841,7 +1837,7 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics,
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define bufput_utf8(num) do { \
|
#define bufput_utf8(num) do { \
|
||||||
nbytes = utf8_encode(bb, (num)+1); \
|
nbytes = utf8_encode(bb, (num)+1, true); \
|
||||||
bb += nbytes; \
|
bb += nbytes; \
|
||||||
remain -= nbytes; \
|
remain -= nbytes; \
|
||||||
} while(0)
|
} while(0)
|
||||||
@@ -1957,11 +1953,15 @@ screenSerializeToBuffer(char *buffer, size_t buf_len, ScreenNotifyTopics topics,
|
|||||||
bufput_utf8(W);
|
bufput_utf8(W);
|
||||||
bufput_utf8(termconf_live.theme);
|
bufput_utf8(termconf_live.theme);
|
||||||
|
|
||||||
bufput_utf8(termconf_live.default_fg & 0xFFF);
|
bufput_utf8(termconf_live.default_fg & 0xFFFF);
|
||||||
bufput_utf8((u32)(termconf_live.default_fg >> 16) & 0xFFFF);
|
bufput_utf8((termconf_live.default_fg >> 16) & 0xFFFF);
|
||||||
|
|
||||||
bufput_utf8(termconf_live.default_bg & 0xFFF);
|
dbg("Fg %04X,%04X", termconf_live.default_fg & 0xFFFF, (termconf_live.default_fg >> 16) & 0xFFFF);
|
||||||
bufput_utf8((u32)(termconf_live.default_bg >> 16) & 0xFFFF);
|
|
||||||
|
bufput_utf8(termconf_live.default_bg & 0xFFFF);
|
||||||
|
bufput_utf8((termconf_live.default_bg >> 16) & 0xFFFF);
|
||||||
|
|
||||||
|
dbg("Bg %04X,%04X", termconf_live.default_bg & 0xFFFF, (termconf_live.default_bg >> 16) & 0xFFFF);
|
||||||
|
|
||||||
bufput_utf8(
|
bufput_utf8(
|
||||||
(scr.cursor_visible << 0) |
|
(scr.cursor_visible << 0) |
|
||||||
|
|||||||
+6
-1
@@ -160,8 +160,13 @@ unicode_cache_remove(UnicodeCacheRef ref)
|
|||||||
* @return number of bytes on success, 0 on failure (also produces U+FFFD, which uses 3 bytes)
|
* @return number of bytes on success, 0 on failure (also produces U+FFFD, which uses 3 bytes)
|
||||||
*/
|
*/
|
||||||
int ICACHE_FLASH_ATTR
|
int ICACHE_FLASH_ATTR
|
||||||
utf8_encode(char *out, uint32_t utf)
|
utf8_encode(char *out, uint32_t utf, bool surrogateFix)
|
||||||
{
|
{
|
||||||
|
// Skip the surrogate block (wtf, unicode???)
|
||||||
|
if (surrogateFix && utf >= 0xD800) {
|
||||||
|
utf += 0x800;
|
||||||
|
}
|
||||||
|
|
||||||
if (utf <= 0x7F) {
|
if (utf <= 0x7F) {
|
||||||
// Plain ASCII
|
// Plain ASCII
|
||||||
out[0] = (char) utf;
|
out[0] = (char) utf;
|
||||||
|
|||||||
+2
-1
@@ -63,9 +63,10 @@ bool unicode_cache_remove(UnicodeCacheRef ref);
|
|||||||
*
|
*
|
||||||
* @param out - output buffer (min 4 characters), will be 0-terminated if shorten than 4
|
* @param out - output buffer (min 4 characters), will be 0-terminated if shorten than 4
|
||||||
* @param utf - code point 0-0x10FFFF
|
* @param utf - code point 0-0x10FFFF
|
||||||
|
* @param surrogateFix - add 0x800 to 0xD800-0xDFFF to avoid invalid code points
|
||||||
* @return number of bytes on success, 0 on failure (also produces U+FFFD, which uses 3 bytes)
|
* @return number of bytes on success, 0 on failure (also produces U+FFFD, which uses 3 bytes)
|
||||||
*/
|
*/
|
||||||
int utf8_encode(char *out, uint32_t utf);
|
int utf8_encode(char *out, uint32_t utf, bool surrogateFix);
|
||||||
|
|
||||||
#if DEBUG_UTFCACHE
|
#if DEBUG_UTFCACHE
|
||||||
#define utfc_warn warn
|
#define utfc_warn warn
|
||||||
|
|||||||
Reference in New Issue
Block a user