From 40239a80c7e6c62d37d2b64803a13a9525bfb209 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 2 Dec 2016 21:25:52 -0500 Subject: [PATCH] paste no longer autoindents --- TODO.md | 2 -- inc/edit.h | 2 +- libedit/view.c | 6 +++--- xedit.c | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 000eb3f..db2af2d 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,5 @@ # Implementation Tweaks and Bug Fixes -* disable autoindent when pasting text -* update getstr to select context when selection is null * center find results and jumped to line on screen * Use select to check for error strings in exec.c * Should not be able to undo initial tag line text insertion diff --git a/inc/edit.h b/inc/edit.h index 0ffca4f..97def27 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -145,7 +145,7 @@ void view_select(View* view, size_t row, size_t col); char* view_fetch(View* view, size_t row, size_t col); void view_find(View* view, size_t row, size_t col); void view_findstr(View* view, char* str); -void view_insert(View* view, Rune rune); +void view_insert(View* view, bool indent, Rune rune); void view_delete(View* view, int dir, bool byword); void view_bol(View* view, bool extsel); void view_eol(View* view, bool extsel); diff --git a/libedit/view.c b/libedit/view.c index 814de2b..c043cfb 100644 --- a/libedit/view.c +++ b/libedit/view.c @@ -369,13 +369,13 @@ void view_findstr(View* view, char* str) { view->sync_needed = true; } -void view_insert(View* view, Rune rune) { +void view_insert(View* view, bool indent, Rune rune) { /* ignore non-printable control characters */ if (!isspace(rune) && rune < 0x20) return; if (num_selected(view->selection)) view_delete(view, RIGHT, false); - view->selection.end = buf_ins(&(view->buffer), true, view->selection.end, rune); + view->selection.end = buf_ins(&(view->buffer), indent, view->selection.end, rune); view->selection.beg = view->selection.end; view->selection.col = buf_getcol(&(view->buffer), view->selection.end); view->sync_needed = true; @@ -450,7 +450,7 @@ void view_putstr(View* view, char* str) { Rune rune = 0; size_t length = 0; while (!utf8decode(&rune, &length, *str++)); - view_insert(view, rune); + view_insert(view, false, rune); } buf_loglock(&(view->buffer)); } diff --git a/xedit.c b/xedit.c index 62baf1a..a0dff67 100644 --- a/xedit.c +++ b/xedit.c @@ -146,7 +146,7 @@ static KeyBinding Bindings[] = { { ModCtrl, 'f', search }, { ModCtrl, 'd', execute }, { ModCtrl, 'o', open_file }, - //{ ModCtrl, 'p', find_ctag }, + //{ ModCtrl, 'p', pick_ctag }, { ModCtrl, 'g', goto_ctag }, }; @@ -234,7 +234,7 @@ static void key_handler(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) - view_insert(currview(), key); + view_insert(currview(), true, key); } /* Drawing Routines -- 2.54.0