some typos
This commit is contained in:
parent
6267ddd2eb
commit
8c0f54ee64
6
text.lua
6
text.lua
|
@ -491,9 +491,9 @@ function Text.down()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- move down one screen line in current line
|
-- move down one screen line in current line
|
||||||
local scroll_up = false
|
local scroll_down = false
|
||||||
if Text.le1(Screen_bottom1, Cursor1) then
|
if Text.le1(Screen_bottom1, Cursor1) then
|
||||||
scroll_up = true
|
scroll_down = true
|
||||||
end
|
end
|
||||||
--? print('cursor is NOT at final screen line of its line')
|
--? 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()
|
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)
|
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
|
Cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x) - 1
|
||||||
--? print('cursor pos is now', Cursor1.line, Cursor1.pos)
|
--? print('cursor pos is now', Cursor1.line, Cursor1.pos)
|
||||||
if scroll_up then
|
if scroll_down then
|
||||||
Screen_top1.line = Cursor1.line
|
Screen_top1.line = Cursor1.line
|
||||||
--? print('scroll up preserving cursor')
|
--? print('scroll up preserving cursor')
|
||||||
Text.scroll_up_while_cursor_on_screen()
|
Text.scroll_up_while_cursor_on_screen()
|
||||||
|
|
|
@ -94,7 +94,7 @@ end
|
||||||
|
|
||||||
function test_insert_newline()
|
function test_insert_newline()
|
||||||
io.write('\ntest_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}
|
App.screen.init{width=25+30, height=60}
|
||||||
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}
|
||||||
Line_width = App.screen.width
|
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')
|
App.screen.check(y, 'def', 'F - test_insert_newline/baseline/screen:2')
|
||||||
y = y + Line_height
|
y = y + Line_height
|
||||||
App.screen.check(y, 'ghi', 'F - test_insert_newline/baseline/screen:3')
|
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')
|
App.run_after_keychord('return')
|
||||||
check_eq(Screen_top1.line, 1, 'F - test_insert_newline/screen_top')
|
check_eq(Screen_top1.line, 1, 'F - test_insert_newline/screen_top')
|
||||||
check_eq(Cursor1.line, 2, 'F - test_insert_newline/cursor:line')
|
check_eq(Cursor1.line, 2, 'F - test_insert_newline/cursor:line')
|
||||||
|
|
Loading…
Reference in New Issue