diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 3 | ||||
-rw-r--r-- | src/cdk.patch | 79 | ||||
-rw-r--r-- | src/textadept.c | 8 |
3 files changed, 85 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile index 3d90ed9c..5e25c03e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -265,7 +265,8 @@ gtdialog-curses.o: gtdialog/gtdialog.c $(CROSS)$(CC) -c $(CFLAGS) -DCURSES -DNOHELP -DLIBRARY -Icdk \ $(CURSES_CFLAGS) $< -o $@ $(cdk_objs): %.o: cdk/%.c - $(CROSS)$(CC) -c $(CFLAGS) -D_GNU_SOURCE -Icdk $(CURSES_CFLAGS) $< -o $@ + $(CROSS)$(CC) -c $(CFLAGS) -D_GNU_SOURCE -Itermkey -Icdk $(CURSES_CFLAGS) $< \ + -o $@ $(termkey_objs): %.o: termkey/%.c ; $(CROSS)$(CC) -c $(CFLAGS) -std=c99 $< -o $@ textadept_rc.o: textadept.rc ; $(CROSS)$(WINDRES) $< $@ diff --git a/src/cdk.patch b/src/cdk.patch index 64f7ccf5..e0207a12 100644 --- a/src/cdk.patch +++ b/src/cdk.patch @@ -1,3 +1,63 @@ +diff -r 9d0780ddcbab binding.c +--- a/binding.c 2011-05-16 18:36:08.000000000 -0400 ++++ b/binding.c 2013-12-18 11:51:43.781198100 -0500 +@@ -1,4 +1,8 @@ + #include <cdk_int.h> ++#if !_WIN32 ++#include "termkey.h" ++extern TermKey *ta_tk; ++#endif + + /* + * $Author: tom $ +@@ -167,7 +171,47 @@ + { + EObjectType cdktype = ObjTypeOf (obj); + CDKOBJS *test = bindableObject (&cdktype, obj); ++#if !_WIN32 ++ int result = ERR; ++ TermKeyKey key; ++ int keysyms[] = {0,KEY_BACKSPACE,KEY_TAB,KEY_ENTER,KEY_ESC,0,0,KEY_UP,KEY_DOWN,KEY_LEFT,KEY_RIGHT,0,0,KEY_IC,KEY_DC,0,KEY_PPAGE,KEY_NPAGE,KEY_HOME,KEY_END}; ++ TermKeyResult res = termkey_waitkey(ta_tk, &key); ++ switch (res) ++ { ++ case TERMKEY_RES_KEY: ++ switch (key.type) ++ { ++ case TERMKEY_TYPE_UNICODE: ++ result = key.code.codepoint; ++ if ((key.modifiers & TERMKEY_KEYMOD_CTRL) && ++ ((result >= 'a' && result <= 'z') || (result >= 'A' && result <= 'Z'))) ++ { ++ result = (result & ~0x60); ++ key.modifiers &= ~TERMKEY_KEYMOD_CTRL; ++ } ++ break; ++ case TERMKEY_TYPE_FUNCTION: ++ result = KEY_F(key.code.number); ++ break; ++ case TERMKEY_TYPE_KEYSYM: ++ result = keysyms[key.code.sym]; ++ break; ++ default: ++ result = ERR; ++ } ++ break; ++ case TERMKEY_RES_EOF: ++ case TERMKEY_RES_ERROR: ++ result = ERR; ++ break; ++ case TERMKEY_RES_NONE: ++ case TERMKEY_RES_AGAIN: ++ result = 0; ++ break; ++ } ++#else + int result = wgetch (InputWindowOf (obj)); ++#endif + + if (result >= 0 + && test != 0 diff -r 9d0780ddcbab cdk.c --- a/cdk.c Mon Sep 02 13:43:26 2013 -0400 +++ b/cdk.c Mon Sep 02 13:46:55 2013 -0400 @@ -227,6 +287,25 @@ diff -r 9d0780ddcbab cdk_version.h +#endif + +#endif /* CDK_VERSION_H */ +diff -r 9d0780ddcbab entry.c +--- a/entry.c 2013-06-16 09:12:32.000000000 -0400 ++++ b/entry.c 2013-12-17 16:52:52.969973100 -0500 +@@ -332,6 +332,7 @@ + else + { + wmove (widget->fieldWin, 0, --widget->screenCol); ++ drawCDKEntryField (widget); + } + break; + +@@ -350,6 +351,7 @@ + { + /* Move right. */ + wmove (widget->fieldWin, 0, ++widget->screenCol); ++ drawCDKEntryField (widget); + } + break; + diff -r 9d0780ddcbab fselect.c --- a/fselect.c Mon Sep 02 13:43:26 2013 -0400 +++ b/fselect.c Mon Sep 02 13:46:55 2013 -0400 diff --git a/src/textadept.c b/src/textadept.c index 37580742..737d20c5 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -40,7 +40,6 @@ #include "lualib.h" #include "lauxlib.h" #include "Scintilla.h" -#include "SciLexer.h" #if GTK #include "ScintillaWidget.h" #elif CURSES @@ -92,6 +91,7 @@ static GtkosxApplication *osxapp; #endif #elif (CURSES && !_WIN32) static struct termios term; +TermKey *ta_tk; // global for CDK use #endif static void new_buffer(sptr_t); static Scintilla *new_view(sptr_t); @@ -2353,7 +2353,7 @@ int main(int argc, char **argv) { #if !_WIN32 static struct termios oldterm; tcgetattr(0, &oldterm); // save old terminal settings - TermKey *tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS); + ta_tk = termkey_new(0, TERMKEY_FLAG_NOTERMIOS); #endif setlocale(LC_CTYPE, ""); // for displaying UTF-8 characters properly initscr(); // raw()/cbreak() and noecho() are taken care of in libtermkey @@ -2478,7 +2478,7 @@ int main(int argc, char **argv) { TermKeyResult res; TermKeyKey key; int keysyms[] = {0,SCK_BACK,SCK_TAB,SCK_RETURN,SCK_ESCAPE,0,0,SCK_UP,SCK_DOWN,SCK_LEFT,SCK_RIGHT,0,0,SCK_INSERT,SCK_DELETE,0,SCK_PRIOR,SCK_NEXT,SCK_HOME,SCK_END}; - while ((res = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) { + while ((res = termkey_waitkey(ta_tk, &key)) != TERMKEY_RES_EOF) { if (res == TERMKEY_RES_ERROR) continue; if (key.type == TERMKEY_TYPE_UNICODE) c = key.code.codepoint; @@ -2515,7 +2515,7 @@ int main(int argc, char **argv) { } endwin(); #if !_WIN32 - termkey_destroy(tk); + termkey_destroy(ta_tk); tcsetattr(0, TCSANOW, &oldterm); // restore old terminal settings #endif #endif |