fix a crash involving mouse and drawings
Dependencies
- [2]
656FM555bugfix: clear selection when clicking above or below lines - [3]
UHB4GARJleft/right margin -> left/right coordinates - [4]
2L5MEZV3experiment: new edit namespace - [5]
7CLGG7J2test: autosave after any shape - [6]
LF7BWEG4group all editor globals - [7]
DSLD74DKlots more tests - [8]
6XCJX4DZbugfix: inscript's bug - [9]
CNCYMM6Amake test initializations a little more obvious - [10]
ORRSP7FVdeduce test names on failures - [11]
ILOA5BYFseparate data structure for each line's cache data - [*]
LXTTOB33extract a couple of files - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
MXA3RZYKdeduce left/right from state where possible - [*]
TGHAJBESuse line cache for drawings as well - [*]
WJBZZQE4fold together two largely similar cases - [*]
KYNGDE2Cconsistent names in a few more places - [*]
5UKUADTWdistinguish consistently between mouse buttons and other buttons - [*]
K2X6G75Zstart writing some tests for drawings - [*]
FS2ITYYHrecord a known issue - [*]
IDGP4BJZnew known issue with drawings - [*]
ZTMRQZSWReadme
Change contents
- replacement in text_tests.lua at line 19
App.screen.init{width=120, height=60}App.screen.init{width=800, height=600} - edit in text.lua at line 624
assert(State.lines[loc1.line].mode == 'text') - edit in text.lua at line 638
function Text.final_text_loc_on_screen(State)if State.lines[State.screen_bottom1.line].mode == 'text' thenreturn {line=State.screen_bottom1.line,pos=Text.pos_at_end_of_screen_line(State, State.screen_bottom1),}endlocal loc2 = Text.to2(State, State.screen_bottom1)while true doif State.lines[loc2.line].mode == 'text' then break endassert(loc2.line > 1 or loc2.screen_line > 1 and loc2.screen_pos > 1) -- elsewhere we're making sure there's always at least one text line on screenloc2 = Text.previous_screen_line(State, loc2)endlocal result = Text.to1(State, loc2)result.pos = Text.pos_at_end_of_screen_line(State, result)return resultend - edit in edit.lua at line 69
---- On lines that are drawings, pos will be nil. - replacement in edit.lua at line 72
cursor1 = {line=1, pos=1}, -- position of cursorcursor1 = {line=1, pos=1}, -- position of cursor; must be on a text line - edit in edit.lua at line 190
for _,line_cache in ipairs(State.line_cache) do line_cache.starty = nil end - replacement in edit.lua at line 298
State.selection1 = {line=State.screen_bottom1.line,pos=Text.pos_at_end_of_screen_line(State, State.screen_bottom1),}State.selection1 = Text.final_text_loc_on_screen(State) - replacement in edit.lua at line 336
State.cursor1.line, State.cursor1.pos = State.screen_bottom1.line, Text.pos_at_end_of_screen_line(State, State.screen_bottom1)State.cursor1 = Text.final_text_loc_on_screen(State) - edit in edit.lua at line 599
edit.draw(State) - replacement in drawing_tests.lua at line 6
App.screen.init{width=120, height=60}App.screen.init{width=800, height=600} - edit in README.md at line 75[22.204][23.90]
* If you ever see a crash when clicking on the mouse, it might be because amouse press and release need to happen in separate frames. Try pressing andreleasing more slowly and let me know if that helps or not. This is klunky,sorry.