]> git.mdlowis.com Git - projs/tide.git/commitdiff
tweaked undo/redo functions in view.c
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 28 Oct 2019 13:34:45 +0000 (09:34 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 28 Oct 2019 13:34:45 +0000 (09:34 -0400)
src/lib/view.c

index fbe360d2c1499d864d6dfb0f1135acdde1fd953a..40de89e21735a022b0a18c1de1d4536d49fa0ab3 100644 (file)
@@ -469,25 +469,26 @@ void view_setln(View* view, size_t line)
     ensure(view_valid(view));
 }
 
-void view_undo(View* view)
+static void cursor_sync(View* view)
 {
-    buf_undo(BUF);
     view->sync_flags |= CURSOR;
     if (!selection_visible(view))
     {
         view->sync_flags |= CENTER;
     }
+}
+
+void view_undo(View* view)
+{
+    buf_undo(BUF);
+    cursor_sync(view);
     ensure(view_valid(view));
 }
 
 void view_redo(View* view)
 {
     buf_redo(BUF);
-    view->sync_flags |= CURSOR;
-    if (!selection_visible(view))
-    {
-        view->sync_flags |= CENTER;
-    }
+    cursor_sync(view);
     ensure(view_valid(view));
 }