edit.draw(Editor_state, Text_color)
check_eq(#Editor_state.lines, 1, '#lines')
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 1, 'cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'screen_top:line')
check_eq(Editor_state.screen_top1.pos, 1, 'screen_top:pos')
edit.draw(Editor_state, Text_color)
edit.run_after_text_input(Editor_state, 'a')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-left', 'left')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-right', 'right')
edit.draw(Editor_state, Text_color)
edit.run_after_keychord(Editor_state, 'M-right', 'right')
Editor_state.selection1 = {}
edit.draw(Editor_state, Text_color) -- populate line_cache.startpos for each line
edit.run_after_mouse_release(Editor_state, Editor_state.left+8,Editor_state.top+5, 1)
check_eq(Editor_state.cursor1.line, 1, 'cursor:line')
check_eq(Editor_state.cursor1.pos, 2, 'cursor:pos')
-- selection is empty to avoid perturbing future edits
check_nil(Editor_state.selection1.line, 'selection:line')
check_nil(Editor_state.selection1.pos, 'selection:pos')
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.run_after_text_input(Editor_state, 'g')
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
end
edit.draw(Editor_state, Text_color) -- populate line_cache.startpos for each line
edit.draw(Editor_state, Text_color) -- populate line_cache.startpos for each line
Editor_state.lines = load_array{'abc', 'defgh', 'xyz'}
Text.redraw_all(Editor_state)
Editor_state.cursor1 = {line=2, pos=5}
Editor_state.screen_top1 = {line=2, pos=3}
-- press mouse above first line of text
edit.draw(Editor_state, Text_color)
edit.run_after_mouse_press(Editor_state, Editor_state.left+8,5, 1)
-- selection is at screen top
check(Editor_state.selection1.line ~= nil, 'selection:line-not-nil')
check_eq(Editor_state.selection1.line, 2, 'selection:line')
check_eq(Editor_state.selection1.pos, 3, 'selection:pos')
-- I'd like to test what happens when a mouse click is below some page of
-- text, potentially even in the middle of a line.
-- However, it's brittle to set up a text line boundary just right.
-- So I'm going to just check things below the bottom of the final line of
-- text when it's in the middle of the screen.
-- final screen line ends in the middle of screen
App.screen.init{width=50, height=60}
Editor_state = edit.initialize_test_state()
Editor_state.lines = load_array{'abcde'}
Text.redraw_all(Editor_state)
Editor_state.cursor1 = {line=1, pos=1}
Editor_state.screen_top1 = {line=1, pos=1}
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color) -- populate line_cache.startpos for each line
edit.draw(Editor_state, Text_color) -- populate line_cache.startpos for each line
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)
edit.draw(Editor_state, Text_color)