Merge text.love
[?]
Feb 1, 2023, 6:54 AM
STYH5IVGE35RY6XXPD3J5SUCYYNQLPUHEOELSDQ4ZZHMO7GPUKMQCDependencies
- [2]
ECBDENZ4Merge text.love - [3]
B4FAIVRAMerge lines.love - [4]
RSZD5A7Gforgot to add json.lua - [5]
OTIBCAUJlove2d scaffold - [6]
ORKN6EOBMerge lines.love - [7]
JOPVPUSAediting source code from within the app - [8]
AVTNUQYRbasic test-enabled framework - [9]
HOUCPP7PMerge text.love - [10]
K74U4BAUMerge lines.love - [11]
UTDSCN3GMerge lines.love - [12]
VHUNJHXBMerge lines.love - [13]
R5QXEHUIsomebody stop me - [14]
KG7YVGVRMerge lines.love - [15]
UAYCSFSKMerge text.love - [16]
2L5MEZV3experiment: new edit namespace - [17]
W5H5YI6SMerge text.love - [18]
73OCE2MCafter much struggle, a brute-force undo - [19]
3PSFWAILMerge lines.love - [20]
TVCPXAAUrename - [21]
BULPIBEGbeginnings of a module for the text editor - [22]
VSJS6O4CMerge text.love - [23]
4YDBYBA4clean up memory leak experiments - [24]
VHQCNMARseveral more modules - [25]
T4FRZSYLdelete an ancient, unused file - [26]
66X36NZNa little more prose describing manual_tests - [27]
6LJZN727handle chords - [28]
BLWAYPKVextract a module - [29]
VXORMHMEdelete experimental REPL - [30]
KKMFQDR4editing source code from within the app - [31]
KMSL74GAsupport selections in the source editor - [32]
ETXNVRPTMerge lines.love - [33]
XX7G2FFJintermingle freehand line drawings with text - [34]
GUOQRUL7Merge lines.love - [35]
2CTN2IEFMerge lines.love - [36]
3QNOKBFMbeginnings of a test harness - [37]
FS2ITYYHrecord a known issue - [38]
OGUV4HSAremove some memory leaks from rendered fragments - [39]
CE4LZV4Tdrop last couple of manual tests - [40]
36Z442IVback to commit 8123959e52f without code editing - [41]
LXTTOB33extract a couple of files - [42]
VP5KC4XZMerge lines.love - [43]
C3GUE45IMerge text.love - [44]
ZTZOO2OQMerge lines.love - [45]
EX43CDDIMerge text.love - [46]
A4BSGS2CMerge lines.love - [47]
K2X6G75Zstart writing some tests for drawings - [48]
DB7HJBHJMerge lines.love - [49]
D2GCFTTTclean up repl functionality - [50]
MD3W5IRAnew fork: rip out drawing support - [51]
BJ5X5O4Alet's prevent the text cursor from ever getting on a drawing - [52]
TLOAPLBJadd a license
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