]> git.mdlowis.com Git - projs/tide.git/commitdiff
implemented expand tabs on insert of tab character
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 13 Sep 2018 15:59:08 +0000 (11:59 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 13 Sep 2018 15:59:08 +0000 (11:59 -0400)
TODO.md
inc/edit.h
lib/view.c
lib/x11.c
tide.c

diff --git a/TODO.md b/TODO.md
index 5013dbf3660e8f8509cec39be55e84c98bda735d..69690339feb1af87000ba17cf92c5dc5ac355e73 100644 (file)
--- 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
index 08fcd09d65b508087e998fd74c0b7aa70550f610..4a198bb54aa0d0461bb1ae2e54d1f820aebfafa4 100644 (file)
@@ -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);
index 8dce23b4778a06d531f24d0c0e31983e26565e81..b7bbf7a1279a67330d1150ad7617f6019b5bf79b 100644 (file)
@@ -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;
index 95d66dc5e45782828a20e688732ed628a211ea4d..8102ad46b309c9a4dd4b7e7b619e05a61419b521 100644 (file)
--- 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 9061df1f93bfca13a99da51dbe16c0ba7ff5958a..aef945c354f566dc0371d9771c0e5762d5b893aa 100644 (file)
--- 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) {