]> git.mdlowis.com Git - projs/tide.git/commitdiff
hack attempt to squash crappy behavior of undo/redo with line number syncing. Need...
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jun 2017 17:22:07 +0000 (13:22 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 15 Jun 2017 17:22:07 +0000 (13:22 -0400)
lib/view.c

index 3536ed90906b074a2d781ab7efca8dbaf2e5633d..cd1c978d89cea6700c77d3ca739f642f40072e12 100644 (file)
@@ -272,17 +272,25 @@ void view_setln(View* view, size_t line) {
 }
 
 void view_undo(View* view) {
+    view->prev_csr = view->selection.end;
     buf_undo(&(view->buffer), &(view->selection));
-    view_jumpto(view, true, view->selection.end);
-    view->sync_center = !selection_visible(view);
-    sync_line_numbers(view, 0);
+    view->sync_lines = true;
+    if (!selection_visible(view)) {
+        view->sync_center = true;
+        if (view->nrows)
+            view->rows[0]->off = buf_bol(&(view->buffer), view->selection.beg);
+    }
 }
 
 void view_redo(View* view) {
+    view->prev_csr = view->selection.end;
     buf_redo(&(view->buffer), &(view->selection));
-    view_jumpto(view, true, view->selection.end);
-    view->sync_center = !selection_visible(view);
-    sync_line_numbers(view, 0);
+    view->sync_lines = true;
+    if (!selection_visible(view)) {
+        view->sync_center = true;
+        if (view->nrows)
+            view->rows[0]->off = buf_bol(&(view->buffer), view->selection.beg);
+    }
 }
 
 void view_putstr(View* view, char* str) {