about summary refs log tree commit diff stats
path: root/sandbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-06-19 14:42:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2017-06-19 14:42:33 -0700
commita59f20f8669c7bdd21166e918bd74493e46c0400 (patch)
treea3b766add58100ddf1f679e0f53c71437dcbf3b4 /sandbox
parent1c2d788b454670bf8fa1cb65c6251a8ff6ddcaf7 (diff)
downloadmu-a59f20f8669c7bdd21166e918bd74493e46c0400.tar.gz
3928
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/002-typing.mu9
1 files changed, 5 insertions, 4 deletions
diff --git a/sandbox/002-typing.mu b/sandbox/002-typing.mu
index 041a6421..3b29c322 100644
--- a/sandbox/002-typing.mu
+++ b/sandbox/002-typing.mu
@@ -874,11 +874,8 @@ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:edit
   left:num <- get *editor, left:offset
   right:num <- get *editor, right:offset
   screen-height:num <- screen-height screen
+  # update cursor coordinates
   at-start-of-wrapped-line?:bool <- at-start-of-wrapped-line? editor
-  # insert newline
-  insert 10/newline, before-cursor
-  before-cursor <- next before-cursor
-  *editor <- put *editor, before-cursor:offset, before-cursor
   {
     break-if at-start-of-wrapped-line?
     cursor-row <- add cursor-row, 1
@@ -894,6 +891,10 @@ def insert-new-line-and-indent editor:&:editor, screen:&:screen -> editor:&:edit
     cursor-row <- subtract cursor-row, 1  # bring back into screen range
     *editor <- put *editor, cursor-row:offset, cursor-row
   }
+  # insert newline
+  insert 10/newline, before-cursor
+  before-cursor <- next before-cursor
+  *editor <- put *editor, before-cursor:offset, before-cursor
   # indent if necessary
   indent?:bool <- get *editor, indent?:offset
   return-unless indent?