diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-06-19 14:42:33 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-06-19 14:42:33 -0700 |
commit | a59f20f8669c7bdd21166e918bd74493e46c0400 (patch) | |
tree | a3b766add58100ddf1f679e0f53c71437dcbf3b4 /edit | |
parent | 1c2d788b454670bf8fa1cb65c6251a8ff6ddcaf7 (diff) | |
download | mu-a59f20f8669c7bdd21166e918bd74493e46c0400.tar.gz |
3928
Diffstat (limited to 'edit')
-rw-r--r-- | edit/002-typing.mu | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/edit/002-typing.mu b/edit/002-typing.mu index 041a6421..3b29c322 100644 --- a/edit/002-typing.mu +++ b/edit/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? |