about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-05-28 13:39:53 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-05-28 13:39:53 -0700
commitd69c6ccfc79f46ae3cd4e9284889b4a267745c55 (patch)
tree5fd90bc9dcd1399f97f0b820fc343ed12a14f527 /edit
parent1df3d62a83f7d5dc09e82a4fdac31ce4d08da02b (diff)
downloadmu-d69c6ccfc79f46ae3cd4e9284889b4a267745c55.tar.gz
3885
Diffstat (limited to 'edit')
-rw-r--r--edit/003-shortcuts.mu21
1 files changed, 21 insertions, 0 deletions
diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu
index 32d40823..d98bb5ac 100644
--- a/edit/003-shortcuts.mu
+++ b/edit/003-shortcuts.mu
@@ -3550,3 +3550,24 @@ def line-down editor:&:editor, screen-height:num -> do-render?:bool, editor:&:ed
   }
   return movement?
 ]
+
+# ctrl-t - move current line to top of screen
+# todo: scenarios
+
+after <handle-special-character> [
+  {
+    scroll-down?:bool <- equal c, 20/ctrl-t
+    break-unless scroll-down?
+    <move-cursor-begin>
+    old-top:&:duplex-list:char <- get *editor, top-of-screen:offset
+    cursor:&:duplex-list:char <- get *editor, before-cursor:offset
+    cursor <- next cursor
+    new-top:&:duplex-list:char <- before-previous-line cursor, editor
+    *editor <- put *editor, top-of-screen:offset, new-top
+    *editor <- put *editor, cursor-row:offset, 1
+    do-render?:bool <- not-equal new-top, old-top
+    undo-coalesce-tag:num <- copy 0/never
+    <move-cursor-end>
+    return do-render?
+  }
+]