about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-24 22:30:29 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-24 22:30:29 -0700
commit78b4ac76652737e614830c68726feb690850b797 (patch)
tree63820fc82b7b4c1b3a2f3041fad73e13bf2b644a
parent4704b7d8be57f536e6a1979dd275377acfbaa233 (diff)
downloadmu-78b4ac76652737e614830c68726feb690850b797.tar.gz
1643
-rw-r--r--edit.mu11
1 files changed, 11 insertions, 0 deletions
diff --git a/edit.mu b/edit.mu
index 5518ac4d..a6161451 100644
--- a/edit.mu
+++ b/edit.mu
@@ -157,6 +157,8 @@ recipe render [
   # traversing screen
   row:number <- copy top:number
   column:number <- copy left:number
+  cursor-row:number <- get editor:address:editor-data/deref, cursor-row:offset
+  cursor-column:number <- get editor:address:editor-data/deref, cursor-column:offset
   move-cursor screen:address, row:number, column:number
   {
     +next-character
@@ -165,6 +167,15 @@ recipe render [
     break-unless curr:address:duplex-list
     off-screen?:boolean <- greater-or-equal row:number, screen-height:number
     break-if off-screen?:boolean
+    # update before-cursor at the start of each iteration, and row/column at the end
+    {
+      at-cursor-row?:boolean <- equal row:number, cursor-row:number
+      break-unless at-cursor-row?:boolean
+      at-cursor?:boolean <- equal column:number, cursor-column:number
+      break-unless at-cursor?:boolean
+      before-cursor:address:address:duplex-list <- get-address editor:address:editor-data/deref, before-cursor:offset
+      before-cursor:address:address:duplex-list/deref <- copy curr:address:duplex-list
+    }
     c:character <- get curr:address:duplex-list/deref, value:offset
     {
       # newline? move to left rather than 0