diff options
author | 2012-09-18 15:49:32 -0400 | |
---|---|---|
committer | 2012-09-18 15:49:32 -0400 | |
commit | 29a56dc530cebfaa0bdbfadd414588704e0fc374 (patch) | |
tree | 9184bae3259e72dd7c44d638ff158d7e5e39f278 /src | |
parent | 1d6c1bfb4503da0d4596345d74af63a34a58410b (diff) | |
download | textadept-29a56dc530cebfaa0bdbfadd414588704e0fc374.tar.gz textadept-29a56dc530cebfaa0bdbfadd414588704e0fc374.zip |
Fixed incremental find in ncurses.
Diffstat (limited to 'src')
-rw-r--r-- | src/textadept.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/textadept.c b/src/textadept.c index c5564dc5..1611b9b9 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -540,13 +540,18 @@ static int lfind__newindex(lua_State *L) { #if NCURSES /** * Signal for a keypress inside the Command Entry. + * As a BINDFN, returns `TRUE` to stop key propagation. + * As a PROCESSFN, returns `TRUE` to continue key propagation. */ -static int c_keypress(EObjectType _, void *object, void *__, chtype key) { +static int c_keypress(EObjectType _, void *object, void *data, chtype key) { + if (data && (key == KEY_ENTER || key == KEY_TAB)) return TRUE; + int ret = TRUE; if (key == KEY_ENTER) { fcopy(&command_text, getCDKEntryValue((CDKENTRY *)object)); - lL_event(lua, "command_entry_command", LUA_TSTRING, command_text, -1); - } else lL_event(lua, "command_entry_keypress", LUA_TNUMBER, '\t', -1); - return key == KEY_TAB; + ret = lL_event(lua, "command_entry_command", LUA_TSTRING, command_text, -1); + } else ret = !lL_event(lua, "command_entry_keypress", LUA_TNUMBER, key, -1); + scintilla_refresh(focused_view), drawCDKEntry((CDKENTRY *)object, FALSE); + return key == KEY_TAB || ret; } #endif @@ -567,6 +572,7 @@ static int lce_focus(lua_State *L) { vMIXED, 0, 0, 256, FALSE, FALSE); bindCDKObject(vENTRY, command_entry, KEY_TAB, c_keypress, NULL); bindCDKObject(vENTRY, command_entry, KEY_ENTER, c_keypress, NULL); + setCDKEntryPreProcess(command_entry, c_keypress, ""); setCDKEntryValue(command_entry, command_text); char *clipboard = get_clipboard(); GPasteBuffer = copyChar(clipboard); // set the CDK paste buffer |