From a59f20f8669c7bdd21166e918bd74493e46c0400 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 19 Jun 2017 14:42:33 -0700 Subject: 3928 --- edit/002-typing.mu | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'edit') 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? -- cgit 1.4.1-2-gfad0