From: Michael D. Lowis Date: Thu, 13 Sep 2018 15:59:08 +0000 (-0400) Subject: implemented expand tabs on insert of tab character X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=8cda974cdc384f0a9182edb8746c38d491004287;p=projs%2Ftide.git implemented expand tabs on insert of tab character --- diff --git a/TODO.md b/TODO.md index 5013dbf..6969033 100644 --- a/TODO.md +++ b/TODO.md @@ -2,6 +2,7 @@ BUGS: +* use transaction processing for joining lines * no analysis of line-endings or tabs in document * no copy indent * add arguments to keybindings diff --git a/inc/edit.h b/inc/edit.h index 08fcd09..4a198bb 100644 --- a/inc/edit.h +++ b/inc/edit.h @@ -124,7 +124,7 @@ void view_byword(View* view, int move, bool extsel); void view_byline(View* view, int move, bool extsel); char* view_fetch(View* view, size_t row, size_t col, bool (*isword)(Rune)); bool view_findstr(View* view, int dir, char* str); -void view_insert(View* view, bool indent, Rune rune); +void view_insert(View* view, 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/lib/view.c b/lib/view.c index 8dce23b..b7bbf7a 100644 --- a/lib/view.c +++ b/lib/view.c @@ -255,7 +255,7 @@ bool view_findstr(View* view, int dir, char* str) { return found; } -void view_insert(View* view, bool indent, Rune rune) { +void view_insert(View* view, Rune rune) { /* ignore non-printable control characters */ if (!isspace(rune) && (rune >= 0 && rune < 0x20)) return; diff --git a/lib/x11.c b/lib/x11.c index 95d66dc..8102ad4 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -386,7 +386,7 @@ static void xkeypress(XEvent* e) { /* 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(win_view(FOCUSED), true, key); + view_insert(win_view(FOCUSED), key); } static void xbtnpress(XEvent* e) { diff --git a/tide.c b/tide.c index 9061df1..aef945c 100644 --- a/tide.c +++ b/tide.c @@ -115,7 +115,7 @@ static void join_lines(char* arg) { for (; r == '\t' || r == ' '; r = view_getrune(view)) view_byrune(view, RIGHT, true); if (r != '\n') - view_insert(view, false, ' '); + buf_putc(win_buf(FOCUSED), ' '); } static void delete(char* arg) { @@ -368,7 +368,7 @@ static void newline(char* arg) { view_bol(view, false); } view_eol(view, false); - view_insert(view, true, '\n'); + view_insert(view, '\n'); } static void highlight(char* arg) {