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VBTGHAC DLQMM2656JHXX3ONOEM6UIOXKFJFT5QT7RHWK7YS2W77PVZWHRSAC F63Q4OV73CQC6WTWDCURANYMF2PM4TJCXWF3FZ25X4QY7ZTEZ6QAC BJ2C6F2BGCBFUP57FGE7NXVURXFDOXUAWF3EQSJT2MR6U4F4MPJAC UZVWYRTY7MVTSJXL3E5YISYK7YEUPATCBPATT57KHTBMQQH5M7IQC RT6EV6OPUYCXYZOX2PHFXJ7KT77KHNEVINEGQXIQLHQVKPGTN6VQC 7SFHSB47KC6YH737DJPYYVONCFGEHC2Z37RCVPJO6I5PHEOLK74AC 6DE7RBZ6RHNEICJ7EUMCTROK43LW4LYINULIF2QEQOKCXWLUYUXAC SRVDX4I5QKWAH3Y5DX25PG34U7NY55H46ZYG2APH47BUZT3EJ2HAC YCDYGEZUKVVFRLV5TKF2VYPDXWIHDSZD32KINFARWAJX4X3JPSFAC 6LIPEQ5IIBGMMYTTQ7U36ZQUOMPLJBSILG5M5RDHI2K3KTHMS5NAC JAXPXLEBWHBLNLMZ5VCSO63X6Z5WT4KZKWBOVACCAVX4QJAWWNYQC 3RGHOJ25MCTQ5CRQADFIVJ53QZWRSIQOFGXLFGKQ765QABJ5S54AC History[Next_history] = dataNext_history = Next_history+1for i=Next_history,#History doHistory[i] = nil
Editor_state.history[Editor_state.next_history] = dataEditor_state.next_history = Editor_state.next_history+1for i=Editor_state.next_history,#Editor_state.history doEditor_state.history[i] = nil
if Next_history > 1 then--? print('moving to history', Next_history-1)Next_history = Next_history-1local result = History[Next_history]
if Editor_state.next_history > 1 then--? print('moving to history', Editor_state.next_history-1)Editor_state.next_history = Editor_state.next_history-1local result = Editor_state.history[Editor_state.next_history]
if Next_history <= #History then--? print('restoring history', Next_history+1)local result = History[Next_history]Next_history = Next_history+1
if Editor_state.next_history <= #Editor_state.history then--? print('restoring history', Editor_state.next_history+1)local result = Editor_state.history[Editor_state.next_history]Editor_state.next_history = Editor_state.next_history+1
check_eq(#Lines, 1, 'F - test_initial_state/#lines')check_eq(Cursor1.line, 1, 'F - test_initial_state/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_initial_state/cursor:pos')check_eq(Screen_top1.line, 1, 'F - test_initial_state/screen_top:line')check_eq(Screen_top1.pos, 1, 'F - test_initial_state/screen_top:pos')
check_eq(#Editor_state.lines, 1, 'F - test_initial_state/#lines')check_eq(Editor_state.cursor1.line, 1, 'F - test_initial_state/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_initial_state/cursor:pos')check_eq(Editor_state.screen_top1.line, 1, 'F - test_initial_state/screen_top:line')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_initial_state/screen_top:pos')
check_eq(#Lines, 2, 'F - test_click_to_create_drawing/#lines')check_eq(Cursor1.line, 2, 'F - test_click_to_create_drawing/cursor')
check_eq(#Editor_state.lines, 2, 'F - test_click_to_create_drawing/#lines')check_eq(Editor_state.cursor1.line, 2, 'F - test_click_to_create_drawing/cursor')
Lines = load_array{'```lines', '```', ''}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'```lines', '```', ''}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
check_eq(#Lines, 1, 'F - test_backspace_to_delete_drawing/#lines')check_eq(Cursor1.line, 1, 'F - test_backspace_to_delete_drawing/cursor')
check_eq(#Editor_state.lines, 1, 'F - test_backspace_to_delete_drawing/#lines')check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_to_delete_drawing/cursor')
Lines = load_array{''}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{''}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc', 'def'}Cursor1 = {line=2, pos=1}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc', 'def'}Editor_state.cursor1 = {line=2, pos=1}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
check_eq(Cursor1.line, 1, 'F - test_move_left_to_previous_line/line')check_eq(Cursor1.pos, 4, 'F - test_move_left_to_previous_line/pos') -- past end of line
check_eq(Editor_state.cursor1.line, 1, 'F - test_move_left_to_previous_line/line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_move_left_to_previous_line/pos') -- past end of line
Lines = load_array{'abc', 'def'}Cursor1 = {line=1, pos=4} -- past end of lineMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc', 'def'}Editor_state.cursor1 = {line=1, pos=4} -- past end of lineEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
check_eq(Cursor1.line, 2, 'F - test_move_right_to_next_line/line')check_eq(Cursor1.pos, 1, 'F - test_move_right_to_next_line/pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_move_right_to_next_line/line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_move_right_to_next_line/pos')
Lines = load_array{'abc'}Cursor1 = {line=1, pos=3}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc'}Editor_state.cursor1 = {line=1, pos=3}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the space between wordsMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=4} -- at the space between wordsEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=5} -- at the start of second wordMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=5} -- at the start of second wordEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def\tghi'}Cursor1 = {line=1, pos=10} -- within third wordMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def\tghi'}Editor_state.cursor1 = {line=1, pos=10} -- within third wordEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=6} -- at the start of second wordMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=6} -- at the start of second wordEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def', 'ghi'}Cursor1 = {line=2, pos=1}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def', 'ghi'}Editor_state.cursor1 = {line=2, pos=1}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
check_eq(Cursor1.line, 1, 'F - test_move_to_start_of_word_on_previous_line/line')check_eq(Cursor1.pos, 5, 'F - test_move_to_start_of_word_on_previous_line/pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_move_to_start_of_word_on_previous_line/line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_move_to_start_of_word_on_previous_line/pos')
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=1}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=1}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the space between wordsMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=4} -- at the space between wordsEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc\tdef'}Cursor1 = {line=1, pos=1} -- at the space between wordsMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc\tdef'}Editor_state.cursor1 = {line=1, pos=1} -- at the space between wordsEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def'}Cursor1 = {line=1, pos=4} -- at the start of second wordMargin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def'}Editor_state.cursor1 = {line=1, pos=4} -- at the start of second wordEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
Lines = load_array{'abc def', 'ghi'}Cursor1 = {line=1, pos=8}Margin_right = 0; Margin_width = Margin_left
Editor_state.lines = load_array{'abc def', 'ghi'}Editor_state.cursor1 = {line=1, pos=8}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_left
check_eq(Cursor1.line, 2, 'F - test_move_past_end_of_word_on_next_line/line')check_eq(Cursor1.pos, 4, 'F - test_move_past_end_of_word_on_next_line/pos')
check_eq(Editor_state.cursor1.line, 2, 'F - test_move_past_end_of_word_on_next_line/line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_move_past_end_of_word_on_next_line/pos')
Lines = load_array{'abc', 'def'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 1, 'F - test_click_with_mouse/cursor')check_nil(Selection1.line, 'F - test_click_with_mouse/selection is empty to avoid perturbing future edits')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_with_mouse/cursor')check_nil(Editor_state.selection1.line, 'F - test_click_with_mouse/selection is empty to avoid perturbing future edits')
Lines = load_array{'', 'def'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'', 'def'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc', 'def', 'ghi'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc', 'defgh', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'defgh', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc def ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc def ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abcd e fghijk', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abcd e fghijk', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'madam I’m adam', 'xyz'} -- notice the non-ASCII apostropheMargin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'madam I’m adam', 'xyz'} -- notice the non-ASCII apostropheEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{"madam I'm adam"}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{"madam I'm adam"}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 1, 'F - test_click_on_wrapping_line/cursor:line')check_eq(Cursor1.pos, 13, 'F - test_click_on_wrapping_line/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line/cursor:line')check_eq(Editor_state.cursor1.pos, 13, 'F - test_click_on_wrapping_line/cursor:pos')
Lines = load_array{"madam I'm adam"}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=8}Screen_top1 = {line=1, pos=7}Screen_bottom1 = {}
Editor_state.lines = load_array{"madam I'm adam"}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=8}Editor_state.screen_top1 = {line=1, pos=7}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 1, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:line')check_eq(Cursor1.pos, 13, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:line')check_eq(Editor_state.cursor1.pos, 13, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:pos')
Lines = load_array{"madam I'm adam"}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{"madam I'm adam"}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.pos, 15, 'F - test_click_past_end_of_wrapping_line/cursor') -- one more than the number of UTF-8 code-points
check_eq(Editor_state.cursor1.pos, 15, 'F - test_click_past_end_of_wrapping_line/cursor') -- one more than the number of UTF-8 code-points
Lines = load_array{'madam I’m adam'} -- notice the non-ASCII apostropheMargin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'madam I’m adam'} -- notice the non-ASCII apostropheEditor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.pos, 15, 'F - test_click_on_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points
check_eq(Editor_state.cursor1.pos, 15, 'F - test_click_on_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points
Lines = load_array{'the quick brown fox jumped over the lazy dog'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'the quick brown fox jumped over the lazy dog'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc def'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc def'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Selection1.line, 1, 'F - test_select_text/selection:line')check_eq(Selection1.pos, 1, 'F - test_select_text/selection:pos')check_eq(Cursor1.line, 1, 'F - test_select_text/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_select_text/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text/selection:line')check_eq(Editor_state.selection1.pos, 1, 'F - test_select_text/selection:pos')check_eq(Editor_state.cursor1.line, 1, 'F - test_select_text/cursor:line')check_eq(Editor_state.cursor1.pos, 2, 'F - test_select_text/cursor:pos')
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_nil(Selection1.line, 'F - test_cursor_movement_without_shift_resets_selection')check_eq(Lines[1].data, 'abc', 'F - test_cursor_movement_without_shift_resets_selection/data')
check_nil(Editor_state.selection1.line, 'F - test_cursor_movement_without_shift_resets_selection')check_eq(Editor_state.lines[1].data, 'abc', 'F - test_cursor_movement_without_shift_resets_selection/data')
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_nil(Selection1.line, 'F - test_edit_with_shift_key_deletes_selection')check_eq(Lines[1].data, 'Dbc', 'F - test_edit_with_shift_key_deletes_selection/data')
check_nil(Editor_state.selection1.line, 'F - test_edit_with_shift_key_deletes_selection')check_eq(Editor_state.lines[1].data, 'Dbc', 'F - test_edit_with_shift_key_deletes_selection/data')
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc', 'def'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Selection1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.selection1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=2}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=2}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_deleting_selection_may_scroll')check_eq(Lines[1].data, 'ahi', 'F - test_deleting_selection_may_scroll/data')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_deleting_selection_may_scroll')check_eq(Editor_state.lines[1].data, 'ahi', 'F - test_deleting_selection_may_scroll/data')
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=4}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=4}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
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.pos, 1, 'F - test_insert_newline/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_insert_newline/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_newline/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_insert_newline/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 2, 'F - test_insert_newline_at_start_of_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_insert_newline_at_start_of_line/cursor:pos')check_eq(Lines[1].data, '', 'F - test_insert_newline_at_start_of_line/data:1')check_eq(Lines[2].data, 'abc', 'F - test_insert_newline_at_start_of_line/data:2')
check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_newline_at_start_of_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_insert_newline_at_start_of_line/cursor:pos')check_eq(Editor_state.lines[1].data, '', 'F - test_insert_newline_at_start_of_line/data:1')check_eq(Editor_state.lines[2].data, 'abc', 'F - test_insert_newline_at_start_of_line/data:2')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_insert_from_clipboard/screen_top')check_eq(Cursor1.line, 2, 'F - test_insert_from_clipboard/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_insert_from_clipboard/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_insert_from_clipboard/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_insert_from_clipboard/cursor:line')check_eq(Editor_state.cursor1.pos, 2, 'F - test_insert_from_clipboard/cursor:pos')y = Editor_state.margin_top
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}edit.draw() -- populate line.y for each line in LinesApp.run_after_mouse_release(Margin_left+8,Margin_top+5, 1)check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_move_cursor_using_mouse/cursor:pos')check_nil(Selection1.line, 'F - test_move_cursor_using_mouse/selection:line')check_nil(Selection1.pos, 'F - test_move_cursor_using_mouse/selection:pos')
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}edit.draw() -- populate line.y for each line in Editor_state.linesApp.run_after_mouse_release(Editor_state.margin_left+8,Editor_state.margin_top+5, 1)check_eq(Editor_state.cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')check_eq(Editor_state.cursor1.pos, 2, 'F - test_move_cursor_using_mouse/cursor:pos')check_nil(Editor_state.selection1.line, 'F - test_move_cursor_using_mouse/selection:line')check_nil(Editor_state.selection1.pos, 'F - test_move_cursor_using_mouse/selection:pos')
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}edit.draw() -- populate line.y for each line in Lines
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}edit.draw() -- populate line.y for each line in Editor_state.lines
App.run_after_mouse_release(Margin_left+20,Margin_top+Line_height+5, 1)check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse/selection:line')check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos')check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos')
App.run_after_mouse_release(Editor_state.margin_left+20,Editor_state.margin_top+Editor_state.line_height+5, 1)check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_using_mouse/selection:line')check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse/selection:pos')check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_using_mouse/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_select_text_using_mouse/cursor:pos')
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}edit.draw() -- populate line.y for each line in Lines
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}edit.draw() -- populate line.y for each line in Editor_state.lines
App.run_after_mouse_press(Margin_left+8,Margin_top+5, 1)App.run_after_mouse_release(Margin_left+8,Margin_top+5, 1)
App.run_after_mouse_press(Editor_state.margin_left+8,Editor_state.margin_top+5, 1)App.run_after_mouse_release(Editor_state.margin_left+8,Editor_state.margin_top+5, 1)
App.run_after_mouse_press(Margin_left+20,Margin_top+5, 1)App.run_after_mouse_release(Margin_left+20,Margin_top+Line_height+5, 1)
App.run_after_mouse_press(Editor_state.margin_left+20,Editor_state.margin_top+5, 1)App.run_after_mouse_release(Editor_state.margin_left+20,Editor_state.margin_top+Editor_state.line_height+5, 1)
check_eq(Selection1.line, 1, 'F - test_select_text_using_mouse_and_shift/selection:line')check_eq(Selection1.pos, 2, 'F - test_select_text_using_mouse_and_shift/selection:pos')check_eq(Cursor1.line, 2, 'F - test_select_text_using_mouse_and_shift/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_select_text_using_mouse_and_shift/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_using_mouse_and_shift/selection:line')check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_using_mouse_and_shift/selection:pos')check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_using_mouse_and_shift/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_select_text_using_mouse_and_shift/cursor:pos')
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}edit.draw() -- populate line.y for each line in Lines
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}edit.draw() -- populate line.y for each line in Editor_state.lines
App.run_after_mouse_press(Margin_left+8,Margin_top+5, 1)App.run_after_mouse_release(Margin_left+8,Margin_top+5, 1)
App.run_after_mouse_press(Editor_state.margin_left+8,Editor_state.margin_top+5, 1)App.run_after_mouse_release(Editor_state.margin_left+8,Editor_state.margin_top+5, 1)
App.run_after_mouse_press(Margin_left+20,Margin_top+5, 1)App.run_after_mouse_release(Margin_left+20,Margin_top+Line_height+5, 1)
App.run_after_mouse_press(Editor_state.margin_left+20,Editor_state.margin_top+5, 1)App.run_after_mouse_release(Editor_state.margin_left+20,Editor_state.margin_top+Editor_state.line_height+5, 1)
App.run_after_mouse_press(Margin_left+20,Margin_top+5, 1)App.run_after_mouse_release(Margin_left+8,Margin_top+Line_height+5, 1)
App.run_after_mouse_press(Editor_state.margin_left+20,Editor_state.margin_top+5, 1)App.run_after_mouse_release(Editor_state.margin_left+8,Editor_state.margin_top+Editor_state.line_height+5, 1)
check_eq(Selection1.line, 1, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:line')check_eq(Selection1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:pos')check_eq(Cursor1.line, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:line')check_eq(Editor_state.selection1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/selection:pos')check_eq(Editor_state.cursor1.line, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:line')check_eq(Editor_state.cursor1.pos, 2, 'F - test_select_text_repeatedly_using_mouse_and_shift/cursor:pos')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Selection1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}Editor_state.selection1 = {}
Lines = load_array{'abc', 'def', 'ghi'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_pagedown/screen_top')check_eq(Cursor1.line, 2, 'F - test_pagedown/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_pagedown/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_pagedown/cursor')y = Editor_state.margin_top
App.screen.init{width=Margin_left+drawing_width, height=80}Lines = load_array{'abc', -- height 15
App.screen.init{width=Editor_state.margin_left+drawing_width, height=80}Editor_state.lines = load_array{'abc', -- height 15
Margin_right = 0; Margin_width = Margin_leftcheck_eq(Lines[2].mode, 'drawing', 'F - test_pagedown_skips_drawings/baseline/lines')Cursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}local drawing_height = Drawing_padding_height + drawing_width/2 -- default
Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftcheck_eq(Editor_state.lines[2].mode, 'drawing', 'F - test_pagedown_skips_drawings/baseline/lines')Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}local drawing_height = Editor_state.drawing_padding_height + drawing_width/2 -- default
check_eq(Screen_top1.line, 2, 'F - test_pagedown_skips_drawings/screen_top')check_eq(Cursor1.line, 3, 'F - test_pagedown_skips_drawings/cursor')y = Margin_top + drawing_height
check_eq(Editor_state.screen_top1.line, 2, 'F - test_pagedown_skips_drawings/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_pagedown_skips_drawings/cursor')y = Editor_state.margin_top + drawing_height
Lines = load_array{'abc', 'def ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_pagedown_often_shows_start_of_wrapping_line/screen_top:line')check_eq(Screen_top1.pos, 1, 'F - test_pagedown_often_shows_start_of_wrapping_line/screen_top:pos')check_eq(Cursor1.line, 2, 'F - test_pagedown_often_shows_start_of_wrapping_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_pagedown_often_shows_start_of_wrapping_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_pagedown_often_shows_start_of_wrapping_line/screen_top:line')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_pagedown_often_shows_start_of_wrapping_line/screen_top:pos')check_eq(Editor_state.cursor1.line, 2, 'F - test_pagedown_often_shows_start_of_wrapping_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_pagedown_often_shows_start_of_wrapping_line/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc def ghi jkl mno pqr stu vwx yza bcd efg hij', 'XYZ'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc def ghi jkl mno pqr stu vwx yza bcd efg hij', 'XYZ'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:line')check_eq(Screen_top1.pos, 9, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:line')check_eq(Editor_state.screen_top1.pos, 9, 'F - test_pagedown_can_start_from_middle_of_long_wrapping_line/screen_top:pos')y = Editor_state.margin_top
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_down_arrow_moves_cursor/screen_top')check_eq(Cursor1.line, 2, 'F - test_down_arrow_moves_cursor/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_down_arrow_moves_cursor/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_down_arrow_moves_cursor/cursor')
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_line/screen_top')check_eq(Cursor1.line, 4, 'F - test_down_arrow_scrolls_down_by_one_line/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_line/screen_top')check_eq(Editor_state.cursor1.line, 4, 'F - test_down_arrow_scrolls_down_by_one_line/cursor')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:line')check_eq(Cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghijkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghijkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen_top')check_eq(Cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:line')check_eq(Cursor1.pos, 6, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:line')check_eq(Editor_state.cursor1.pos, 6, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghijkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghijkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/screen_top')check_eq(Cursor1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline2/cursor:pos')
check_eq(Screen_top1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen_top')check_eq(Cursor1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:line')check_eq(Cursor1.pos, 6, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:line')check_eq(Editor_state.cursor1.pos, 6, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:pos')y = Editor_state.margin_top
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_up_arrow_moves_cursor/screen_top')check_eq(Cursor1.line, 2, 'F - test_up_arrow_moves_cursor/cursor')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_moves_cursor/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_up_arrow_moves_cursor/cursor')
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/screen_top')check_eq(Cursor1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_by_one_line/cursor')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=6}Screen_top1 = {line=3, pos=5}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=6}Editor_state.screen_top1 = {line=3, pos=5}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')check_eq(Screen_top1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_up_arrow_scrolls_up_by_one_screen_line/cursor:pos')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')check_eq(Screen_top1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')check_eq(Cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:line')check_eq(Cursor1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')check_eq(Editor_state.screen_top1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_up_arrow_scrolls_up_to_final_screen_line/cursor:pos')
Lines = load_array{'', 'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'', 'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/screen_top')check_eq(Cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_up_arrow_scrolls_up_to_empty_line/cursor')y = Editor_state.margin_top
Lines = load_array{'abc', 'def', 'ghi'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_pageup/screen_top')check_eq(Cursor1.line, 1, 'F - test_pageup/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pageup/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_pageup/cursor')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/screen_top')check_eq(Cursor1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_pageup_scrolls_up_by_screen_line/cursor:pos')y = Editor_state.margin_top
-- display a few lines starting from the middle of a line (Cursor1.pos > 1)App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=5}Screen_top1 = {line=2, pos=5}Screen_bottom1 = {}
-- display a few lines starting from the middle of a line (Editor_state.cursor1.pos > 1)App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=5}Editor_state.screen_top1 = {line=2, pos=5}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/screen_top')check_eq(Cursor1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_pageup_scrolls_up_from_middle_screen_line/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_enter_on_bottom_line_scrolls_down/screen_top')check_eq(Cursor1.line, 4, 'F - test_enter_on_bottom_line_scrolls_down/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_enter_on_bottom_line_scrolls_down/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_enter_on_bottom_line_scrolls_down/screen_top')check_eq(Editor_state.cursor1.line, 4, 'F - test_enter_on_bottom_line_scrolls_down/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_enter_on_bottom_line_scrolls_down/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=4, pos=2}Screen_top1 = {line=4, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=4, pos=2}Editor_state.screen_top1 = {line=4, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 4, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')check_eq(Cursor1.line, 5, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 4, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')check_eq(Editor_state.cursor1.line, 5, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_enter_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', ''}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', ''}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')check_eq(Cursor1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')check_eq(Cursor1.pos, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')local y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/screen_top')check_eq(Editor_state.cursor1.line, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:line')check_eq(Editor_state.cursor1.pos, 2, 'F - test_inserting_text_on_final_line_avoids_scrolling_down_when_not_at_bottom/cursor:pos')local y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=4}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=4}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_typing_on_bottom_line_scrolls_down/screen_top')check_eq(Cursor1.line, 3, 'F - test_typing_on_bottom_line_scrolls_down/cursor:line')check_eq(Cursor1.pos, 7, 'F - test_typing_on_bottom_line_scrolls_down/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_typing_on_bottom_line_scrolls_down/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_typing_on_bottom_line_scrolls_down/cursor:line')check_eq(Editor_state.cursor1.pos, 7, 'F - test_typing_on_bottom_line_scrolls_down/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftScreen_top1 = {line=3, pos=5}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.screen_top1 = {line=3, pos=5}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')check_eq(Screen_top1.pos, 1, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_left_arrow_scrolls_up_in_wrapped_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_left_arrow_scrolls_up_in_wrapped_line/cursor:pos')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftScreen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_right_arrow_scrolls_down_in_wrapped_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:line')check_eq(Cursor1.pos, 6, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_right_arrow_scrolls_down_in_wrapped_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:line')check_eq(Editor_state.cursor1.pos, 6, 'F - test_right_arrow_scrolls_down_in_wrapped_line/cursor:pos')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftScreen_top1 = {line=3, pos=5}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.screen_top1 = {line=3, pos=5}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')check_eq(Screen_top1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/cursor:line')check_eq(Cursor1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_home_scrolls_up_in_wrapped_line/cursor:line')check_eq(Editor_state.cursor1.pos, 1, 'F - test_home_scrolls_up_in_wrapped_line/cursor:pos')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftScreen_top1 = {line=1, pos=1}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 2, 'F - test_end_scrolls_down_in_wrapped_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_end_scrolls_down_in_wrapped_line/cursor:line')check_eq(Cursor1.pos, 8, 'F - test_end_scrolls_down_in_wrapped_line/cursor:pos')y = Margin_top
check_eq(Editor_state.screen_top1.line, 2, 'F - test_end_scrolls_down_in_wrapped_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_end_scrolls_down_in_wrapped_line/cursor:line')check_eq(Editor_state.cursor1.pos, 8, 'F - test_end_scrolls_down_in_wrapped_line/cursor:pos')y = Editor_state.margin_top
Lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=25}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc def ghi jkl mno pqr ', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=25}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')check_eq(Cursor1.pos, 26, 'F - test_move_cursor_using_mouse/cursor:pos')
check_eq(Editor_state.cursor1.line, 1, 'F - test_move_cursor_using_mouse/cursor:line')check_eq(Editor_state.cursor1.pos, 26, 'F - test_move_cursor_using_mouse/cursor:pos')
Lines = load_array{'abc', 'def', 'ghi', 'jkl'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Screen_top1 = {line=2, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.screen_top1 = {line=2, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 1, 'F - test_backspace_can_scroll_up/screen_top')check_eq(Cursor1.line, 1, 'F - test_backspace_can_scroll_up/cursor')y = Margin_top
check_eq(Editor_state.screen_top1.line, 1, 'F - test_backspace_can_scroll_up/screen_top')check_eq(Editor_state.cursor1.line, 1, 'F - test_backspace_can_scroll_up/cursor')y = Editor_state.margin_top
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=3, pos=5}Screen_top1 = {line=3, pos=5}Screen_bottom1 = {}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=3, pos=5}Editor_state.screen_top1 = {line=3, pos=5}Editor_state.screen_bottom1 = {}
check_eq(Screen_top1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/screen_top')check_eq(Screen_top1.pos, 1, 'F - test_backspace_can_scroll_up_screen_line/screen_top')check_eq(Cursor1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_backspace_can_scroll_up_screen_line/cursor:pos')
check_eq(Editor_state.screen_top1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/screen_top')check_eq(Editor_state.screen_top1.pos, 1, 'F - test_backspace_can_scroll_up_screen_line/screen_top')check_eq(Editor_state.cursor1.line, 3, 'F - test_backspace_can_scroll_up_screen_line/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_backspace_can_scroll_up_screen_line/cursor:pos')
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}
check_eq(Cursor1.line, 1, "F - test_backspace_over_selection/cursor:line")check_eq(Cursor1.pos, 1, "F - test_backspace_over_selection/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_selection/cursor:line")check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_over_selection/cursor:pos")
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Selection1 = {line=1, pos=1}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.selection1 = {line=1, pos=1}
check_eq(Cursor1.line, 1, "F - test_backspace_over_selection_reverse/cursor:line")check_eq(Cursor1.pos, 1, "F - test_backspace_over_selection_reverse/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_selection_reverse/cursor:line")check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_over_selection_reverse/cursor:pos")
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Selection1 = {line=4, pos=2}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.selection1 = {line=4, pos=2}
check_eq(Lines[1].data, 'akl', "F - test_backspace_over_multiple_lines/data:1")check_eq(Lines[2].data, 'mno', "F - test_backspace_over_multiple_lines/data:2")
check_eq(Editor_state.lines[1].data, 'akl', "F - test_backspace_over_multiple_lines/data:1")check_eq(Editor_state.lines[2].data, 'mno', "F - test_backspace_over_multiple_lines/data:2")
check_eq(Cursor1.line, 1, "F - test_backspace_over_multiple_lines/cursor:line")check_eq(Cursor1.pos, 2, "F - test_backspace_over_multiple_lines/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_over_multiple_lines/cursor:line")check_eq(Editor_state.cursor1.pos, 2, "F - test_backspace_over_multiple_lines/cursor:pos")
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=2}Selection1 = {line=1, pos=4}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=2}Editor_state.selection1 = {line=1, pos=4}
check_eq(Lines[1].data, 'a', "F - test_backspace_to_start_of_line/data:1")check_eq(Lines[2].data, 'def', "F - test_backspace_to_start_of_line/data:2")
check_eq(Editor_state.lines[1].data, 'a', "F - test_backspace_to_start_of_line/data:1")check_eq(Editor_state.lines[2].data, 'def', "F - test_backspace_to_start_of_line/data:2")
check_eq(Cursor1.line, 1, "F - test_backspace_to_start_of_line/cursor:line")check_eq(Cursor1.pos, 2, "F - test_backspace_to_start_of_line/cursor:pos")
check_eq(Editor_state.cursor1.line, 1, "F - test_backspace_to_start_of_line/cursor:line")check_eq(Editor_state.cursor1.pos, 2, "F - test_backspace_to_start_of_line/cursor:pos")
App.screen.init{width=Margin_left+30, height=60}Lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=1}Selection1 = {line=2, pos=3}
App.screen.init{width=Editor_state.margin_left+30, height=60}Editor_state.lines = load_array{'abc', 'def', 'ghi', 'jkl', 'mno'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=1}Editor_state.selection1 = {line=2, pos=3}
check_eq(Lines[1].data, 'abc', "F - test_backspace_to_start_of_line/data:1")check_eq(Lines[2].data, 'f', "F - test_backspace_to_start_of_line/data:2")
check_eq(Editor_state.lines[1].data, 'abc', "F - test_backspace_to_start_of_line/data:1")check_eq(Editor_state.lines[2].data, 'f', "F - test_backspace_to_start_of_line/data:2")
check_eq(Cursor1.line, 2, "F - test_backspace_to_start_of_line/cursor:line")check_eq(Cursor1.pos, 1, "F - test_backspace_to_start_of_line/cursor:pos")
check_eq(Editor_state.cursor1.line, 2, "F - test_backspace_to_start_of_line/cursor:line")check_eq(Editor_state.cursor1.pos, 1, "F - test_backspace_to_start_of_line/cursor:pos")
Lines = load_array{'abc', 'def', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=4}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'def', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=4}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 2, 'F - test_undo_insert_text/baseline/cursor:line')check_eq(Cursor1.pos, 5, 'F - test_undo_insert_text/baseline/cursor:pos')check_nil(Selection1.line, 'F - test_undo_insert_text/baseline/selection:line')check_nil(Selection1.pos, 'F - test_undo_insert_text/baseline/selection:pos')local y = Margin_top
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_insert_text/baseline/cursor:line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_undo_insert_text/baseline/cursor:pos')check_nil(Editor_state.selection1.line, 'F - test_undo_insert_text/baseline/selection:line')check_nil(Editor_state.selection1.pos, 'F - test_undo_insert_text/baseline/selection:pos')local y = Editor_state.margin_top
check_eq(Cursor1.line, 2, 'F - test_undo_insert_text/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_undo_insert_text/cursor:pos')check_nil(Selection1.line, 'F - test_undo_insert_text/selection:line')check_nil(Selection1.pos, 'F - test_undo_insert_text/selection:pos')y = Margin_top
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_insert_text/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_undo_insert_text/cursor:pos')check_nil(Editor_state.selection1.line, 'F - test_undo_insert_text/selection:line')check_nil(Editor_state.selection1.pos, 'F - test_undo_insert_text/selection:pos')y = Editor_state.margin_top
Lines = load_array{'abc', 'defg', 'xyz'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=2, pos=5}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc', 'defg', 'xyz'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=2, pos=5}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Cursor1.line, 2, 'F - test_undo_delete_text/baseline/cursor:line')check_eq(Cursor1.pos, 4, 'F - test_undo_delete_text/baseline/cursor:pos')check_nil(Selection1.line, 'F - test_undo_delete_text/baseline/selection:line')check_nil(Selection1.pos, 'F - test_undo_delete_text/baseline/selection:pos')local y = Margin_top
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_delete_text/baseline/cursor:line')check_eq(Editor_state.cursor1.pos, 4, 'F - test_undo_delete_text/baseline/cursor:pos')check_nil(Editor_state.selection1.line, 'F - test_undo_delete_text/baseline/selection:line')check_nil(Editor_state.selection1.pos, 'F - test_undo_delete_text/baseline/selection:pos')local y = Editor_state.margin_top
check_eq(Cursor1.line, 2, 'F - test_undo_delete_text/cursor:line')check_eq(Cursor1.pos, 5, 'F - test_undo_delete_text/cursor:pos')check_nil(Selection1.line, 'F - test_undo_delete_text/selection:line')check_nil(Selection1.pos, 'F - test_undo_delete_text/selection:pos')--? check_eq(Selection1.line, 2, 'F - test_undo_delete_text/selection:line')--? check_eq(Selection1.pos, 4, 'F - test_undo_delete_text/selection:pos')y = Margin_top
check_eq(Editor_state.cursor1.line, 2, 'F - test_undo_delete_text/cursor:line')check_eq(Editor_state.cursor1.pos, 5, 'F - test_undo_delete_text/cursor:pos')check_nil(Editor_state.selection1.line, 'F - test_undo_delete_text/selection:line')check_nil(Editor_state.selection1.pos, 'F - test_undo_delete_text/selection:pos')--? check_eq(Editor_state.selection1.line, 2, 'F - test_undo_delete_text/selection:line')--? check_eq(Editor_state.selection1.pos, 4, 'F - test_undo_delete_text/selection:pos')y = Editor_state.margin_top
Lines = load_array{'abc'}Margin_right = 0; Margin_width = Margin_leftCursor1 = {line=1, pos=1}Selection1 = {line=1, pos=2}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}
Editor_state.lines = load_array{'abc'}Editor_state.margin_right = 0; Editor_state.margin_width = Editor_state.margin_leftEditor_state.cursor1 = {line=1, pos=1}Editor_state.selection1 = {line=1, pos=2}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}
check_eq(Lines[1].data, 'xbc', 'F - test_undo_restores_selection/baseline')check_nil(Selection1.line, 'F - test_undo_restores_selection/baseline:selection')
check_eq(Editor_state.lines[1].data, 'xbc', 'F - test_undo_restores_selection/baseline')check_nil(Editor_state.selection1.line, 'F - test_undo_restores_selection/baseline:selection')
check_eq(Selection1.line, 1, 'F - test_undo_restores_selection/line')check_eq(Selection1.pos, 2, 'F - test_undo_restores_selection/pos')
check_eq(Editor_state.selection1.line, 1, 'F - test_undo_restores_selection/line')check_eq(Editor_state.selection1.pos, 2, 'F - test_undo_restores_selection/pos')
--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(Screen_top1.line)..'; '..s(pos)..' vs '..s(Screen_top1.pos)..'; bottom: '..s(Screen_bottom1.line)..'/'..s(Screen_bottom1.pos))
--? print('('..s(x)..','..s(y)..') '..frag..'('..s(frag_width)..' vs '..s(right)..') '..s(line_index)..' vs '..s(Editor_state.screen_top1.line)..'; '..s(pos)..' vs '..s(Editor_state.screen_top1.pos)..'; bottom: '..s(Editor_state.screen_bottom1.line)..'/'..s(Editor_state.screen_bottom1.pos))
if Text.lt1(Screen_top1, {line=line_index, pos=pos}) theny = y + Line_heightif y + Line_height > App.screen.height then
if Text.lt1(Editor_state.screen_top1, {line=line_index, pos=pos}) theny = y + Editor_state.line_heightif y + Editor_state.line_height > App.screen.height then
if line_index == Cursor1.line thenif pos <= Cursor1.pos and pos + frag_len > Cursor1.pos thenif Search_term thenif Lines[Cursor1.line].data:sub(Cursor1.pos, Cursor1.pos+utf8.len(Search_term)-1) == Search_term thenlocal lo_px = Text.draw_highlight(line, x,y, pos, Cursor1.pos, Cursor1.pos+utf8.len(Search_term))
if line_index == Editor_state.cursor1.line thenif pos <= Editor_state.cursor1.pos and pos + frag_len > Editor_state.cursor1.pos thenif Editor_state.search_term thenif Editor_state.lines[Editor_state.cursor1.line].data:sub(Editor_state.cursor1.pos, Editor_state.cursor1.pos+utf8.len(Editor_state.search_term)-1) == Editor_state.search_term thenlocal lo_px = Text.draw_highlight(line, x,y, pos, Editor_state.cursor1.pos, Editor_state.cursor1.pos+utf8.len(Editor_state.search_term))
local before = snapshot(Cursor1.line)--? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
local before = snapshot(Editor_state.cursor1.line)--? print(Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
if Cursor_y >= App.screen.height - Line_height thenText.populate_screen_line_starting_pos(Lines[Cursor1.line], Margin_left, App.screen.width-Margin_right)Text.snap_cursor_to_bottom_of_screen(Margin_left, App.screen.width-Margin_right)--? print('=>', Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
if Editor_state.cursor_y >= App.screen.height - Editor_state.line_height thenText.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Text.snap_cursor_to_bottom_of_screen(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)--? print('=>', Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
local byte_offset = Text.offset(Lines[Cursor1.line].data, Cursor1.pos)Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)..t..string.sub(Lines[Cursor1.line].data, byte_offset)Text.clear_cache(Lines[Cursor1.line])Cursor1.pos = Cursor1.pos+1
local byte_offset = Text.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos)Editor_state.lines[Editor_state.cursor1.line].data = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, 1, byte_offset-1)..t..string.sub(Editor_state.lines[Editor_state.cursor1.line].data, byte_offset)Text.clear_cache(Editor_state.lines[Editor_state.cursor1.line])Editor_state.cursor1.pos = Editor_state.cursor1.pos+1
Selection1 = {}if (Cursor_y + Line_height) > App.screen.height thenText.snap_cursor_to_bottom_of_screen(Margin_left, App.screen.width-Margin_right)
Editor_state.selection1 = {}if (Editor_state.cursor_y + Editor_state.line_height) > App.screen.height thenText.snap_cursor_to_bottom_of_screen(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
local before = snapshot(Cursor1.line)--? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
local before = snapshot(Editor_state.cursor1.line)--? print(Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
if Cursor_y >= App.screen.height - Line_height thenText.populate_screen_line_starting_pos(Lines[Cursor1.line], Margin_left, App.screen.width-Margin_right)Text.snap_cursor_to_bottom_of_screen(Margin_left, App.screen.width-Margin_right)--? print('=>', Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
if Editor_state.cursor_y >= App.screen.height - Editor_state.line_height thenText.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Text.snap_cursor_to_bottom_of_screen(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)--? print('=>', Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
if Selection1.line thenText.delete_selection(Margin_left, App.screen.width-Margin_right)
if Editor_state.selection1.line thenText.delete_selection(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
if Cursor1.pos > 1 thenbefore = snapshot(Cursor1.line)local byte_start = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos-1)local byte_end = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
if Editor_state.cursor1.pos > 1 thenbefore = snapshot(Editor_state.cursor1.line)local byte_start = utf8.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos-1)local byte_end = utf8.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos)
Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1)..string.sub(Lines[Cursor1.line].data, byte_end)
Editor_state.lines[Editor_state.cursor1.line].data = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, 1, byte_start-1)..string.sub(Editor_state.lines[Editor_state.cursor1.line].data, byte_end)
elseif Cursor1.line > 1 thenbefore = snapshot(Cursor1.line-1, Cursor1.line)if Lines[Cursor1.line-1].mode == 'drawing' thentable.remove(Lines, Cursor1.line-1)
elseif Editor_state.cursor1.line > 1 thenbefore = snapshot(Editor_state.cursor1.line-1, Editor_state.cursor1.line)if Editor_state.lines[Editor_state.cursor1.line-1].mode == 'drawing' thentable.remove(Editor_state.lines, Editor_state.cursor1.line-1)
Cursor1.pos = utf8.len(Lines[Cursor1.line-1].data)+1Lines[Cursor1.line-1].data = Lines[Cursor1.line-1].data..Lines[Cursor1.line].datatable.remove(Lines, Cursor1.line)
Editor_state.cursor1.pos = utf8.len(Editor_state.lines[Editor_state.cursor1.line-1].data)+1Editor_state.lines[Editor_state.cursor1.line-1].data = Editor_state.lines[Editor_state.cursor1.line-1].data..Editor_state.lines[Editor_state.cursor1.line].datatable.remove(Editor_state.lines, Editor_state.cursor1.line)
if Text.lt1(Cursor1, Screen_top1) thenlocal top2 = Text.to2(Screen_top1, Margin_left, App.screen.width-Margin_right)top2 = Text.previous_screen_line(top2, Margin_left, App.screen.width-Margin_right)Screen_top1 = Text.to1(top2)
if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) thenlocal top2 = Text.to2(Editor_state.screen_top1, Editor_state.margin_left, App.screen.width-Editor_state.margin_right)top2 = Text.previous_screen_line(top2, Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Editor_state.screen_top1 = Text.to1(top2)
if Selection1.line thenText.delete_selection(Margin_left, App.screen.width-Margin_right)
if Editor_state.selection1.line thenText.delete_selection(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
if Cursor1.pos <= utf8.len(Lines[Cursor1.line].data) thenlocal byte_start = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)local byte_end = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos+1)
if Editor_state.cursor1.pos <= utf8.len(Editor_state.lines[Editor_state.cursor1.line].data) thenlocal byte_start = utf8.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos)local byte_end = utf8.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos+1)
Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_start-1)..string.sub(Lines[Cursor1.line].data, byte_end)
Editor_state.lines[Editor_state.cursor1.line].data = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, 1, byte_start-1)..string.sub(Editor_state.lines[Editor_state.cursor1.line].data, byte_end)
elseif Cursor1.line < #Lines thenif Lines[Cursor1.line+1].mode == 'drawing' thentable.remove(Lines, Cursor1.line+1)
elseif Editor_state.cursor1.line < #Editor_state.lines thenif Editor_state.lines[Editor_state.cursor1.line+1].mode == 'drawing' thentable.remove(Editor_state.lines, Editor_state.cursor1.line+1)
Lines[Cursor1.line].data = Lines[Cursor1.line].data..Lines[Cursor1.line+1].datatable.remove(Lines, Cursor1.line+1)
Editor_state.lines[Editor_state.cursor1.line].data = Editor_state.lines[Editor_state.cursor1.line].data..Editor_state.lines[Editor_state.cursor1.line+1].datatable.remove(Editor_state.lines, Editor_state.cursor1.line+1)
Text.end_of_line(Margin_left, App.screen.width-Margin_right)Selection1 = {}
Text.end_of_line(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Editor_state.selection1 = {}
local byte_offset = Text.offset(Lines[Cursor1.line].data, Cursor1.pos)table.insert(Lines, Cursor1.line+1, {mode='text', data=string.sub(Lines[Cursor1.line].data, byte_offset)})Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)Text.clear_cache(Lines[Cursor1.line])Text.clear_cache(Lines[Cursor1.line+1])Cursor1.line = Cursor1.line+1Cursor1.pos = 1
local byte_offset = Text.offset(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos)table.insert(Editor_state.lines, Editor_state.cursor1.line+1, {mode='text', data=string.sub(Editor_state.lines[Editor_state.cursor1.line].data, byte_offset)})Editor_state.lines[Editor_state.cursor1.line].data = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, 1, byte_offset-1)Text.clear_cache(Editor_state.lines[Editor_state.cursor1.line])Text.clear_cache(Editor_state.lines[Editor_state.cursor1.line+1])Editor_state.cursor1.line = Editor_state.cursor1.line+1Editor_state.cursor1.pos = 1
if Screen_top1.line == 1 and Screen_top1.pos == 1 then break endif Lines[Screen_top1.line].mode == 'text' theny = y - Line_heightelseif Lines[Screen_top1.line].mode == 'drawing' theny = y - Drawing_padding_height - Drawing.pixels(Lines[Screen_top1.line].h)
if Editor_state.screen_top1.line == 1 and Editor_state.screen_top1.pos == 1 then break endif Editor_state.lines[Editor_state.screen_top1.line].mode == 'text' theny = y - Editor_state.line_heightelseif Editor_state.lines[Editor_state.screen_top1.line].mode == 'drawing' theny = y - Editor_state.drawing_padding_height - Drawing.pixels(Editor_state.lines[Editor_state.screen_top1.line].h)
--? print('setting top to', Screen_top1.line, Screen_top1.pos)Cursor1.line = Screen_top1.lineCursor1.pos = Screen_top1.pos
--? print('setting top to', Editor_state.screen_top1.line, Editor_state.screen_top1.pos)Editor_state.cursor1.line = Editor_state.screen_top1.lineEditor_state.cursor1.pos = Editor_state.screen_top1.pos
assert(Lines[Cursor1.line].mode == 'text')--? print('up', Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos)
assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')--? print('up', Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_top1.line, Editor_state.screen_top1.pos)
Cursor1.line = new_cursor_lineText.populate_screen_line_starting_pos(Lines[Cursor1.line], left, right)
Editor_state.cursor1.line = new_cursor_lineText.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], left, right)
if Screen_top1.line > Cursor1.line thenScreen_top1.line = Cursor1.lineScreen_top1.pos = screen_line_starting_pos--? print('pos of top of screen is also '..tostring(Screen_top1.pos)..' of the same line')
if Editor_state.screen_top1.line > Editor_state.cursor1.line thenEditor_state.screen_top1.line = Editor_state.cursor1.lineEditor_state.screen_top1.pos = screen_line_starting_pos--? print('pos of top of screen is also '..tostring(Editor_state.screen_top1.pos)..' of the same line')
local screen_line_starting_byte_offset = Text.offset(Lines[Cursor1.line].data, screen_line_starting_pos)local s = string.sub(Lines[Cursor1.line].data, screen_line_starting_byte_offset)Cursor1.pos = screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x, left) - 1
local screen_line_starting_byte_offset = Text.offset(Editor_state.lines[Editor_state.cursor1.line].data, screen_line_starting_pos)local s = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, screen_line_starting_byte_offset)Editor_state.cursor1.pos = screen_line_starting_pos + Text.nearest_cursor_pos(s, Editor_state.cursor_x, left) - 1
if Screen_top1.line == Cursor1.line and Screen_top1.pos == screen_line_starting_pos thenScreen_top1.pos = new_screen_line_starting_pos--? print('also setting pos of top of screen to '..tostring(Screen_top1.pos))
if Editor_state.screen_top1.line == Editor_state.cursor1.line and Editor_state.screen_top1.pos == screen_line_starting_pos thenEditor_state.screen_top1.pos = new_screen_line_starting_pos--? print('also setting pos of top of screen to '..tostring(Editor_state.screen_top1.pos))
local new_screen_line_starting_byte_offset = Text.offset(Lines[Cursor1.line].data, new_screen_line_starting_pos)local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_byte_offset)Cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x, left) - 1--? print('cursor pos is now '..tostring(Cursor1.pos))
local new_screen_line_starting_byte_offset = Text.offset(Editor_state.lines[Editor_state.cursor1.line].data, new_screen_line_starting_pos)local s = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, new_screen_line_starting_byte_offset)Editor_state.cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Editor_state.cursor_x, left) - 1--? print('cursor pos is now '..tostring(Editor_state.cursor1.pos))
assert(Lines[Cursor1.line].mode == 'text')--? print('down', Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos, Screen_bottom1.line, Screen_bottom1.pos)
assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')--? print('down', Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
if Lines[new_cursor_line].mode == 'text' thenCursor1.line = new_cursor_lineCursor1.pos = Text.nearest_cursor_pos(Lines[Cursor1.line].data, Cursor_x, left)--? print(Cursor1.pos)
if Editor_state.lines[new_cursor_line].mode == 'text' thenEditor_state.cursor1.line = new_cursor_lineEditor_state.cursor1.pos = Text.nearest_cursor_pos(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor_x, left)--? print(Editor_state.cursor1.pos)
if Cursor1.line > Screen_bottom1.line then--? print('screen top before:', Screen_top1.line, Screen_top1.pos)
if Editor_state.cursor1.line > Editor_state.screen_bottom1.line then--? print('screen top before:', Editor_state.screen_top1.line, Editor_state.screen_top1.pos)
new_screen_line_starting_pos = Lines[Cursor1.line].screen_line_starting_pos[screen_line_index+1]
new_screen_line_starting_pos = Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos[screen_line_index+1]
local new_screen_line_starting_byte_offset = Text.offset(Lines[Cursor1.line].data, new_screen_line_starting_pos)local s = string.sub(Lines[Cursor1.line].data, new_screen_line_starting_byte_offset)Cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x, left) - 1--? print('cursor pos is now', Cursor1.line, Cursor1.pos)
local new_screen_line_starting_byte_offset = Text.offset(Editor_state.lines[Editor_state.cursor1.line].data, new_screen_line_starting_pos)local s = string.sub(Editor_state.lines[Editor_state.cursor1.line].data, new_screen_line_starting_byte_offset)Editor_state.cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Editor_state.cursor_x, left) - 1--? print('cursor pos is now', Editor_state.cursor1.line, Editor_state.cursor1.pos)
--? print('=>', Cursor1.line, Cursor1.pos, Screen_top1.line, Screen_top1.pos, Screen_bottom1.line, Screen_bottom1.pos)
--? print('=>', Editor_state.cursor1.line, Editor_state.cursor1.pos, Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.screen_bottom1.line, Editor_state.screen_bottom1.pos)
Cursor1.pos = 1if Text.lt1(Cursor1, Screen_top1) thenScreen_top1 = {line=Cursor1.line, pos=Cursor1.pos} -- copy
Editor_state.cursor1.pos = 1if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) thenEditor_state.screen_top1 = {line=Editor_state.cursor1.line, pos=Editor_state.cursor1.pos} -- copy
assert(Cursor1.pos > 1)if Text.match(Lines[Cursor1.line].data, Cursor1.pos-1, '%s') then
assert(Editor_state.cursor1.pos > 1)if Text.match(Editor_state.lines[Editor_state.cursor1.line].data, Editor_state.cursor1.pos-1, '%s') then
assert(Lines[Cursor1.line].mode == 'text')if Cursor1.pos > 1 thenCursor1.pos = Cursor1.pos-1
assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')if Editor_state.cursor1.pos > 1 thenEditor_state.cursor1.pos = Editor_state.cursor1.pos-1
if Lines[new_cursor_line].mode == 'text' thenCursor1.line = new_cursor_lineCursor1.pos = utf8.len(Lines[Cursor1.line].data) + 1
if Editor_state.lines[new_cursor_line].mode == 'text' thenEditor_state.cursor1.line = new_cursor_lineEditor_state.cursor1.pos = utf8.len(Editor_state.lines[Editor_state.cursor1.line].data) + 1
assert(Lines[Cursor1.line].mode == 'text')if Cursor1.pos <= utf8.len(Lines[Cursor1.line].data) thenCursor1.pos = Cursor1.pos+1
assert(Editor_state.lines[Editor_state.cursor1.line].mode == 'text')if Editor_state.cursor1.pos <= utf8.len(Editor_state.lines[Editor_state.cursor1.line].data) thenEditor_state.cursor1.pos = Editor_state.cursor1.pos+1
Text.populate_screen_line_starting_pos(Lines[Cursor1.line], left, right)for i=#Lines[Cursor1.line].screen_line_starting_pos,1,-1 dolocal spos = Lines[Cursor1.line].screen_line_starting_pos[i]if spos <= Cursor1.pos then
Text.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], left, right)for i=#Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos,1,-1 dolocal spos = Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos[i]if spos <= Editor_state.cursor1.pos then
Text.populate_screen_line_starting_pos(Lines[Cursor1.line], left, right)local screen_lines = Lines[Cursor1.line].screen_line_starting_pos--? print(screen_lines[#screen_lines], Cursor1.pos)return screen_lines[#screen_lines] <= Cursor1.pos
Text.populate_screen_line_starting_pos(Editor_state.lines[Editor_state.cursor1.line], left, right)local screen_lines = Editor_state.lines[Editor_state.cursor1.line].screen_line_starting_pos--? print(screen_lines[#screen_lines], Editor_state.cursor1.pos)return screen_lines[#screen_lines] <= Editor_state.cursor1.pos
local y = Margin_topwhile Cursor1.line <= #Lines doif Lines[Cursor1.line].mode == 'text' then
local y = Editor_state.margin_topwhile Editor_state.cursor1.line <= #Editor_state.lines doif Editor_state.lines[Editor_state.cursor1.line].mode == 'text' then
--? print('cursor skips', Cursor1.line)y = y + Drawing_padding_height + Drawing.pixels(Lines[Cursor1.line].h)Cursor1.line = Cursor1.line + 1
--? print('cursor skips', Editor_state.cursor1.line)y = y + Editor_state.drawing_padding_height + Drawing.pixels(Editor_state.lines[Editor_state.cursor1.line].h)Editor_state.cursor1.line = Editor_state.cursor1.line + 1
if Cursor1.line > #Lines thenassert(Cursor1.line == #Lines+1)table.insert(Lines, {mode='text', data=''})
if Editor_state.cursor1.line > #Editor_state.lines thenassert(Editor_state.cursor1.line == #Editor_state.lines+1)table.insert(Editor_state.lines, {mode='text', data=''})
--? print('cursor pos '..tostring(Cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')local y = App.screen.height - Line_height
--? print('cursor pos '..tostring(Editor_state.cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')local y = App.screen.height - Editor_state.line_height
if top2.screen_line > 1 or Lines[top2.line-1].mode == 'text' thenlocal h = Line_heightif y - h < Margin_top then
if top2.screen_line > 1 or Editor_state.lines[top2.line-1].mode == 'text' thenlocal h = Editor_state.line_heightif y - h < Editor_state.margin_top then
local h = Drawing_padding_height + Drawing.pixels(Lines[top2.line-1].h)if y - h < Margin_top then
local h = Editor_state.drawing_padding_height + Drawing.pixels(Editor_state.lines[top2.line-1].h)if y - h < Editor_state.margin_top then
return y < line.starty + Line_height*(#line.screen_line_starting_pos - Text.screen_line_index(line, line.startpos) + 1)
return y < line.starty + Editor_state.line_height*(#line.screen_line_starting_pos - Text.screen_line_index(line, line.startpos) + 1)
Text.populate_screen_line_starting_pos(Lines[pos1.line], left, right)for i=#Lines[pos1.line].screen_line_starting_pos,1,-1 dolocal spos = Lines[pos1.line].screen_line_starting_pos[i]
Text.populate_screen_line_starting_pos(Editor_state.lines[pos1.line], left, right)for i=#Editor_state.lines[pos1.line].screen_line_starting_pos,1,-1 dolocal spos = Editor_state.lines[pos1.line].screen_line_starting_pos[i]
local l = Lines[pos2.line-1]Text.populate_screen_line_starting_pos(Lines[pos2.line-1], left, right)return {line=pos2.line-1, screen_line=#Lines[pos2.line-1].screen_line_starting_pos, screen_pos=1}
local l = Editor_state.lines[pos2.line-1]Text.populate_screen_line_starting_pos(Editor_state.lines[pos2.line-1], left, right)return {line=pos2.line-1, screen_line=#Editor_state.lines[pos2.line-1].screen_line_starting_pos, screen_pos=1}
--? print('a', Selection1.line)if Screen_top1.pos == 1 then return endlocal line = Lines[Screen_top1.line]
--? print('a', Editor_state.selection1.line)if Editor_state.screen_top1.pos == 1 then return endlocal line = Editor_state.lines[Editor_state.screen_top1.line]
if Text.lt1(Cursor1, Screen_top1) thenCursor1 = {line=Screen_top1.line, pos=Screen_top1.pos}elseif Cursor1.line >= Screen_bottom1.line then
if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) thenEditor_state.cursor1 = {line=Editor_state.screen_top1.line, pos=Editor_state.screen_top1.pos}elseif Editor_state.cursor1.line >= Editor_state.screen_bottom1.line then
if Selection1.line == nil then return nil,nil end-- min,max = sorted(Selection1,Cursor1)local minl,minp = Selection1.line,Selection1.pos
if Editor_state.selection1.line == nil then return nil,nil end-- min,max = sorted(Editor_state.selection1,Editor_state.cursor1)local minl,minp = Editor_state.selection1.line,Editor_state.selection1.pos
if Recent_mouse.time and Recent_mouse.time > time-0.1 thenreturn Recent_mouse.line, Recent_mouse.pos
if Editor_state.recent_mouse.time and Editor_state.recent_mouse.time > time-0.1 thenreturn Editor_state.recent_mouse.line, Editor_state.recent_mouse.pos
if Selection1.line == nil then return endlocal minl,maxl = minmax(Selection1.line, Cursor1.line)
if Editor_state.selection1.line == nil then return endlocal minl,maxl = minmax(Editor_state.selection1.line, Editor_state.cursor1.line)
if Selection1.line == nil then return end-- min,max = sorted(Selection1,Cursor1)local minl,minp = Selection1.line,Selection1.poslocal maxl,maxp = Cursor1.line,Cursor1.pos
if Editor_state.selection1.line == nil then return end-- min,max = sorted(Editor_state.selection1,Editor_state.cursor1)local minl,minp = Editor_state.selection1.line,Editor_state.selection1.poslocal maxl,maxp = Editor_state.cursor1.line,Editor_state.cursor1.pos
-- update Cursor1 and Selection1Cursor1.line = minlCursor1.pos = minpif Text.lt1(Cursor1, Screen_top1) thenScreen_top1.line = Cursor1.line_,Screen_top1.pos = Text.pos_at_start_of_cursor_screen_line(left, right)
-- update Editor_state.cursor1 and Editor_state.selection1Editor_state.cursor1.line = minlEditor_state.cursor1.pos = minpif Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) thenEditor_state.screen_top1.line = Editor_state.cursor1.line_,Editor_state.screen_top1.pos = Text.pos_at_start_of_cursor_screen_line(left, right)
Text.clear_cache(Lines[minl])local min_offset = Text.offset(Lines[minl].data, minp)local max_offset = Text.offset(Lines[maxl].data, maxp)
Text.clear_cache(Editor_state.lines[minl])local min_offset = Text.offset(Editor_state.lines[minl].data, minp)local max_offset = Text.offset(Editor_state.lines[maxl].data, maxp)
if Selection1.line == nil then return end-- min,max = sorted(Selection1,Cursor1)local minl,minp = Selection1.line,Selection1.poslocal maxl,maxp = Cursor1.line,Cursor1.pos
if Editor_state.selection1.line == nil then return end-- min,max = sorted(Editor_state.selection1,Editor_state.cursor1)local minl,minp = Editor_state.selection1.line,Editor_state.selection1.poslocal maxl,maxp = Editor_state.cursor1.line,Editor_state.cursor1.pos
if Search_text == nil thenSearch_text = App.newText(love.graphics.getFont(), Search_term)
if Editor_state.search_text == nil thenEditor_state.search_text = App.newText(love.graphics.getFont(), Editor_state.search_term)
Cursor1.line = Search_backup.cursor.lineCursor1.pos = Search_backup.cursor.posScreen_top1.line = Search_backup.screen_top.lineScreen_top1.pos = Search_backup.screen_top.pos
Editor_state.cursor1.line = Editor_state.search_backup.cursor.lineEditor_state.cursor1.pos = Editor_state.search_backup.cursor.posEditor_state.screen_top1.line = Editor_state.search_backup.screen_top.lineEditor_state.screen_top1.pos = Editor_state.search_backup.screen_top.pos
if Text.lt1(Cursor1, Screen_top1) or Text.lt1(Screen_bottom1, Cursor1) thenScreen_top1.line = Cursor1.linelocal _, pos = Text.pos_at_start_of_cursor_screen_line(Margin_left, App.screen.width-Margin_right)Screen_top1.pos = pos
if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) or Text.lt1(Editor_state.screen_bottom1, Editor_state.cursor1) thenEditor_state.screen_top1.line = Editor_state.cursor1.linelocal _, pos = Text.pos_at_start_of_cursor_screen_line(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Editor_state.screen_top1.pos = pos
Cursor1.line = Search_backup.cursor.lineCursor1.pos = Search_backup.cursor.posScreen_top1.line = Search_backup.screen_top.lineScreen_top1.pos = Search_backup.screen_top.pos
Editor_state.cursor1.line = Editor_state.search_backup.cursor.lineEditor_state.cursor1.pos = Editor_state.search_backup.cursor.posEditor_state.screen_top1.line = Editor_state.search_backup.screen_top.lineEditor_state.screen_top1.pos = Editor_state.search_backup.screen_top.pos
if Text.lt1(Cursor1, Screen_top1) or Text.lt1(Screen_bottom1, Cursor1) thenScreen_top1.line = Cursor1.linelocal _, pos = Text.pos_at_start_of_cursor_screen_line(Margin_left, App.screen.width-Margin_right)Screen_top1.pos = pos
if Text.lt1(Editor_state.cursor1, Editor_state.screen_top1) or Text.lt1(Editor_state.screen_bottom1, Editor_state.cursor1) thenEditor_state.screen_top1.line = Editor_state.cursor1.linelocal _, pos = Text.pos_at_start_of_cursor_screen_line(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)Editor_state.screen_top1.pos = pos
Filename = 'foo'App.screen.init{width=Margin_left+300, height=300}check_eq(App.screen.width, Margin_left+300, 'F - test_resize_window/baseline/width')
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_left+300, height=300}check_eq(App.screen.width, Editor_state.margin_left+300, 'F - test_resize_window/baseline/width')
check_eq(#Lines, 3, 'F - test_drop_file/#lines')check_eq(Lines[1].data, 'abc', 'F - test_drop_file/lines:1')check_eq(Lines[2].data, 'def', 'F - test_drop_file/lines:2')check_eq(Lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
check_eq(#Editor_state.lines, 3, 'F - test_drop_file/#lines')check_eq(Editor_state.lines[1].data, 'abc', 'F - test_drop_file/lines:1')check_eq(Editor_state.lines[2].data, 'def', 'F - test_drop_file/lines:2')check_eq(Editor_state.lines[3].data, 'ghi', 'F - test_drop_file/lines:3')
Filename = arg[1]Lines = load_from_disk(Filename)Screen_top1 = {line=1, pos=1}Cursor1 = {line=1, pos=1}for i,line in ipairs(Lines) do
Editor_state.filename = arg[1]Editor_state.lines = load_from_disk(Editor_state.filename)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}for i,line in ipairs(Editor_state.lines) do
Lines = load_from_disk(Filename)if Cursor1.line > #Lines or Lines[Cursor1.line].mode ~= 'text' thenfor i,line in ipairs(Lines) do
Editor_state.lines = load_from_disk(Editor_state.filename)if Editor_state.cursor1.line > #Editor_state.lines or Editor_state.lines[Editor_state.cursor1.line].mode ~= 'text' thenfor i,line in ipairs(Editor_state.lines) do
Selection1 = {} -- no support for shift drag while we're resizingText.tweak_screen_top_and_cursor(Margin_left, App.screen.height-Margin_right)
Editor_state.selection1 = {} -- no support for shift drag while we're resizingText.tweak_screen_top_and_cursor(Editor_state.margin_left, App.screen.height-Editor_state.margin_right)
Font_height = font_heightlove.graphics.setFont(love.graphics.newFont(Font_height))Line_height = math.floor(font_height*1.3)
Editor_state.font_height = font_heightlove.graphics.setFont(love.graphics.newFont(Editor_state.font_height))Editor_state.line_height = math.floor(font_height*1.3)
love.graphics.print("Things you can do:", Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Press the mouse button to start drawing a "..current_shape(), Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Hover on a point and press 'ctrl+u' to pick it up and start moving it,", Margin_left+30,y)y = y + Line_heightlove.graphics.print("then press the mouse button to drop it", Margin_left+30+bullet_indent(),y)y = y + Line_heightlove.graphics.print("* Hover on a point and press 'ctrl+n', type a name, then press 'enter'", Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Hover on a point or shape and press 'ctrl+d' to delete it", Margin_left+30,y)y = y + Line_heightif Current_drawing_mode ~= 'freehand' thenlove.graphics.print("* Press 'ctrl+p' to switch to drawing freehand strokes", Margin_left+30,y)y = y + Line_height
love.graphics.print("Things you can do:", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Press the mouse button to start drawing a "..current_shape(), Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Hover on a point and press 'ctrl+u' to pick it up and start moving it,", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("then press the mouse button to drop it", Editor_state.margin_left+30+bullet_indent(),y)y = y + Editor_state.line_heightlove.graphics.print("* Hover on a point and press 'ctrl+n', type a name, then press 'enter'", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Hover on a point or shape and press 'ctrl+d' to delete it", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightif Editor_state.current_drawing_mode ~= 'freehand' thenlove.graphics.print("* Press 'ctrl+p' to switch to drawing freehand strokes", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'line' thenlove.graphics.print("* Press 'ctrl+l' to switch to drawing lines", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'line' thenlove.graphics.print("* Press 'ctrl+l' to switch to drawing lines", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'manhattan' thenlove.graphics.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'manhattan' thenlove.graphics.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'circle' thenlove.graphics.print("* Press 'ctrl+o' to switch to drawing circles/arcs", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'circle' thenlove.graphics.print("* Press 'ctrl+o' to switch to drawing circles/arcs", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'polygon' thenlove.graphics.print("* Press 'ctrl+g' to switch to drawing polygons", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'polygon' thenlove.graphics.print("* Press 'ctrl+g' to switch to drawing polygons", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'rectangle' thenlove.graphics.print("* Press 'ctrl+r' to switch to drawing rectangles", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'rectangle' thenlove.graphics.print("* Press 'ctrl+r' to switch to drawing rectangles", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'square' thenlove.graphics.print("* Press 'ctrl+s' to switch to drawing squares", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'square' thenlove.graphics.print("* Press 'ctrl+s' to switch to drawing squares", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
love.graphics.print("* Press 'ctrl+=' or 'ctrl+-' to zoom in or out, ctrl+0 to reset zoom", Margin_left+30,y)y = y + Line_heightlove.graphics.print("Press 'esc' now to hide this message", Margin_left+30,y)y = y + Line_height
love.graphics.print("* Press 'ctrl+=' or 'ctrl+-' to zoom in or out, ctrl+0 to reset zoom", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("Press 'esc' now to hide this message", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
love.graphics.rectangle('fill', Margin_left,drawing.y, App.screen.width-Margin_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
love.graphics.rectangle('fill', Editor_state.margin_left,drawing.y, App.screen.width-Editor_state.margin_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
love.graphics.print("You're currently drawing a "..current_shape(drawing.pending), Margin_left+30,y)y = y + Line_heightlove.graphics.print('Things you can do now:', Margin_left+30,y)y = y + Line_heightif Current_drawing_mode == 'freehand' thenlove.graphics.print('* Release the mouse button to finish drawing the stroke', Margin_left+30,y)y = y + Line_heightelseif Current_drawing_mode == 'line' or Current_drawing_mode == 'manhattan' thenlove.graphics.print('* Release the mouse button to finish drawing the line', Margin_left+30,y)y = y + Line_heightelseif Current_drawing_mode == 'circle' then
love.graphics.print("You're currently drawing a "..current_shape(drawing.pending), Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print('Things you can do now:', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightif Editor_state.current_drawing_mode == 'freehand' thenlove.graphics.print('* Release the mouse button to finish drawing the stroke', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightelseif Editor_state.current_drawing_mode == 'line' or Editor_state.current_drawing_mode == 'manhattan' thenlove.graphics.print('* Release the mouse button to finish drawing the line', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightelseif Editor_state.current_drawing_mode == 'circle' then
love.graphics.print('* Release the mouse button to finish drawing the circle', Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Press 'a' to draw just an arc of a circle", Margin_left+30,y)
love.graphics.print('* Release the mouse button to finish drawing the circle', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Press 'a' to draw just an arc of a circle", Editor_state.margin_left+30,y)
y = y + Line_heightelseif Current_drawing_mode == 'polygon' thenlove.graphics.print('* Release the mouse button to finish drawing the polygon', Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Press 'p' to add a vertex to the polygon", Margin_left+30,y)y = y + Line_heightelseif Current_drawing_mode == 'rectangle' then
y = y + Editor_state.line_heightelseif Editor_state.current_drawing_mode == 'polygon' thenlove.graphics.print('* Release the mouse button to finish drawing the polygon', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Press 'p' to add a vertex to the polygon", Editor_state.margin_left+30,y)y = y + Editor_state.line_heightelseif Editor_state.current_drawing_mode == 'rectangle' then
love.graphics.print('* Release the mouse button to finish drawing the rectangle', Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Press 'p' to replace the second vertex of the rectangle", Margin_left+30,y)y = y + Line_height
love.graphics.print('* Release the mouse button to finish drawing the rectangle', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Press 'p' to replace the second vertex of the rectangle", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
love.graphics.print('* Release the mouse button to finish drawing the square', Margin_left+30,y)y = y + Line_heightlove.graphics.print("* Press 'p' to replace the second vertex of the square", Margin_left+30,y)y = y + Line_height
love.graphics.print('* Release the mouse button to finish drawing the square', Editor_state.margin_left+30,y)y = y + Editor_state.line_heightlove.graphics.print("* Press 'p' to replace the second vertex of the square", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", Margin_left+30,y)y = y + Line_heighty = y + Line_heightif Current_drawing_mode ~= 'line' thenlove.graphics.print("* Press 'l' to switch to drawing lines", Margin_left+30,y)y = y + Line_height
love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", Editor_state.margin_left+30,y)y = y + Editor_state.line_heighty = y + Editor_state.line_heightif Editor_state.current_drawing_mode ~= 'line' thenlove.graphics.print("* Press 'l' to switch to drawing lines", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'manhattan' thenlove.graphics.print("* Press 'm' to switch to drawing horizontal/vertical lines", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'manhattan' thenlove.graphics.print("* Press 'm' to switch to drawing horizontal/vertical lines", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'circle' thenlove.graphics.print("* Press 'o' to switch to drawing circles/arcs", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'circle' thenlove.graphics.print("* Press 'o' to switch to drawing circles/arcs", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'polygon' thenlove.graphics.print("* Press 'g' to switch to drawing polygons", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'polygon' thenlove.graphics.print("* Press 'g' to switch to drawing polygons", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'rectangle' thenlove.graphics.print("* Press 'r' to switch to drawing rectangles", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'rectangle' thenlove.graphics.print("* Press 'r' to switch to drawing rectangles", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
if Current_drawing_mode ~= 'square' thenlove.graphics.print("* Press 's' to switch to drawing squares", Margin_left+30,y)y = y + Line_height
if Editor_state.current_drawing_mode ~= 'square' thenlove.graphics.print("* Press 's' to switch to drawing squares", Editor_state.margin_left+30,y)y = y + Editor_state.line_height
love.graphics.rectangle('fill', Margin_left,drawing.y, App.screen.width-Margin_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
love.graphics.rectangle('fill', Editor_state.margin_left,drawing.y, App.screen.width-Editor_state.margin_width, math.max(Drawing.pixels(drawing.h),y-drawing.y))
function edit.initialize_globals()-- a line is either text or a drawing-- a text is a table with:-- mode = 'text',-- string data,-- startpos, the index of data the line starts rendering from (if currently on screen), can only be >1 for topmost line on screen-- starty, the y coord in pixels-- some cached data that's blown away and recomputed when data changes:-- fragments: snippets of rendered love.graphics.Text, guaranteed to not wrap-- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line-- a drawing is a table with:-- mode = 'drawing'-- a (y) coord in pixels (updated while painting screen),-- a (h)eight,-- an array of points, and-- an array of shapes-- a shape is a table containing:-- a mode-- an array points for mode 'freehand' (raw x,y coords; freehand drawings don't pollute the points array of a drawing)-- an array vertices for mode 'polygon', 'rectangle', 'square'-- p1, p2 for mode 'line'-- center, radius for mode 'circle'-- center, radius, start_angle, end_angle for mode 'arc'-- Unless otherwise specified, coord fields are normalized; a drawing is always 256 units wide-- The field names are carefully chosen so that switching modes in midstream-- remembers previously entered points where that makes sense.Lines = {{mode='text', data=''}}
function edit.initialize_state()local result = {-- a line is either text or a drawing-- a text is a table with:-- mode = 'text',-- string data,-- startpos, the index of data the line starts rendering from (if currently on screen), can only be >1 for topmost line on screen-- starty, the y coord in pixels-- some cached data that's blown away and recomputed when data changes:-- fragments: snippets of rendered love.graphics.Text, guaranteed to not wrap-- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line-- a drawing is a table with:-- mode = 'drawing'-- a (y) coord in pixels (updated while painting screen),-- a (h)eight,-- an array of points, and-- an array of shapes-- a shape is a table containing:-- a mode-- an array points for mode 'freehand' (raw x,y coords; freehand drawings don't pollute the points array of a drawing)-- an array vertices for mode 'polygon', 'rectangle', 'square'-- p1, p2 for mode 'line'-- center, radius for mode 'circle'-- center, radius, start_angle, end_angle for mode 'arc'-- Unless otherwise specified, coord fields are normalized; a drawing is always 256 units wide-- The field names are carefully chosen so that switching modes in midstream-- remembers previously entered points where that makes sense.lines = {{mode='text', data=''}},
-- Lines can be too long to fit on screen, in which case they _wrap_ into-- multiple _screen lines_.---- Therefore, any potential location for the cursor can be described in two ways:-- * schema 1: As a combination of line index and position within a line (in utf8 codepoint units)-- * schema 2: As a combination of line index, screen line index within the line, and a position within the screen line.---- Most of the time we'll only persist positions in schema 1, translating to-- schema 2 when that's convenient.---- Make sure these coordinates are never aliased, so that changing one causes-- action at a distance.Screen_top1 = {line=1, pos=1} -- position of start of screen line at top of screenCursor1 = {line=1, pos=1} -- position of cursorScreen_bottom1 = {line=1, pos=1} -- position of start of screen line at bottom of screen
-- Lines can be too long to fit on screen, in which case they _wrap_ into-- multiple _screen lines_.---- Therefore, any potential location for the cursor can be described in two ways:-- * schema 1: As a combination of line index and position within a line (in utf8 codepoint units)-- * schema 2: As a combination of line index, screen line index within the line, and a position within the screen line.---- Most of the time we'll only persist positions in schema 1, translating to-- schema 2 when that's convenient.---- Make sure these coordinates are never aliased, so that changing one causes-- action at a distance.screen_top1 = {line=1, pos=1}, -- position of start of screen line at top of screencursor1 = {line=1, pos=1}, -- position of cursorscreen_bottom1 = {line=1, pos=1}, -- position of start of screen line at bottom of screen
Selection1 = {}Old_cursor1, Old_selection1, Mousepress_shift = nil -- some extra state to compute selection between mouse press and releaseRecent_mouse = {} -- when selecting text, avoid recomputing some state on every single frame
selection1 = {},-- some extra state to compute selection between mouse press and releaseold_cursor1 = nil,old_selection1 = nil,mousepress_shift = nil,-- when selecting text, avoid recomputing some state on every single framerecent_mouse = {},
-- values for testsFont_height = 14Line_height = 15-- widest possible character widthEm = App.newText(love.graphics.getFont(), 'm')
current_drawing_mode = 'line',previous_drawing_mode = nil, -- extra state for some ephemeral modes like moving/deleting/naming points
Margin_top = 15Margin_left = 25Margin_right = 25Margin_width = Margin_left + Margin_right
-- these default values are important for testsfont_height = 14,line_height = 15,-- widest possible character widthem = App.newText(love.graphics.getFont(), 'm'),
end -- App.initialize_globals
-- searchsearch_term = nil,search_text = nil,search_backup = nil, -- stuff to restore when cancelling search}result.margin_width = result.margin_left + result.margin_rightresult.drawing_padding_height = result.drawing_padding_top + result.drawing_padding_bottomreturn resultend -- App.initialize_state
--? print(Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos)assert(Text.le1(Screen_top1, Cursor1))Cursor_y = -1local y = Margin_top
--? print(Editor_state.screen_top1.line, Editor_state.screen_top1.pos, Editor_state.cursor1.line, Editor_state.cursor1.pos)assert(Text.le1(Editor_state.screen_top1, Editor_state.cursor1))Editor_state.cursor_y = -1local y = Editor_state.margin_top
table.insert(Lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})if Cursor1.line >= line_index thenCursor1.line = Cursor1.line+1
table.insert(Editor_state.lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})if Editor_state.cursor1.line >= line_index thenEditor_state.cursor1.line = Editor_state.cursor1.line+1
y, Screen_bottom1.pos = Text.draw(line, line_index, line.starty, Margin_left, App.screen.width-Margin_right)y = y + Line_height
y, Editor_state.screen_bottom1.pos = Text.draw(line, line_index, line.starty, Editor_state.margin_left, App.screen.width-Editor_state.margin_right)y = y + Editor_state.line_height
--? print('screen bottom: '..tostring(Screen_bottom1.pos)..' in '..tostring(Lines[Screen_bottom1.line].data))if Search_term then
--? print('screen bottom: '..tostring(Editor_state.screen_bottom1.pos)..' in '..tostring(Editor_state.lines[Editor_state.screen_bottom1.line].data))if Editor_state.search_term then
if Next_save and Next_save < App.getTime() thensave_to_disk(Lines, Filename)Next_save = nil
if Editor_state.next_save and Editor_state.next_save < App.getTime() thensave_to_disk(Editor_state.lines, Editor_state.filename)Editor_state.next_save = nil
if Next_save == nil thenNext_save = App.getTime() + 3 -- short enough that you're likely to still remember what you did
if Editor_state.next_save == nil thenEditor_state.next_save = App.getTime() + 3 -- short enough that you're likely to still remember what you did
Old_cursor1 = Cursor1Old_selection1 = Selection1Mousepress_shift = App.shift_down()Selection1 = {
Editor_state.old_cursor1 = Editor_state.cursor1Editor_state.old_selection1 = Editor_state.selection1Editor_state.mousepress_shift = App.shift_down()Editor_state.selection1 = {
--? print('cursor', Cursor1.line, Cursor1.pos)if Mousepress_shift thenif Old_selection1.line == nil thenSelection1 = Old_cursor1
--? print('cursor', Editor_state.cursor1.line, Editor_state.cursor1.pos)if Editor_state.mousepress_shift thenif Editor_state.old_selection1.line == nil thenEditor_state.selection1 = Editor_state.old_cursor1
Old_cursor1, Old_selection1, Mousepress_shift = nilif eq(Cursor1, Selection1) thenSelection1 = {}
Editor_state.old_cursor1, Editor_state.old_selection1, Editor_state.mousepress_shift = nilif eq(Editor_state.cursor1, Editor_state.selection1) thenEditor_state.selection1 = {}
for _,line in ipairs(Lines) do line.y = nil end -- just in case we scrollif Search_term thenSearch_term = Search_term..tSearch_text = nil
for _,line in ipairs(Editor_state.lines) do line.y = nil end -- just in case we scrollif Editor_state.search_term thenEditor_state.search_term = Editor_state.search_term..tEditor_state.search_text = nil
elseif Current_drawing_mode == 'name' thenlocal before = snapshot(Lines.current_drawing_index)local drawing = Lines.current_drawing
elseif Editor_state.current_drawing_mode == 'name' thenlocal before = snapshot(Editor_state.lines.current_drawing_index)local drawing = Editor_state.lines.current_drawing
Search_term = nilSearch_text = nilCursor1 = Search_backup.cursorScreen_top1 = Search_backup.screen_topSearch_backup = nil
Editor_state.search_term = nilEditor_state.search_text = nilEditor_state.cursor1 = Editor_state.search_backup.cursorEditor_state.screen_top1 = Editor_state.search_backup.screen_topEditor_state.search_backup = nil
local len = utf8.len(Search_term)local byte_offset = Text.offset(Search_term, len)Search_term = string.sub(Search_term, 1, byte_offset-1)Search_text = nil
local len = utf8.len(Editor_state.search_term)local byte_offset = Text.offset(Editor_state.search_term, len)Editor_state.search_term = string.sub(Editor_state.search_term, 1, byte_offset-1)Editor_state.search_text = nil
Search_term = ''Search_backup = {cursor={line=Cursor1.line, pos=Cursor1.pos}, screen_top={line=Screen_top1.line, pos=Screen_top1.pos}}assert(Search_text == nil)
Editor_state.search_term = ''Editor_state.search_backup = {cursor={line=Editor_state.cursor1.line, pos=Editor_state.cursor1.pos}, screen_top={line=Editor_state.screen_top1.line, pos=Editor_state.screen_top1.pos}}assert(Editor_state.search_text == nil)
Screen_top1 = deepcopy(src.screen_top)Cursor1 = deepcopy(src.cursor)Selection1 = deepcopy(src.selection)patch(Lines, event.after, event.before)
Editor_state.screen_top1 = deepcopy(src.screen_top)Editor_state.cursor1 = deepcopy(src.cursor)Editor_state.selection1 = deepcopy(src.selection)patch(Editor_state.lines, event.after, event.before)
Screen_top1 = deepcopy(src.screen_top)Cursor1 = deepcopy(src.cursor)Selection1 = deepcopy(src.selection)patch(Lines, event.before, event.after)
Editor_state.screen_top1 = deepcopy(src.screen_top)Editor_state.cursor1 = deepcopy(src.cursor)Editor_state.selection1 = deepcopy(src.selection)patch(Editor_state.lines, event.before, event.after)
for _,line in ipairs(Lines) do line.y = nil end -- just in case we scrolllocal s = Text.cut_selection(Margin_left, App.screen.width-Margin_right)
for _,line in ipairs(Editor_state.lines) do line.y = nil end -- just in case we scrolllocal s = Text.cut_selection(Editor_state.margin_left, App.screen.width-Editor_state.margin_right)
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
check_eq(#Lines, 2, 'F - test_draw_line/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_line/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_line/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_line/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_line/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_line/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_line/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_line/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_line/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_line/baseline/#shapes')
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'manhattan'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'manhattan'
check_eq(#Lines, 2, 'F - test_draw_horizontal_line/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_horizontal_line/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_horizontal_line/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_horizontal_line/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_horizontal_line/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_horizontal_line/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_horizontal_line/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_horizontal_line/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_horizontal_line/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_horizontal_line/baseline/#shapes')
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
check_eq(#Lines, 2, 'F - test_draw_circle/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_circle/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_circle/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_circle/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_circle/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_circle/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_circle/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_circle/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_circle/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_circle/baseline/#shapes')
App.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_release(Margin_left+35+30, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_release(Editor_state.margin_left+35+30, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
check_eq(#Lines, 2, 'F - test_cancel_stroke/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_cancel_stroke/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_cancel_stroke/baseline/y')check_eq(Lines[1].h, 128, 'F - test_cancel_stroke/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_cancel_stroke/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_cancel_stroke/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_cancel_stroke/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_cancel_stroke/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_cancel_stroke/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_cancel_stroke/baseline/#shapes')
App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
check_eq(#Lines, 2, 'F - test_draw_circle_mid_stroke/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_circle_mid_stroke/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_circle_mid_stroke/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_circle_mid_stroke/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_circle_mid_stroke/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_circle_mid_stroke/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_circle_mid_stroke/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_circle_mid_stroke/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_circle_mid_stroke/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_circle_mid_stroke/baseline/#shapes')
App.mouse_move(Margin_left+4, Margin_top+Drawing_padding_top+4) -- hover on drawingApp.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)
App.mouse_move(Editor_state.margin_left+4, Editor_state.margin_top+Editor_state.drawing_padding_top+4) -- hover on drawingApp.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)
App.run_after_mouse_release(Margin_left+35+30, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+35+30, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'circle'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'circle'
check_eq(#Lines, 2, 'F - test_draw_arc/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_arc/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_arc/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_arc/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_arc/baseline/#shapes')
check_eq(#Editor_state.lines, 2, 'F - test_draw_arc/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_arc/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_arc/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_arc/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_arc/baseline/#shapes')
App.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.mouse_move(Margin_left+35+30, Margin_top+Drawing_padding_top+36)
App.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.mouse_move(Editor_state.margin_left+35+30, Editor_state.margin_top+Editor_state.drawing_padding_top+36)
App.run_after_mouse_release(Margin_left+35+50, Margin_top+Drawing_padding_top+36+50, 1) -- 45°local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+35+50, Editor_state.margin_top+Editor_state.drawing_padding_top+36+50, 1) -- 45°local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}
check_eq(Current_drawing_mode, 'line', 'F - test_draw_polygon/baseline/drawing_mode')check_eq(#Lines, 2, 'F - test_draw_polygon/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_polygon/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_polygon/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_polygon/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_polygon/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_polygon/baseline/drawing_mode')check_eq(#Editor_state.lines, 2, 'F - test_draw_polygon/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_polygon/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_polygon/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_polygon/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_polygon/baseline/#shapes')
App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}
check_eq(Current_drawing_mode, 'line', 'F - test_draw_rectangle/baseline/drawing_mode')check_eq(#Lines, 2, 'F - test_draw_rectangle/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_rectangle/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_rectangle/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_rectangle/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_rectangle/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle/baseline/drawing_mode')check_eq(#Editor_state.lines, 2, 'F - test_draw_rectangle/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_rectangle/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_rectangle/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_rectangle/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_rectangle/baseline/#shapes')
App.run_after_mouse_release(Margin_left+15, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+15, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}
check_eq(Current_drawing_mode, 'line', 'F - test_draw_rectangle_intermediate/baseline/drawing_mode')check_eq(#Lines, 2, 'F - test_draw_rectangle_intermediate/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_rectangle_intermediate/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_rectangle_intermediate/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_rectangle_intermediate/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_rectangle_intermediate/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_rectangle_intermediate/baseline/drawing_mode')check_eq(#Editor_state.lines, 2, 'F - test_draw_rectangle_intermediate/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_rectangle_intermediate/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_rectangle_intermediate/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_rectangle_intermediate/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_rectangle_intermediate/baseline/#shapes')
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}
check_eq(Current_drawing_mode, 'line', 'F - test_draw_square/baseline/drawing_mode')check_eq(#Lines, 2, 'F - test_draw_square/baseline/#lines')check_eq(Lines[1].mode, 'drawing', 'F - test_draw_square/baseline/mode')check_eq(Lines[1].y, Margin_top+Drawing_padding_top, 'F - test_draw_square/baseline/y')check_eq(Lines[1].h, 128, 'F - test_draw_square/baseline/y')check_eq(#Lines[1].shapes, 0, 'F - test_draw_square/baseline/#shapes')
check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_draw_square/baseline/drawing_mode')check_eq(#Editor_state.lines, 2, 'F - test_draw_square/baseline/#lines')check_eq(Editor_state.lines[1].mode, 'drawing', 'F - test_draw_square/baseline/mode')check_eq(Editor_state.lines[1].y, Editor_state.margin_top+Editor_state.drawing_padding_top, 'F - test_draw_square/baseline/y')check_eq(Editor_state.lines[1].h, 128, 'F - test_draw_square/baseline/y')check_eq(#Editor_state.lines[1].shapes, 0, 'F - test_draw_square/baseline/#shapes')
App.run_after_mouse_release(Margin_left+15, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+15, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
Lines = load_from_disk(Filename)local drawing = Lines[1]local p2 = Lines[1].points[drawing.shapes[1].p2]
Editor_state.lines = load_from_disk(Editor_state.filename)local drawing = Editor_state.lines[1]local p2 = Editor_state.lines[1].points[drawing.shapes[1].p2]
App.run_after_mouse_click(Margin_left+26, Margin_top+Drawing_padding_top+44, 1)check_eq(Current_drawing_mode, 'line', 'F - test_move_point/mode:3')
App.run_after_mouse_click(Editor_state.margin_left+26, Editor_state.margin_top+Editor_state.drawing_padding_top+44, 1)check_eq(Editor_state.current_drawing_mode, 'line', 'F - test_move_point/mode:3')
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'manhattan'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'manhattan'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+46, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+46, 1)local drawing = Editor_state.lines[1]
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_release(Margin_left+55, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_release(Editor_state.margin_left+55, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_release(Margin_left+55, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_release(Editor_state.margin_left+55, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_release(Margin_left+14, Margin_top+Drawing_padding_top+16, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+14, Editor_state.margin_top+Editor_state.drawing_padding_top+16, 1)local drawing = Editor_state.lines[1]
App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_release(Margin_left+14, Margin_top+Drawing_padding_top+16, 1)local drawing = Lines[1]
App.run_after_mouse_release(Editor_state.margin_left+14, Editor_state.margin_top+Editor_state.drawing_padding_top+16, 1)local drawing = Editor_state.lines[1]
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
check_eq(#History, 3, 'F - test_undo_name_point/baseline/history:2')check_eq(Next_history, 4, 'F - test_undo_name_point/baseline/next_history')
check_eq(#Editor_state.history, 3, 'F - test_undo_name_point/baseline/history:2')check_eq(Editor_state.next_history, 4, 'F - test_undo_name_point/baseline/next_history')
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)local drawing = Editor_state.lines[1]
App.run_after_mouse_click(Margin_left+26, Margin_top+Drawing_padding_top+44, 1)check_eq(Next_history, 4, 'F - test_undo_move_point/next_history')
App.run_after_mouse_click(Editor_state.margin_left+26, Editor_state.margin_top+Editor_state.drawing_padding_top+44, 1)check_eq(Editor_state.next_history, 4, 'F - test_undo_move_point/next_history')
Filename = 'foo'App.screen.init{width=Margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsLines = load_array{'```lines', '```', ''}Current_drawing_mode = 'line'
Editor_state.filename = 'foo'App.screen.init{width=Editor_state.margin_width+256, height=300} -- drawing coordinates 1:1 with pixelsEditor_state.lines = load_array{'```lines', '```', ''}Editor_state.current_drawing_mode = 'line'
App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_press(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)App.run_after_mouse_release(Margin_left+55, Margin_top+Drawing_padding_top+26, 1)local drawing = Lines[1]
App.run_after_mouse_press(Editor_state.margin_left+5, Editor_state.margin_top+Editor_state.drawing_padding_top+6, 1)App.run_after_mouse_release(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_press(Editor_state.margin_left+35, Editor_state.margin_top+Editor_state.drawing_padding_top+36, 1)App.run_after_mouse_release(Editor_state.margin_left+55, Editor_state.margin_top+Editor_state.drawing_padding_top+26, 1)local drawing = Editor_state.lines[1]
love.graphics.rectangle('line', Margin_left,line.y, App.screen.width-Margin_width,Drawing.pixels(line.h))if icon[Current_drawing_mode] thenicon[Current_drawing_mode](App.screen.width-Margin_right-22, line.y+4)
love.graphics.rectangle('line', Editor_state.margin_left,line.y, App.screen.width-Editor_state.margin_width,Drawing.pixels(line.h))if icon[Editor_state.current_drawing_mode] thenicon[Editor_state.current_drawing_mode](App.screen.width-Editor_state.margin_right-22, line.y+4)
return y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= Margin_left and x < App.screen.width-Margin_right
return y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= Editor_state.margin_left and x < App.screen.width-Editor_state.margin_right
if Current_drawing_mode == 'freehand' thendrawing.pending = {mode=Current_drawing_mode, points={{x=Drawing.coord(x-Margin_left), y=Drawing.coord(y-drawing.y)}}}elseif Current_drawing_mode == 'line' or Current_drawing_mode == 'manhattan' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Current_drawing_mode, p1=j}elseif Current_drawing_mode == 'polygon' or Current_drawing_mode == 'rectangle' or Current_drawing_mode == 'square' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Current_drawing_mode, vertices={j}}elseif Current_drawing_mode == 'circle' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Current_drawing_mode, center=j}elseif Current_drawing_mode == 'move' then
if Editor_state.current_drawing_mode == 'freehand' thendrawing.pending = {mode=Editor_state.current_drawing_mode, points={{x=Drawing.coord(x-Editor_state.margin_left), y=Drawing.coord(y-drawing.y)}}}elseif Editor_state.current_drawing_mode == 'line' or Editor_state.current_drawing_mode == 'manhattan' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Editor_state.margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Editor_state.current_drawing_mode, p1=j}elseif Editor_state.current_drawing_mode == 'polygon' or Editor_state.current_drawing_mode == 'rectangle' or Editor_state.current_drawing_mode == 'square' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Editor_state.margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Editor_state.current_drawing_mode, vertices={j}}elseif Editor_state.current_drawing_mode == 'circle' thenlocal j = Drawing.insert_point(drawing.points, Drawing.coord(x-Editor_state.margin_left), Drawing.coord(y-drawing.y))drawing.pending = {mode=Editor_state.current_drawing_mode, center=j}elseif Editor_state.current_drawing_mode == 'move' then
table.insert(drawing.pending.points, {x=Drawing.coord(App.mouse_x()-Margin_left), y=Drawing.coord(App.mouse_y()-drawing.y)})
table.insert(drawing.pending.points, {x=Drawing.coord(App.mouse_x()-Editor_state.margin_left), y=Drawing.coord(App.mouse_y()-drawing.y)})
if Current_drawing_mode == 'move' thenCurrent_drawing_mode = Previous_drawing_modePrevious_drawing_mode = nilif Lines.current_drawing thenLines.current_drawing.pending = {}Lines.current_drawing = nil
if Editor_state.current_drawing_mode == 'move' thenEditor_state.current_drawing_mode = Editor_state.previous_drawing_modeEditor_state.previous_drawing_mode = nilif Editor_state.lines.current_drawing thenEditor_state.lines.current_drawing.pending = {}Editor_state.lines.current_drawing = nil
elseif App.mouse_down(1) and chord == 'p' and (Current_drawing_mode == 'rectangle' or Current_drawing_mode == 'square') then
elseif App.mouse_down(1) and chord == 'p' and (Editor_state.current_drawing_mode == 'rectangle' or Editor_state.current_drawing_mode == 'square') then
Current_drawing_mode = 'circle'elseif App.mouse_down(1) and chord == 'a' and Current_drawing_mode == 'circle' then
Editor_state.current_drawing_mode = 'circle'elseif App.mouse_down(1) and chord == 'a' and Editor_state.current_drawing_mode == 'circle' then
Current_drawing_mode = 'move'drawing.pending = {mode=Current_drawing_mode, target_point=p, target_point_index=i}Lines.current_drawing_index = drawing_indexLines.current_drawing = drawing
Editor_state.current_drawing_mode = 'move'drawing.pending = {mode=Editor_state.current_drawing_mode, target_point=p, target_point_index=i}Editor_state.lines.current_drawing_index = drawing_indexEditor_state.lines.current_drawing = drawing
drawing.pending = {mode=Current_drawing_mode, target_point=point_index}Lines.current_drawing_index = drawing_indexLines.current_drawing = drawing
drawing.pending = {mode=Editor_state.current_drawing_mode, target_point=point_index}Editor_state.lines.current_drawing_index = drawing_indexEditor_state.lines.current_drawing = drawing