aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-13 21:15:33 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-13 21:15:33 +0100
commit20a7660a43c03578fb65f898471a6b479d04f57e (patch)
tree18b7b3ff2808d1f1dd0ac80d8e64780146c4314f /main.cpp
parentc44d0cb31307712c6ebf65dd92241b61282abc62 (diff)
downloadsciteco-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
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp25
1 files changed, 17 insertions, 8 deletions
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;
}