diff --git a/user/ansi_parser.c b/user/ansi_parser.c index 7cc8e9c..3f53c87 100644 --- a/user/ansi_parser.c +++ b/user/ansi_parser.c @@ -37,7 +37,7 @@ static const int ansi_en_main = 1; // Max nr of CSI parameters #define CSI_N_MAX 10 -#define STR_CHAR_MAX 64 +#define ANSI_STR_LEN 64 static volatile int cs = -1; static volatile bool inside_string = false; @@ -105,7 +105,7 @@ ansi_parser(char newchar) static int arg_ni; static int arg_cnt; static int arg[CSI_N_MAX]; - static char string_buffer[STR_CHAR_MAX]; + static char string_buffer[ANSI_STR_LEN]; static int str_ni; // This is used to detect timeout delay (time since last rx char) diff --git a/user/ansi_parser.rl b/user/ansi_parser.rl index c127f6c..2f74623 100644 --- a/user/ansi_parser.rl +++ b/user/ansi_parser.rl @@ -12,7 +12,7 @@ // Max nr of CSI parameters #define CSI_N_MAX 10 -#define STR_CHAR_MAX 64 +#define ANSI_STR_LEN 64 static volatile int cs = -1; static volatile bool inside_string = false; @@ -80,7 +80,7 @@ ansi_parser(char newchar) static int arg_ni; static int arg_cnt; static int arg[CSI_N_MAX]; - static char string_buffer[STR_CHAR_MAX]; + static char string_buffer[ANSI_STR_LEN]; static int str_ni; // This is used to detect timeout delay (time since last rx char) diff --git a/user/apars_osc.c b/user/apars_osc.c index 83ac913..b13f9d7 100644 --- a/user/apars_osc.c +++ b/user/apars_osc.c @@ -14,13 +14,14 @@ #include "apars_logging.h" #include "screen.h" #include "ansi_parser.h" +#include "cgi_sockets.h" /** * Helper function to parse incoming OSC (Operating System Control) * @param buffer - the OSC body (after OSC and before ST) */ void ICACHE_FLASH_ATTR -apars_handle_osc(const char *buffer) +apars_handle_osc(char *buffer) { int n = 0; char c = 0; @@ -38,6 +39,11 @@ apars_handle_osc(const char *buffer) if (n == 0 || n == 2) { screen_set_title(buffer); } + else if (n == 9) { + buffer--; + buffer[0] = 'g'; + notify_growl(buffer); + } else if (n >= 81 && n <= 85) { // ESPTerm: action button label screen_set_button_text(n - 80, buffer); } diff --git a/user/apars_osc.h b/user/apars_osc.h index cd2c96f..b2c6253 100644 --- a/user/apars_osc.h +++ b/user/apars_osc.h @@ -5,6 +5,6 @@ #ifndef ESP_VT100_FIRMWARE_APARS_OSC_H #define ESP_VT100_FIRMWARE_APARS_OSC_H -void apars_handle_osc(const char *buffer); +void apars_handle_osc(char *buffer); #endif //ESP_VT100_FIRMWARE_APARS_OSC_H diff --git a/user/apars_string.c b/user/apars_string.c index 08de067..dbd2382 100644 --- a/user/apars_string.c +++ b/user/apars_string.c @@ -21,7 +21,7 @@ // ----- Generic String cmd - disambiguation ----- void ICACHE_FLASH_ATTR -apars_handle_string_cmd(char leadchar, const char *buffer) +apars_handle_string_cmd(char leadchar, char *buffer) { switch (leadchar) { case 'k': // ESC k TITLE ST (defined in GNU screen manpage) diff --git a/user/apars_string.h b/user/apars_string.h index 1305905..da566b1 100644 --- a/user/apars_string.h +++ b/user/apars_string.h @@ -5,6 +5,7 @@ #ifndef ESP_VT100_FIRMWARE_APARS_STRING_H #define ESP_VT100_FIRMWARE_APARS_STRING_H -void apars_handle_string_cmd(char leadchar, const char *buffer); +// not const char so some edits can be made when processing +void apars_handle_string_cmd(char leadchar, char *buffer); #endif //ESP_VT100_FIRMWARE_APARS_STRING_H diff --git a/user/cgi_sockets.c b/user/cgi_sockets.c index e409c8f..1fc2879 100644 --- a/user/cgi_sockets.c +++ b/user/cgi_sockets.c @@ -119,6 +119,16 @@ send_beep(void) } +/** Pop-up notification (from iTerm2) */ +void ICACHE_FLASH_ATTR +notify_growl(char *msg) +{ + // TODO via timer... + // here's some potential for a race error with the other broadcast functions :C + cgiWebsockBroadcast(URL_WS_UPDATE, msg, (int) strlen(msg), 0); +} + + /** * Broadcast screen state to sockets. * This is a callback for the Screen module, diff --git a/user/cgi_sockets.h b/user/cgi_sockets.h index 83998cf..3d3a711 100644 --- a/user/cgi_sockets.h +++ b/user/cgi_sockets.h @@ -12,6 +12,9 @@ void notify_empty_txbuf(void); void send_beep(void); +/** open pop-up notification */ +void notify_growl(char *msg); + // defined in the makefile #if DEBUG_INPUT #define ws_warn warn