From 20a7660a43c03578fb65f898471a6b479d04f57e Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 13 Nov 2012 21:15:33 +0100 Subject: support differen EOL modes * only was inserted into the command stream for Enter, which Scintilla always interpreted as * instead of interpreting the in the Insert command based on the EOL-Mode, always insert the current EOL into the command stream when Enter is pressed * inserting and independant of the EOL mode is still possible by using and respectively --- main.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index e2f1df6..3c82326 100644 --- a/main.cpp +++ b/main.cpp @@ -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; } -- cgit v1.2.3