It's a hack:
GNKUD23IHHTLV6COIR4LBK36GPN2FPBGSXHOSJHRW5KKEA2ENWUAC MRA2Y3EEDV73ZFMWL3EBUXAWZYQSDK4E5FWISWHHJZ2YXTYYYTBAC 7RKFA3VAGK73SLC3NCOKHVMOWLTC4EUQYS47P3LVVKDVLBVGBEHAC LXTTOB33N2HCUZFIUDRQGGBVHK2HODRG4NBLH6RXRQZDCHF27BSAC 3TCZ7ADHZ4YALUYII4QRSITV2VUKN645P7D7XTXD7ASFZTAP7THAC 356GY7IQ467QQMIPFMEETHTXLSZE65HA36PXSOW4KKXBUHSMBQTAC VSBSWTE4IVQDRXLPQ7VTDIIEBEF7GMGRBHZ2IA73ZR6B2KZWI5JAC ZLJGZYQGQ2S4UFWTVF4PQDSGMP6A4IS4GDHCMBAAA5SK2N2NWR3QC WAR3HXHTN7JZVV6TFMU2F3QYAG6NDH7DN7KKPTM2ICEHRNQYP6PAC RMKMPFT5L67WIFWIO4GTC6XESX6UPKNL4GPNQLOBC5CXSUZABEHQC ORRSP7FVCHI2TF5GXBRGQYYJAA3JFYXZBM3T663BKSBV22FCZVCAC LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC MXA3RZYKUI4UF2ISY7JEF6VKX6NOPZMZH5SLLCZHRJKFIXXXDPSAC 7FPELAZBPC6545IA75OOVI5CJUKCV5OLBHVMWM3KMSKTZO6SOWNAC S2MISTTMPEULTO6WRO4Q4NRUO7XC2PTZW3UBR7K7SO6JPZO6HBHAC 4CXVIEBSQ5X62UYNJNSNMYKP24GE4IPO77T5ZWQW24QIK2BUQGWAC JFFUF5ALUWPDM7IEDEZVAYG2SVXO334STONRGKVB3QKY2TT5QGBQC 2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC function test_select_all_text_then_mouse_press_outside_text()-- display a single line of textApp.screen.init{width=75, height=80}Editor_state = edit.initialize_test_state()Editor_state.lines = load_array{'abc def'}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)-- select allApp.fake_key_press('lctrl')edit.run_after_keychord(Editor_state, 'C-a')App.fake_key_release('lctrl')edit.key_release(Editor_state, 'lctrl')-- selectioncheck_eq(Editor_state.selection1.line, 1, 'selection:line')check_eq(Editor_state.selection1.pos, 1, 'selection:pos')check_eq(Editor_state.cursor1.line, 1, 'cursor:line')check_eq(Editor_state.cursor1.pos, 8, 'cursor:pos')-- part of a mouse click outside the selected lineedit.run_after_mouse_press(Editor_state, 45, Margin_top + Editor_state.line_height + 10, --[[mouse button]] 1)end
--? function test_select_all_text_then_mouse_press_outside_text()--? -- display a single line of text--? App.screen.init{width=75, height=80}--? Editor_state = edit.initialize_test_state()--? Editor_state.lines = load_array{'abc def'}--? 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)--? -- select all--? App.fake_key_press('lctrl')--? edit.run_after_keychord(Editor_state, 'C-a')--? App.fake_key_release('lctrl')--? edit.key_release(Editor_state, 'lctrl')--? -- selection--? check_eq(Editor_state.selection1.line, 1, 'selection:line')--? check_eq(Editor_state.selection1.pos, 1, 'selection:pos')--? check_eq(Editor_state.cursor1.line, 1, 'cursor:line')--? check_eq(Editor_state.cursor1.pos, 8, 'cursor:pos')--? -- part of a mouse click outside the selected line--? edit.run_after_mouse_press(Editor_state, 45, Margin_top + Editor_state.line_height + 10, --[[mouse button]] 1)--? end
if State.recent_mouse.time and State.recent_mouse.time > Current_time-0.1 thenprint_and_log(('text.mouse_pos: returning recent value %d,%d'):format(State.recent_mouse.line, State.recent_mouse.pos))return State.recent_mouse.line, State.recent_mouse.posendState.recent_mouse.time = Current_time
if line thenState.recent_mouse.line = lineState.recent_mouse.pos = posendreturn State.recent_mouse.line, State.recent_mouse.pos
return line, pos