Merge lines.love
[?]
Feb 1, 2023, 6:47 AM
B4FAIVRAXKCS2ZZXYUHL7HHWVMDMG2MQ3BY6IOJARK7B5XTBAQNACDependencies
- [2]
A4BSGS2CMerge lines.love - [3]
SWZAQHGRbugfix: up arrow when line above is a drawing - [4]
T4FRZSYLdelete an ancient, unused file - [5]
K2X6G75Zstart writing some tests for drawings - [6]
RSZD5A7Gforgot to add json.lua - [7]
TLOAPLBJadd a license - [8]
D2GCFTTTclean up repl functionality - [9]
ZPUQSPQPextract a few methods - [10]
TACI4LU6Merge lines.love - [11]
CE4LZV4Tdrop last couple of manual tests - [12]
DB7HJBHJMerge lines.love - [13]
K74U4BAUMerge lines.love - [14]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [15]
VXORMHMEdelete experimental REPL - [16]
BLWAYPKVextract a module - [17]
OGUV4HSAremove some memory leaks from rendered fragments - [18]
3QNOKBFMbeginnings of a test harness - [19]
4YDBYBA4clean up memory leak experiments - [20]
66X36NZNa little more prose describing manual_tests - [21]
OTIBCAUJlove2d scaffold - [22]
JOPVPUSAediting source code from within the app - [23]
MUJTM6REbring back a level of wrapping - [24]
XX7G2FFJintermingle freehand line drawings with text - [25]
LXTTOB33extract a couple of files - [26]
VHQCNMARseveral more modules - [27]
SVJZZDC3snapshot - no, that's all wrong - [28]
3PSFWAILMerge lines.love - [29]
MD3W5IRAnew fork: rip out drawing support - [30]
ORKN6EOBMerge lines.love - [31]
2CTN2IEFMerge lines.love - [32]
6LJZN727handle chords - [33]
73OCE2MCafter much struggle, a brute-force undo - [34]
AVTNUQYRbasic test-enabled framework - [35]
2L5MEZV3experiment: new edit namespace - [36]
BULPIBEGbeginnings of a module for the text editor - [37]
LF7BWEG4group all editor globals - [38]
FS2ITYYHrecord a known issue - [39]
ODLKHO7Bswitch to line index in a function - [40]
TVCPXAAUrename - [41]
OI4FPFINsupport drawings in the source editor - [42]
KKMFQDR4editing source code from within the app - [43]
Z5HLXU4Padd state arg to a few functions - [44]
VHUNJHXBMerge lines.love - [45]
GUOQRUL7Merge lines.love - [46]
KMSL74GAsupport selections in the source editor - [47]
ETXNVRPTMerge lines.love - [48]
VP5KC4XZMerge lines.love - [49]
KG7YVGVRMerge lines.love - [50]
UTDSCN3GMerge lines.love - [51]
ZTZOO2OQMerge lines.love - [52]
ORRSP7FVdeduce test names on failures - [53]
R5QXEHUIsomebody stop me - [*]
PLKNHYZ4extract a function
Change contents
- file deletion: source_text_tests.lua source_text_tests.lua
function test_up_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'cursor')endfunction test_up_arrow_scrolls_up_by_one_line()endfunction test_down_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'down')check_eq(Editor_state.cursor1.line, 3, 'cursor')endfunction test_down_arrow_scrolls_down_by_one_line() - file deletion: source_text.lua source_text.lua
State.cursor1 = {line=new_cursor_line, posB=nil}Text.populate_screen_line_starting_pos(State, State.cursor1.line)local prev_line_cache = State.line_cache[State.cursor1.line]local prev_screen_line_starting_pos = prev_line_cache.screen_line_starting_pos[#prev_line_cache.screen_line_starting_pos]local prev_screen_line_starting_byte_offset = Text.offset(State.lines[State.cursor1.line].data, prev_screen_line_starting_pos)local s = string.sub(State.lines[State.cursor1.line].data, prev_screen_line_starting_byte_offset)State.cursor1.pos = prev_screen_line_starting_pos + Text.nearest_cursor_pos(s, State.cursor_x, State.left) - 1breakendState.cursor1 = {line=new_cursor_line, pos=nil}Text.populate_screen_line_starting_pos(State, State.cursor1.line)-- previous text line found, pick its final screen line--? print('has multiple screen lines')local screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos--? print(#screen_line_starting_pos)screen_line_starting_pos = screen_line_starting_pos[#screen_line_starting_pos]local screen_line_starting_byte_offset = Text.offset(State.lines[State.cursor1.line].data, screen_line_starting_pos)local s = string.sub(State.lines[State.cursor1.line].data, screen_line_starting_byte_offset)State.cursor1.pos = screen_line_starting_pos + Text.nearest_cursor_pos(s, State.cursor_x, State.left) - 1breakend - edit in text_tests.lua at line 1001
endfunction test_down_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'down')check_eq(Editor_state.cursor1.line, 3, 'cursor') - edit in text_tests.lua at line 1151
function test_up_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'cursor')end - replacement in text.lua at line 413
State.cursor1.line = new_cursor_lineState.cursor1 = {line=new_cursor_line, pos=nil} - edit in text.lua at line 952
State.cursor1 = {line=new_cursor_line, pos=nil} - resolve order conflict in text.lua at line 952[55.442]
- edit in source_text_tests.lua at line 1026
endfunction test_down_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=1, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the down arrow the cursor moves down by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'down')check_eq(Editor_state.cursor1.line, 3, 'cursor') - edit in source_text_tests.lua at line 1201
function test_up_arrow_skips_drawing()-- some lines of text with a drawing intermixedlocal drawing_width = 50App.screen.init{width=Editor_state.left+drawing_width, height=100}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc', -- height 15'```lines', '```', -- height 25'ghi'}Text.redraw_all(Editor_state)Editor_state.cursor1 = {line=3, pos=1}Editor_state.screen_top1 = {line=1, pos=1}Editor_state.screen_bottom1 = {}edit.draw(Editor_state)local y = Editor_state.topApp.screen.check(y, 'abc', 'baseline/screen:1')y = y + Editor_state.line_heightlocal drawing_height = Drawing_padding_height + drawing_width/2 -- defaulty = y + drawing_heightApp.screen.check(y, 'ghi', 'baseline/screen:3')check(Editor_state.cursor_x, 'baseline/cursor_x')-- after hitting the up arrow the cursor moves up by 2 lines, skipping the drawingedit.run_after_keychord(Editor_state, 'up')check_eq(Editor_state.cursor1.line, 1, 'cursor')end - replacement in source_text.lua at line 683
State.cursor1 = {line=State.cursor1.line-1, pos=nil}State.cursor1 = {line=new_cursor_line, pos=nil} - replacement in source_text.lua at line 722
State.cursor1 = {line=State.cursor1.line-1, posB=nil}State.cursor1 = {line=new_cursor_line, posB=nil}