diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-13 21:15:33 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-13 21:15:33 +0100 |
commit | 20a7660a43c03578fb65f898471a6b479d04f57e (patch) | |
tree | 18b7b3ff2808d1f1dd0ac80d8e64780146c4314f | |
parent | c44d0cb31307712c6ebf65dd92241b61282abc62 (diff) | |
download | sciteco-20a7660a43c03578fb65f898471a6b479d04f57e.tar.gz |
support differen EOL modes
* only <CR> was inserted into the command stream for Enter, which Scintilla always interpreted as <CR>
* instead of interpreting the <CR> in the Insert command based on the EOL-Mode, always insert the current EOL into the command stream when Enter is pressed
* inserting <CR> and <LF> independant of the EOL mode is still possible by using <CTRL/N> and <CTRL/K> respectively
-rw-r--r-- | main.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -76,8 +76,6 @@ static gboolean cmdline_key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer user_data __attribute__((unused))) { - gchar key = '\0'; - #ifdef DEBUG g_printf("KEY \"%s\" (%d) SHIFT=%d CNTRL=%d\n", event->string, *event->string, @@ -86,18 +84,29 @@ cmdline_key_pressed(GtkWidget *widget, GdkEventKey *event, switch (event->keyval) { case GDK_BackSpace: - key = '\b'; + cmdline_keypress('\b'); break; case GDK_Tab: - key = '\t'; + cmdline_keypress('\t'); + break; + case GDK_Return: + switch (editor_msg(SCI_GETEOLMODE)) { + case SC_EOL_CR: + cmdline_keypress('\r'); + break; + case SC_EOL_CRLF: + cmdline_keypress('\r'); + /* fall through */ + case SC_EOL_LF: + default: + cmdline_keypress('\n'); + } break; default: - key = *event->string; + if (*event->string) + cmdline_keypress(*event->string); } - if (key) - cmdline_keypress(key); - return TRUE; } |