about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--text.lua6
-rw-r--r--text_tests.lua4
2 files changed, 5 insertions, 5 deletions
diff --git a/text.lua b/text.lua
index 79d3675..e4bb325 100644
--- a/text.lua
+++ b/text.lua
@@ -491,9 +491,9 @@ function Text.down()
     end
   else
     -- move down one screen line in current line
-    local scroll_up = false
+    local scroll_down = false
     if Text.le1(Screen_bottom1, Cursor1) then
-      scroll_up = true
+      scroll_down = true
     end
 --?     print('cursor is NOT at final screen line of its line')
     local screen_line_index, screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line()
@@ -502,7 +502,7 @@ function Text.down()
     local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_pos)
     Cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x) - 1
 --?     print('cursor pos is now', Cursor1.line, Cursor1.pos)
-    if scroll_up then
+    if scroll_down then
       Screen_top1.line = Cursor1.line
 --?       print('scroll up preserving cursor')
       Text.scroll_up_while_cursor_on_screen()
diff --git a/text_tests.lua b/text_tests.lua
index f3a2a6a..6982c04 100644
--- a/text_tests.lua
+++ b/text_tests.lua
@@ -94,7 +94,7 @@ end
 
 function test_insert_newline()
   io.write('\ntest_insert_newline')
-  -- display a few lines with cursor on bottom line
+  -- display a few lines
   App.screen.init{width=25+30, height=60}
   Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
   Line_width = App.screen.width
@@ -108,7 +108,7 @@ function test_insert_newline()
   App.screen.check(y, 'def', 'F - test_insert_newline/baseline/screen:2')
   y = y + Line_height
   App.screen.check(y, 'ghi', 'F - test_insert_newline/baseline/screen:3')
-  -- after hitting the enter key the screen scrolls down
+  -- hitting the enter key splits the line
   App.run_after_keychord('return')
   check_eq(Screen_top1.line, 1, 'F - test_insert_newline/screen_top')
   check_eq(Cursor1.line, 2, 'F - test_insert_newline/cursor:line')