From: Michael D. Lowis Date: Tue, 2 May 2017 20:02:20 +0000 (-0400) Subject: Fixed a bug in crlf handling for keyboard shortcuts X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=ced064b92a3d28c49c543701f3b2f3f24ae3846c;p=projs%2Ftide.git Fixed a bug in crlf handling for keyboard shortcuts --- diff --git a/lib/win.c b/lib/win.c index 0a5d0ed..33278f9 100644 --- a/lib/win.c +++ b/lib/win.c @@ -243,7 +243,6 @@ static void oninput(int mods, Rune key) { mods = mods & (ModCtrl|ModAlt|ModShift); /* handle the proper line endings */ if (key == '\r') key = '\n'; - if (key == '\n' && win_view(FOCUSED)->buffer.crlf) key = RUNE_CRLF; /* search for a key binding entry */ uint32_t mkey = tolower(key); for (KeyBinding* bind = Keys; bind && bind->key; bind++) { @@ -255,8 +254,11 @@ static void oninput(int mods, Rune key) { /* fallback to just inserting the rune if it doesn't fall in the private use area. * the private use area is used to encode special keys */ - if (key < 0xE000 || key > 0xF8FF) + if (key < 0xE000 || key > 0xF8FF) { + if (key == '\n' && win_view(FOCUSED)->buffer.crlf) + key = RUNE_CRLF; view_insert(win_view(FOCUSED), true, key); + } } static void onclick(MouseAct act, MouseBtn btn, int x, int y) {