From cebb5fca612321f9436f324d6b95e94b0f1ac614 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 17 Sep 2016 18:03:26 -0700 Subject: 3397 --- html/edit/001-editor.mu.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'html/edit/001-editor.mu.html') diff --git a/html/edit/001-editor.mu.html b/html/edit/001-editor.mu.html index b61e405d..a5b87d06 100644 --- a/html/edit/001-editor.mu.html +++ b/html/edit/001-editor.mu.html @@ -62,7 +62,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] -container editor-data [ +container editor [ # editable text: doubly linked list of characters (head contains a special sentinel) data:&:duplex-list:char top-of-screen:&:duplex-list:char @@ -83,12 +83,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color # creates a new editor widget and renders its initial appearance to screen # top/left/right constrain the screen area available to the new editor # right is exclusive -def new-editor s:text, screen:&:screen, left:num, right:num -> result:&:editor-data, screen:&:screen [ +def new-editor s:text, screen:&:screen, left:num, right:num -> result:&:editor, screen:&:screen [ local-scope load-ingredients # no clipping of bounds right <- subtract right, 1 - result <- new editor-data:type + result <- new editor:type # initialize screen-related fields *result <- put *result, left:offset, left *result <- put *result, right:offset, right @@ -106,7 +106,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color <editor-initialization> ] -def insert-text editor:&:editor-data, text:text -> editor:&:editor-data [ +def insert-text editor:&:editor, text:text -> editor:&:editor [ local-scope load-ingredients # early exit if text is empty @@ -132,8 +132,8 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario editor-initializes-without-data [ assume-screen 5/width, 3/height run [ - 1:&:editor-data <- new-editor 0/data, screen:&:screen, 2/left, 5/right - 2:editor-data <- copy *1:&:editor-data + 1:&:editor <- new-editor 0/data, screen:&:screen, 2/left, 5/right + 2:editor <- copy *1:&:editor ] memory-should-contain [ # 2 (data) <- just the ยง sentinel @@ -156,7 +156,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color # Assumes cursor should be at coordinates (cursor-row, cursor-column) and # updates before-cursor to match. Might also move coordinates if they're # outside text. -def render screen:&:screen, editor:&:editor-data -> last-row:num, last-column:num, screen:&:screen, editor:&:editor-data [ +def render screen:&:screen, editor:&:editor -> last-row:num, last-column:num, screen:&:screen, editor:&:editor [ local-scope load-ingredients return-unless editor, 1/top, 0/left, screen/same-as-ingredient:0, editor/same-as-ingredient:1 @@ -181,7 +181,7 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color break-unless curr off-screen?:bool <- greater-or-equal row, screen-height break-if off-screen? - # update editor-data.before-cursor + # update editor.before-cursor # Doing so at the start of each iteration ensures it stays one step behind # the current character. { @@ -378,9 +378,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color assume-screen 5/width, 5/height run [ 1:text <- new [] - 2:&:editor-data <- new-editor 1:text, screen:&:screen, 0/left, 5/right - 3:num <- get *2:&:editor-data, cursor-row:offset - 4:num <- get *2:&:editor-data, cursor-column:offset + 2:&:editor <- new-editor 1:text, screen:&:screen, 0/left, 5/right + 3:num <- get *2:&:editor, cursor-row:offset + 4:num <- get *2:&:editor, cursor-column:offset ] screen-should-contain [ . . -- cgit 1.4.1-2-gfad0