]> git.mdlowis.com Git - projs/tide.git/commitdiff
paste no longer autoindents
authorMichael D. Lowis <mike@mdlowis.com>
Sat, 3 Dec 2016 02:25:52 +0000 (21:25 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sat, 3 Dec 2016 02:25:52 +0000 (21:25 -0500)
TODO.md
inc/edit.h
libedit/view.c
xedit.c

diff --git a/TODO.md b/TODO.md
index 000eb3fb209ac8c4ecaca6e218fd46f3588b7111..db2af2d21fa806dae17120d0f2e41537a75222ad 100644 (file)
--- 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
index 0ffca4fca226bd730c815952aee791783063dbb1..97def27d90bdf9d6c6d2fa7a0f91eeabaa3d9067 100644 (file)
@@ -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);
index 814de2bc42505e0a48f6513b4744fbd699677448..c043cfb9ca9652522e26cbd31d595bcb9aaf293d 100644 (file)
@@ -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 62baf1ac6098daf89aa4e0e92ec5ec9cefa57c10..a0dff6722ca8a6d143253a82df022b170d3935ab 100644 (file)
--- 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