From: Michael D. Lowis Date: Fri, 14 Sep 2018 03:09:15 +0000 (-0400) Subject: implemented first pass, slightly broken, copy indent X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=7107c6c009b02d6ecea002743db8ed1d8a2571c9;p=projs%2Ftide.git implemented first pass, slightly broken, copy indent --- diff --git a/TODO.md b/TODO.md index 0629b97..498088a 100644 --- a/TODO.md +++ b/TODO.md @@ -30,8 +30,6 @@ The Future: * Wily-like rc file for registering builtins * Case insensitive search -* Ctrl+Up,Down requires two undos to revert. -* Ctrl+Up,Down with non line selection should track column * use transaction ids to only mark buffer dirty when it really is * 100% coverage with unit and unit-integration tests * tab inserts dont coalesce like one would expect @@ -40,10 +38,7 @@ The Future: Maybe think about addressing these later: -* add current dir to path -* add support for guidefiles -* Shift+Insert should insert primary selection -* Find shortcut should select previous word if current char is newline +* add current dir to path]'\\\''''''''''''''''''''''''''''' char is newline # Auxillary Programs diff --git a/lib/view.c b/lib/view.c index b7bbf7a..f8ac181 100644 --- a/lib/view.c +++ b/lib/view.c @@ -263,6 +263,13 @@ void view_insert(View* view, Rune rune) { size_t off = buf_selbeg(BUF); size_t n = (TabWidth - ((off - buf_bol(BUF, off)) % TabWidth)); for (; n > 0; n--) buf_putc(BUF, ' '); + } else if (CopyIndent && rune == '\n') { + size_t off = buf_selbeg(BUF); + size_t beg = buf_bol(BUF, off-1), end = beg; + for (; end < buf_end(BUF) && (' ' == buf_getrat(BUF, end) || '\t' == buf_getrat(BUF, end)); end++); + buf_putc(BUF, rune); + for (; beg < end; beg++) + buf_putc(BUF, buf_getrat(BUF, beg)); } else { buf_putc(BUF, rune); }