summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-18 18:28:15 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-18 18:28:15 -0500
commitba559cc360162e02cfc79885637c9247bcecc0d8 (patch)
treea2b178e82ab0a5eeee11f543cd0c9b9fe104c97a /main.c
parent4e2c4c4a6c501602b4f42cb7c748bd5c8f02b8b6 (diff)
ctrl+backspace/delete
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.c b/main.c
index 641e003..8f40828 100644
--- a/main.c
+++ b/main.c
@@ -130,10 +130,16 @@ int main(void) {
buffer_insert_char_at_cursor(&text_buffer, U'\t');
break;
case SDLK_DELETE:
- buffer_delete_chars_at_cursor(&text_buffer, 1);
+ if (ctrl)
+ buffer_delete_words_at_cursor(&text_buffer, 1);
+ else
+ buffer_delete_chars_at_cursor(&text_buffer, 1);
break;
case SDLK_BACKSPACE:
- buffer_backspace(&text_buffer, 1);
+ if (ctrl)
+ buffer_backspace_words_at_cursor(&text_buffer, 1);
+ else
+ buffer_backspace_at_cursor(&text_buffer, 1);
break;
}
} break;