diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmdline.c | 223 | ||||
-rw-r--r-- | src/cmdline.h | 27 | ||||
-rw-r--r-- | src/core-commands.c | 7 | ||||
-rw-r--r-- | src/interface-curses/interface.c | 36 | ||||
-rw-r--r-- | src/interface-gtk/interface.c | 48 | ||||
-rw-r--r-- | src/parser.h | 30 | ||||
-rw-r--r-- | src/sciteco.h | 2 |
7 files changed, 217 insertions, 156 deletions
diff --git a/src/cmdline.c b/src/cmdline.c index 2236872..25b93c3 100644 --- a/src/cmdline.c +++ b/src/cmdline.c @@ -82,7 +82,7 @@ static teco_string_t teco_last_cmdline = {NULL, 0}; * @param error A GError. * @return FALSE to throw a GError */ -gboolean +static gboolean teco_cmdline_insert(const gchar *data, gsize len, GError **error) { const teco_string_t src = {(gchar *)data, len}; @@ -181,7 +181,7 @@ teco_cmdline_insert(const gchar *data, gsize len, GError **error) return TRUE; } -gboolean +static gboolean teco_cmdline_rubin(GError **error) { if (!teco_cmdline.str.len) @@ -194,55 +194,52 @@ teco_cmdline_rubin(GError **error) return teco_cmdline_insert(start, next-start, error); } +/** + * Process key press or expansion of key macro. + * + * Should be called only with the results of a single keypress. + * They are considered an unity and in case of errors, we + * rubout the entire sequence (unless there was a $$ return in the + * middle). + * + * @param data Key presses in UTF-8. + * @param len Length of data. + * @param error A GError. + * @return FALSE if error was set. + * If TRUE was returned, there could still have been an error, + * but it has already been handled. + */ gboolean -teco_cmdline_keypress_wc(gunichar key, GError **error) +teco_cmdline_keypress(const gchar *data, gsize len, GError **error) { + const teco_string_t str = {(gchar *)data, len}; teco_machine_t *machine = &teco_cmdline.machine.parent; - g_autoptr(GError) tmp_error = NULL; + + if (!teco_string_validate_utf8(&str)) { + g_set_error_literal(error, TECO_ERROR, TECO_ERROR_CODEPOINT, + "Invalid UTF-8 sequence"); + return FALSE; + } /* - * Cleanup messages,etc... + * Cleanup messages, etc... */ teco_interface_msg_clear(); - /* - * Process immediate editing commands, inserting - * characters as necessary into the command line. - */ - if (!machine->current->process_edit_cmd_cb(machine, NULL, key, &tmp_error)) { - if (g_error_matches(tmp_error, TECO_ERROR, TECO_ERROR_RETURN)) { - /* - * Return from top-level macro, results - * in command line termination. - * The return "arguments" are currently - * ignored. - */ - g_assert(machine->current == &teco_state_start); + gsize start_pc = teco_cmdline.pc; - teco_interface_popup_clear(); + for (guint i = 0; i < len; i = g_utf8_next_char(data+i) - data) { + gunichar chr = g_utf8_get_char(data+i); + g_autoptr(GError) tmp_error = NULL; - if (teco_quit_requested) { - /* cought by user interface */ - g_set_error_literal(error, TECO_ERROR, TECO_ERROR_QUIT, ""); - return FALSE; - } + /* + * Process immediate editing commands, inserting + * characters as necessary into the command line. + */ + if (machine->current->process_edit_cmd_cb(machine, NULL, chr, &tmp_error)) + continue; - teco_undo_clear(); - /* also empties all Scintilla undo buffers */ - teco_ring_set_scintilla_undo(TRUE); - teco_view_set_scintilla_undo(teco_qreg_view, TRUE); - /* - * FIXME: Reset main machine? - */ - teco_goto_table_clear(&teco_cmdline.machine.goto_table); - teco_expressions_clear(); - g_array_remove_range(teco_loop_stack, 0, teco_loop_stack->len); - - teco_string_clear(&teco_last_cmdline); - teco_last_cmdline = teco_cmdline.str; - memset(&teco_cmdline.str, 0, sizeof(teco_cmdline.str)); - teco_cmdline.effective_len = 0; - } else { + if (!g_error_matches(tmp_error, TECO_ERROR, TECO_ERROR_RETURN)) { /* * NOTE: Error message already displayed in * teco_cmdline_insert(). @@ -252,29 +249,76 @@ teco_cmdline_keypress_wc(gunichar key, GError **error) * is thrown. They must be executed so * as if the character had never been * inserted. + * Actually we rub out the entire command line + * up until the insertion point. */ - teco_undo_pop(teco_cmdline.pc); - teco_cmdline.effective_len = teco_cmdline.pc; + teco_undo_pop(start_pc); + teco_cmdline.effective_len = start_pc; /* program counter could be messed up */ teco_cmdline.machine.macro_pc = teco_cmdline.effective_len; - } #ifdef HAVE_MALLOC_TRIM + /* + * Undo stacks can grow very large - sometimes large enough to + * make the system swap and become unresponsive. + * This shrinks the program break after lots of memory has + * been freed, reducing the virtual memory size and aiding + * in recovering from swapping issues. + * + * This is particularily important with some memory limiting backends + * after hitting the memory limit* as otherwise the program's resident + * size won't shrink and it would be impossible to recover. + */ + if (g_error_matches(tmp_error, TECO_ERROR, TECO_ERROR_MEMLIMIT)) + malloc_trim(0); +#endif + + break; + } + /* - * Undo stacks can grow very large - sometimes large enough to - * make the system swap and become unresponsive. - * This shrinks the program break after lots of memory has - * been freed, reducing the virtual memory size and aiding - * in recovering from swapping issues. - * - * This is particularily important with some memory limiting backends - * after hitting the memory limit* as otherwise the program's resident - * size won't shrink and it would be impossible to recover. + * Return from top-level macro, results + * in command line termination. + * The return "arguments" are currently + * ignored. */ - if (g_error_matches(tmp_error, TECO_ERROR, TECO_ERROR_RETURN) || - g_error_matches(tmp_error, TECO_ERROR, TECO_ERROR_MEMLIMIT)) - malloc_trim(0); + g_assert(machine->current == &teco_state_start); + + teco_interface_popup_clear(); + + if (teco_quit_requested) { + /* caught by user interface */ + g_set_error_literal(error, TECO_ERROR, TECO_ERROR_QUIT, ""); + return FALSE; + } + + teco_undo_clear(); + /* also empties all Scintilla undo buffers */ + teco_ring_set_scintilla_undo(TRUE); + teco_view_set_scintilla_undo(teco_qreg_view, TRUE); + /* + * FIXME: Reset main machine? + */ + teco_goto_table_clear(&teco_cmdline.machine.goto_table); + teco_expressions_clear(); + g_array_remove_range(teco_loop_stack, 0, teco_loop_stack->len); + + teco_string_clear(&teco_last_cmdline); + teco_last_cmdline = teco_cmdline.str; + memset(&teco_cmdline.str, 0, sizeof(teco_cmdline.str)); + teco_cmdline.effective_len = 0; + +#ifdef HAVE_MALLOC_TRIM + /* see above */ + malloc_trim(0); #endif + + /* + * Continue with the other keys, + * but we obviously can't rub out beyond the return if any + * error occurs later on. + */ + start_pc = teco_cmdline.pc; } /* @@ -284,57 +328,40 @@ teco_cmdline_keypress_wc(gunichar key, GError **error) return TRUE; } -/* - * FIXME: If one character causes an error, we should rub out the - * entire string. - * Usually it will be called only with single keys (strings containing - * single codepoints), but especially teco_cmdline_fnmacro() can emulate - * many key presses at once. - */ -gboolean -teco_cmdline_keypress(const gchar *str, gsize len, GError **error) -{ - for (guint i = 0; i < len; i += g_utf8_next_char(str+i) - (str+i)) { - gunichar chr = g_utf8_get_char_validated(str+i, len-i); - if ((gint32)chr < 0) { - g_set_error_literal(error, TECO_ERROR, TECO_ERROR_CODEPOINT, - "Invalid UTF-8 sequence"); - return FALSE; - } - if (!teco_cmdline_keypress_wc(chr, error)) - return FALSE; - } - - return TRUE; -} - -gboolean -teco_cmdline_fnmacro(const gchar *name, GError **error) +teco_keymacro_status_t +teco_cmdline_keymacro(const gchar *name, gssize name_len, GError **error) { g_assert(name != NULL); + if (name_len < 0) + name_len = strlen(name); + /* * NOTE: It should be safe to allocate on the stack since * there are only a limited number of possible function key macros. */ - gchar macro_name[1 + strlen(name)]; - macro_name[0] = TECO_CTL_KEY('F'); - memcpy(macro_name+1, name, sizeof(macro_name)-1); - - teco_qreg_t *macro_reg; + gchar macro_name[1 + name_len]; + macro_name[0] = TECO_CTL_KEY('K'); + memcpy(macro_name+1, name, name_len); - if (teco_ed & TECO_ED_FNKEYS && - (macro_reg = teco_qreg_table_find(&teco_qreg_table_globals, macro_name, sizeof(macro_name)))) { + teco_qreg_t *macro_reg = teco_qreg_table_find(&teco_qreg_table_globals, macro_name, sizeof(macro_name)); + if (macro_reg) { teco_int_t macro_mask; if (!macro_reg->vtable->get_integer(macro_reg, ¯o_mask, error)) - return FALSE; + return TECO_KEYMACRO_ERROR; - if (macro_mask & teco_cmdline.machine.parent.current->fnmacro_mask) - return TRUE; + /* + * FIXME: This does not work with Q-Register specs embedded into string arguments. + * There should be a keymacro_mask_cb() instead. + */ + if (!((teco_cmdline.machine.parent.current->keymacro_mask | + teco_cmdline.machine.expectstring.machine.parent.current->keymacro_mask) & ~macro_mask)) + return TECO_KEYMACRO_UNDEFINED; g_auto(teco_string_t) macro_str = {NULL, 0}; return macro_reg->vtable->get_string(macro_reg, ¯o_str.data, ¯o_str.len, NULL, error) && - teco_cmdline_keypress(macro_str.data, macro_str.len, error); + teco_cmdline_keypress(macro_str.data, macro_str.len, error) + ? TECO_KEYMACRO_SUCCESS : TECO_KEYMACRO_ERROR; } /* @@ -342,20 +369,16 @@ teco_cmdline_fnmacro(const gchar *name, GError **error) * except "CLOSE" which quits the application * (this may loose unsaved data but is better than * not doing anything if the user closes the window). - * NOTE: Doing the check here is less efficient than - * doing it in the UI implementations, but defines - * the default actions centrally. - * Also, fnmacros are only handled after key presses. */ - if (!strcmp(name, "CLOSE")) { + if (name_len == 5 && !strncmp(name, "CLOSE", name_len)) { g_set_error_literal(error, TECO_ERROR, TECO_ERROR_QUIT, ""); - return FALSE; + return TECO_KEYMACRO_ERROR; } - return TRUE; + return TECO_KEYMACRO_UNDEFINED; } -void +static void teco_cmdline_rubout(void) { const gchar *p; diff --git a/src/cmdline.h b/src/cmdline.h index 4aa862c..f4b84e4 100644 --- a/src/cmdline.h +++ b/src/cmdline.h @@ -60,16 +60,29 @@ typedef struct { extern teco_cmdline_t teco_cmdline; -gboolean teco_cmdline_insert(const gchar *data, gsize len, GError **error); +gboolean teco_cmdline_keypress(const gchar *data, gsize len, GError **error); -gboolean teco_cmdline_rubin(GError **error); +typedef enum { + TECO_KEYMACRO_ERROR = 0, /**< GError occurred */ + TECO_KEYMACRO_SUCCESS, /**< key macro found and inserted */ + TECO_KEYMACRO_UNDEFINED /**< no key macro found */ +} teco_keymacro_status_t; -gboolean teco_cmdline_keypress_wc(gunichar key, GError **error); -gboolean teco_cmdline_keypress(const gchar *str, gsize len, GError **error); +teco_keymacro_status_t teco_cmdline_keymacro(const gchar *name, gssize name_len, GError **error); -gboolean teco_cmdline_fnmacro(const gchar *name, GError **error); - -void teco_cmdline_rubout(void); +static inline gboolean +teco_cmdline_keymacro_c(gchar key, GError **error) +{ + switch (teco_cmdline_keymacro(&key, sizeof(key), error)) { + case TECO_KEYMACRO_ERROR: + return FALSE; + case TECO_KEYMACRO_SUCCESS: + break; + case TECO_KEYMACRO_UNDEFINED: + return teco_cmdline_keypress(&key, sizeof(key), error); + } + return TRUE; +} extern gboolean teco_quit_requested; diff --git a/src/core-commands.c b/src/core-commands.c index ef763d5..c5c60a8 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -1164,7 +1164,7 @@ teco_state_start_input(teco_machine_main_t *ctx, gunichar chr, GError **error) * * FIXME: Maybe, there should be a special teco_state_t * for beginnings of command-lines? - * It could also be used for a corresponding FNMACRO mask. + * It could also be used for a corresponding KEYMACRO mask. */ if (teco_cmdline.effective_len == 1 && teco_cmdline.str.data[0] == '*') return &teco_state_save_cmdline; @@ -1260,7 +1260,7 @@ teco_state_start_input(teco_machine_main_t *ctx, gunichar chr, GError **error) TECO_DEFINE_STATE_CASEINSENSITIVE(teco_state_start, .end_of_macro_cb = NULL, /* Allowed at the end of a macro! */ .is_start = TRUE, - .fnmacro_mask = TECO_FNMACRO_MASK_START + .keymacro_mask = TECO_KEYMACRO_MASK_START | TECO_KEYMACRO_MASK_CASEINSENSITIVE ); /*$ F< @@ -1971,7 +1971,7 @@ TECO_DEFINE_STATE_CASEINSENSITIVE(teco_state_escape, * when it comes to function key macro masking. */ .is_start = TRUE, - .fnmacro_mask = TECO_FNMACRO_MASK_START + .keymacro_mask = TECO_KEYMACRO_MASK_START | TECO_KEYMACRO_MASK_CASEINSENSITIVE ); /*$ EF close @@ -2058,7 +2058,6 @@ teco_state_ecommand_close(teco_machine_main_t *ctx, GError **error) * of files. * - 32: Enable/Disable buffer editing hooks * (via execution of macro in global Q-Register \(lqED\(rq) - * - 64: Enable/Disable function key macros * - 128: Enable/Disable enforcement of UNIX98 * \(lq/bin/sh\(rq emulation for operating system command * executions diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 96254a9..1581d98 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1545,7 +1545,7 @@ teco_interface_blocking_getch(void) * escape sequences. */ #ifdef NCURSES_UNIX - keypad(teco_interface.cmdline_window, teco_ed & TECO_ED_FNKEYS); + keypad(teco_interface.cmdline_window, TRUE); #endif /* no special <CTRL/C> handling */ @@ -1585,6 +1585,8 @@ teco_interface_event_loop_iter(void) static gchar keybuf[4]; static gint keybuf_i = 0; + GError **error = &teco_interface.event_loop_error; + gint key = g_queue_is_empty(teco_interface.input_queue) ? teco_interface_blocking_getch() : GPOINTER_TO_INT(g_queue_pop_head(teco_interface.input_queue)); @@ -1613,24 +1615,24 @@ teco_interface_event_loop_iter(void) * backspace. * In SciTECO backspace is normalized to ^H. */ - if (!teco_cmdline_keypress_wc(TECO_CTL_KEY('H'), - &teco_interface.event_loop_error)) + if (!teco_cmdline_keymacro_c(TECO_CTL_KEY('H'), error)) return; break; case KEY_ENTER: case '\r': case '\n': - if (!teco_cmdline_keypress_wc('\n', &teco_interface.event_loop_error)) + if (!teco_cmdline_keymacro_c('\n', error)) return; break; /* * Function key macros - * FIXME: What about keyname()? + * + * FIXME: Perhaps support everything returned by keyname()? */ #define FN(KEY) \ case KEY_##KEY: \ - if (!teco_cmdline_fnmacro(#KEY, &teco_interface.event_loop_error)) \ + if (!teco_cmdline_keymacro(#KEY, -1, error)) \ return; \ break #define FNS(KEY) FN(KEY); FN(S##KEY) @@ -1640,9 +1642,8 @@ teco_interface_event_loop_iter(void) gchar macro_name[3+1]; g_snprintf(macro_name, sizeof(macro_name), - "F%d", key - KEY_F0); - if (!teco_cmdline_fnmacro(macro_name, - &teco_interface.event_loop_error)) + "F%d", key - KEY_F0); + if (!teco_cmdline_keymacro(macro_name, -1, error)) return; break; } @@ -1662,6 +1663,7 @@ teco_interface_event_loop_iter(void) */ default: if (key > 0xFF) + /* unhandled function key */ return; /* @@ -1669,12 +1671,22 @@ teco_interface_event_loop_iter(void) * a widechar version of Curses. */ keybuf[keybuf_i++] = key; - gunichar cp = g_utf8_get_char_validated(keybuf, keybuf_i); + gsize len = keybuf_i; + gunichar cp = g_utf8_get_char_validated(keybuf, len); if (keybuf_i >= sizeof(keybuf) || cp != (gunichar)-2) keybuf_i = 0; - if ((gint32)cp < 0 || - !teco_cmdline_keypress_wc(cp, &teco_interface.event_loop_error)) + if ((gint32)cp < 0) + /* incomplete or invalid */ return; + switch (teco_cmdline_keymacro(keybuf, len, error)) { + case TECO_KEYMACRO_ERROR: + return; + case TECO_KEYMACRO_SUCCESS: + break; + case TECO_KEYMACRO_UNDEFINED: + if (!teco_cmdline_keypress(keybuf, len, error)) + return; + } } teco_interface_refresh(); diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 9c1ce6a..f19c76c 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -927,19 +927,19 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) switch (event->keyval) { case GDK_KEY_Escape: - if (!teco_cmdline_keypress_wc('\e', error)) + if (!teco_cmdline_keymacro_c('\e', error)) return FALSE; break; case GDK_KEY_BackSpace: - if (!teco_cmdline_keypress_wc(TECO_CTL_KEY('H'), error)) + if (!teco_cmdline_keymacro_c(TECO_CTL_KEY('H'), error)) return FALSE; break; case GDK_KEY_Tab: - if (!teco_cmdline_keypress_wc('\t', error)) + if (!teco_cmdline_keymacro_c('\t', error)) return FALSE; break; case GDK_KEY_Return: - if (!teco_cmdline_keypress_wc('\n', error)) + if (!teco_cmdline_keymacro_c('\n', error)) return FALSE; break; @@ -948,12 +948,12 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) */ #define FN(KEY, MACRO) \ case GDK_KEY_##KEY: \ - if (!teco_cmdline_fnmacro(#MACRO, error)) \ + if (!teco_cmdline_keymacro(#MACRO, -1, error)) \ return FALSE; \ break #define FNS(KEY, MACRO) \ case GDK_KEY_##KEY: \ - if (!teco_cmdline_fnmacro(event->state & GDK_SHIFT_MASK ? "S" #MACRO : #MACRO, error)) \ + if (!teco_cmdline_keymacro(event->state & GDK_SHIFT_MASK ? "S" #MACRO : #MACRO, -1, error)) \ return FALSE; \ break FN(Down, DOWN); FN(Up, UP); @@ -965,8 +965,8 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) gchar macro_name[3+1]; g_snprintf(macro_name, sizeof(macro_name), - "F%d", event->keyval - GDK_KEY_F1 + 1); - if (!teco_cmdline_fnmacro(macro_name, error)) + "F%d", event->keyval - GDK_KEY_F1 + 1); + if (!teco_cmdline_keymacro(macro_name, -1, error)) return FALSE; break; } @@ -994,13 +994,35 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) if ((event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) == GDK_CONTROL_MASK) { gchar c = teco_interface_get_ansi_key(event); if (c) { - if (!teco_cmdline_keypress_wc(TECO_CTL_KEY(g_ascii_toupper(c)), error)) + if (!teco_cmdline_keymacro_c(TECO_CTL_KEY(g_ascii_toupper(c)), error)) return FALSE; break; } } /* + * First look up a key macro. + * Only if it's undefined, we try to automatically find an ANSI key. + * On the downside, this means we cannot define key macros for dead keys + * or keys that require some sort of input method editing. + * + * FIXME: This might be a good reason to be able to disable the + * automatic ANSIfication, as we could look up the key macro in + * teco_interface_cmdline_commit_cb(). + */ + gunichar cp = gdk_keyval_to_unicode(event->keyval); + if (cp) { + char buf[6]; + gsize len = g_unichar_to_utf8(cp, buf); + teco_keymacro_status_t rc = teco_cmdline_keymacro(buf, len, error); + if (rc == TECO_KEYMACRO_ERROR) + return FALSE; + if (rc == TECO_KEYMACRO_SUCCESS) + break; + g_assert(rc == TECO_KEYMACRO_UNDEFINED); + } + + /* * If the current state is case-insensitive, it is a command name - * which consists only of ANSI letters - we try to * accept non-ANSI letters as well. @@ -1010,10 +1032,11 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) * within Q-Register specs as well. * Unfortunately, Q-Reg specs and string building can be nested * indefinitely. - * This would effectively require a new is_case_sensitive_cb(). + * This would effectively require a new keymacro_mask_cb(). */ - if (teco_cmdline.machine.parent.current->is_case_insensitive || - teco_cmdline.machine.expectstring.machine.parent.current->is_case_insensitive) + if ((teco_cmdline.machine.parent.current->keymacro_mask | + teco_cmdline.machine.expectstring.machine.parent.current->keymacro_mask) & + TECO_KEYMACRO_MASK_CASEINSENSITIVE) teco_interface_get_ansi_key(event); /* @@ -1029,7 +1052,6 @@ teco_interface_handle_key_press(GdkEventKey *event, GError **error) } teco_interface_refresh(teco_interface_current_view != last_view); - return TRUE; } diff --git a/src/parser.h b/src/parser.h index fe7f559..0303bae 100644 --- a/src/parser.h +++ b/src/parser.h @@ -108,10 +108,11 @@ typedef gboolean (*teco_state_process_edit_cmd_cb_t)(teco_machine_t *ctx, teco_m gunichar key, GError **error); typedef enum { - TECO_FNMACRO_MASK_START = (1 << 0), - TECO_FNMACRO_MASK_STRING = (1 << 1), - TECO_FNMACRO_MASK_DEFAULT = ~((1 << 2)-1) -} teco_fnmacro_mask_t; + TECO_KEYMACRO_MASK_START = (1 << 0), + TECO_KEYMACRO_MASK_STRING = (1 << 1), + TECO_KEYMACRO_MASK_CASEINSENSITIVE = (1 << 2), + TECO_KEYMACRO_MASK_DEFAULT = ~((1 << 3)-1) +} teco_keymacro_mask_t; /** * A teco_machine_t state. @@ -184,28 +185,19 @@ struct teco_state_t { /** * Whether this state is a start state (ie. not within any * escape sequence etc.). - * This is separate of TECO_FNMACRO_MASK_START which is set + * This is separate of TECO_KEYMACRO_MASK_START which is set * only in the main machine's start states. */ bool is_start : 1; /** - * Whether this state accepts case insensitive characters, - * ie. is part of a command name, that can be case folded. - * This is also used to determine which state accepts only - * ANSI characters. - * @fixme But it should be callback to detect all - * string building constructs nested in Q-Reg specs. - */ - bool is_case_insensitive : 1; - /** - * Function key macro mask. + * Key macro mask. * This is not a bitmask since it is compared with values set * from TECO, so the bitorder needs to be defined. * * @fixme If we intend to "forward" masks from other state machines like * teco_machine_stringbuilding_t, this should probably be a callback. */ - teco_fnmacro_mask_t fnmacro_mask : 8; + teco_keymacro_mask_t keymacro_mask : 8; /** * Additional state-dependent callbacks and settings. @@ -245,7 +237,7 @@ gboolean teco_state_process_edit_cmd(teco_machine_t *ctx, teco_machine_t *parent .end_of_macro_cb = teco_state_end_of_macro, \ .process_edit_cmd_cb = teco_state_process_edit_cmd, \ .is_start = FALSE, \ - .fnmacro_mask = TECO_FNMACRO_MASK_DEFAULT, \ + .keymacro_mask = TECO_KEYMACRO_MASK_DEFAULT, \ ##__VA_ARGS__ \ } @@ -268,7 +260,7 @@ gboolean teco_state_caseinsensitive_process_edit_cmd(teco_machine_t *ctx, teco_m */ #define TECO_DEFINE_STATE_CASEINSENSITIVE(NAME, ...) \ TECO_DEFINE_STATE(NAME, \ - .is_case_insensitive = TRUE, \ + .keymacro_mask = TECO_KEYMACRO_MASK_CASEINSENSITIVE, \ .process_edit_cmd_cb = teco_state_caseinsensitive_process_edit_cmd, \ ##__VA_ARGS__ \ ) @@ -552,7 +544,7 @@ gboolean teco_state_expectstring_process_edit_cmd(teco_machine_main_t *ctx, teco .refresh_cb = (teco_state_refresh_cb_t)teco_state_expectstring_refresh, \ .process_edit_cmd_cb = (teco_state_process_edit_cmd_cb_t) \ teco_state_expectstring_process_edit_cmd, \ - .fnmacro_mask = TECO_FNMACRO_MASK_STRING, \ + .keymacro_mask = TECO_KEYMACRO_MASK_STRING, \ .expectstring.string_building = TRUE, \ .expectstring.last = TRUE, \ .expectstring.process_cb = NULL, /* do nothing */ \ diff --git a/src/sciteco.h b/src/sciteco.h index 02eed97..894bb90 100644 --- a/src/sciteco.h +++ b/src/sciteco.h @@ -89,7 +89,7 @@ enum { TECO_ED_AUTOCASEFOLD = (1 << 3), TECO_ED_AUTOEOL = (1 << 4), TECO_ED_HOOKS = (1 << 5), - TECO_ED_FNKEYS = (1 << 6), + //TECO_ED_MOUSEKEY = (1 << 6), TECO_ED_SHELLEMU = (1 << 7), TECO_ED_XTERM_CLIPBOARD = (1 << 8) }; |