keep text from overflowing right margin
[?]
Jul 19, 2022, 11:49 PM
GL4Q5WCVMOBEKW7SMBKRSL3DRG2NSTXRI7VQFK77OXAWLBDKWTNQCDependencies
- [2]
UHB4GARJleft/right margin -> left/right coordinates - [3]
CUIV2LE5some typos - [4]
IWYLK45Kclicking to the right of a line within line width - [5]
MYC7XR5Qbugfix: lines that aren't drawn from the start - [6]
4VKEE43Zbugfix - [7]
LF7BWEG4group all editor globals - [8]
APYPFFS3call edit rather than App callbacks in tests - [9]
5Q6NIG66bugfix - [10]
VG75U7IMbugfix: typing should delete highlighted text - [11]
M6TH7VSZrip out notion of Line_width - [12]
CNCYMM6Amake test initializations a little more obvious - [13]
ULKLJBN6couple of renames - [14]
LXTTOB33extract a couple of files - [15]
DGK5BPVIbugfix: UTF-8 in compute_fragments - [16]
IMEJA43Lsnapshot - [17]
HTWAM4NZbugfix: scrolling in left/right movements - [18]
NZKYPBSKcheck for scroll when just typing - [19]
DRFE3B3Zmouse buttons are integers, not strings - [20]
GJLOKCYKbugfix: clicking past end of screen line - [21]
2JLVAYHBstart decoupling editor tests from App - [22]
LNUHQOGHstart passing in Editor_state explicitly - [23]
LAW2O3NWextract variable Margin_left - [24]
BULPIBEGbeginnings of a module for the text editor
Change contents
- replacement in text_tests.lua at line 341
App.screen.check(y, 'def', 'F - test_draw_wrapping_text/screen:2')App.screen.check(y, 'de', 'F - test_draw_wrapping_text/screen:2') - replacement in text_tests.lua at line 343
App.screen.check(y, 'gh', 'F - test_draw_wrapping_text/screen:3')App.screen.check(y, 'fgh', 'F - test_draw_wrapping_text/screen:3') - replacement in text_tests.lua at line 417
App.screen.check(y, 'e fghi', 'F - test_draw_text_wrapping_within_word/screen:2')App.screen.check(y, 'e fgh', 'F - test_draw_text_wrapping_within_word/screen:2') - replacement in text_tests.lua at line 419
App.screen.check(y, 'jk', 'F - test_draw_text_wrapping_within_word/screen:3')App.screen.check(y, 'ijk', 'F - test_draw_text_wrapping_within_word/screen:3') - replacement in text_tests.lua at line 434
App.screen.check(y, 'mada', 'F - test_draw_wrapping_text_containing_non_ascii/screen:1')App.screen.check(y, 'mad', 'F - test_draw_wrapping_text_containing_non_ascii/screen:1') - replacement in text_tests.lua at line 436
App.screen.check(y, 'm I’', 'F - test_draw_wrapping_text_containing_non_ascii/screen:2')App.screen.check(y, 'am ', 'F - test_draw_wrapping_text_containing_non_ascii/screen:2') - replacement in text_tests.lua at line 438
App.screen.check(y, 'm ad', 'F - test_draw_wrapping_text_containing_non_ascii/screen:3')App.screen.check(y, 'I’m ', 'F - test_draw_wrapping_text_containing_non_ascii/screen:3') - replacement in text_tests.lua at line 456
App.screen.check(y, "I'm ada", 'F - test_click_on_wrapping_line/baseline/screen:2')App.screen.check(y, "I'm ad", 'F - test_click_on_wrapping_line/baseline/screen:2') - replacement in text_tests.lua at line 462
check_eq(Editor_state.cursor1.pos, 13, 'F - test_click_on_wrapping_line/cursor:pos')check_eq(Editor_state.cursor1.pos, 12, 'F - test_click_on_wrapping_line/cursor:pos') - replacement in text_tests.lua at line 478
App.screen.check(y, "I'm ada", 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/baseline/screen:2')App.screen.check(y, "I'm ad", 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/baseline/screen:2') - replacement in text_tests.lua at line 484
check_eq(Editor_state.cursor1.pos, 13, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:pos')check_eq(Editor_state.cursor1.pos, 12, 'F - test_click_on_wrapping_line_rendered_from_partway_at_top_of_screen/cursor:pos') - replacement in text_tests.lua at line 502
App.screen.check(y, "I'm ada", 'F - test_click_past_end_of_wrapping_line/baseline/screen:2')App.screen.check(y, "I'm ad", 'F - test_click_past_end_of_wrapping_line/baseline/screen:2') - replacement in text_tests.lua at line 504
App.screen.check(y, 'm', 'F - test_click_past_end_of_wrapping_line/baseline/screen:3')App.screen.check(y, 'am', 'F - test_click_past_end_of_wrapping_line/baseline/screen:3') - replacement in text_tests.lua at line 512
function test_click_on_wrapping_line_containing_non_ascii()io.write('\ntest_click_on_wrapping_line_containing_non_ascii')function test_click_past_end_of_wrapping_line_containing_non_ascii()io.write('\ntest_click_past_end_of_wrapping_line_containing_non_ascii') - replacement in text_tests.lua at line 525
App.screen.check(y, 'madam ', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:1')App.screen.check(y, 'madam ', 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/baseline/screen:1') - replacement in text_tests.lua at line 527
App.screen.check(y, 'I’m ada', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:2')App.screen.check(y, 'I’m ad', 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/baseline/screen:2') - replacement in text_tests.lua at line 529
App.screen.check(y, 'm', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:3')App.screen.check(y, 'am', 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/baseline/screen:3') - replacement in text_tests.lua at line 534
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-pointscheck_eq(Editor_state.cursor1.pos, 15, 'F - test_click_past_end_of_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points - edit in text_tests.lua at line 738
edit.run_after_textinput(Editor_state, 'h')edit.run_after_textinput(Editor_state, 'i')edit.run_after_textinput(Editor_state, 'j') - replacement in text_tests.lua at line 741
App.screen.check(y, 'def', 'F - test_edit_wrapping_text/screen:2')App.screen.check(y, 'de', 'F - test_edit_wrapping_text/screen:2') - replacement in text_tests.lua at line 743
App.screen.check(y, 'ghij', 'F - test_edit_wrapping_text/screen:3')App.screen.check(y, 'fg', 'F - test_edit_wrapping_text/screen:3') - replacement in text_tests.lua at line 1158
App.screen.check(y, 'ghijk', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/baseline/screen:3')App.screen.check(y, 'ghij', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/baseline/screen:3') - replacement in text_tests.lua at line 1163
check_eq(Editor_state.cursor1.pos, 6, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:pos')check_eq(Editor_state.cursor1.pos, 5, 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/cursor:pos') - replacement in text_tests.lua at line 1167
App.screen.check(y, 'ghijk', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen:2')App.screen.check(y, 'ghij', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen:2') - replacement in text_tests.lua at line 1169
App.screen.check(y, 'l', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen:3')App.screen.check(y, 'kl', 'F - test_down_arrow_scrolls_down_by_one_screen_line_after_splitting_within_word/screen:3') - replacement in text_tests.lua at line 1187
App.screen.check(y, 'ghijk', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline/screen:3')App.screen.check(y, 'ghij', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/baseline/screen:3') - replacement in text_tests.lua at line 1197
check_eq(Editor_state.cursor1.pos, 6, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:pos')check_eq(Editor_state.cursor1.pos, 5, 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/cursor:pos') - replacement in text_tests.lua at line 1199
App.screen.check(y, 'ghijk', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen:1')App.screen.check(y, 'ghij', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen:1') - replacement in text_tests.lua at line 1201
App.screen.check(y, 'l', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen:2')App.screen.check(y, 'kl', 'F - test_page_down_followed_by_down_arrow_does_not_scroll_screen_up/screen:2') - replacement in text_tests.lua at line 1538
App.screen.check(y, 'ghijk', 'F - test_typing_on_bottom_line_scrolls_down/screen:2')App.screen.check(y, 'ghij', 'F - test_typing_on_bottom_line_scrolls_down/screen:2') - replacement in text_tests.lua at line 1540
App.screen.check(y, 'l', 'F - test_typing_on_bottom_line_scrolls_down/screen:3')App.screen.check(y, 'kl', 'F - test_typing_on_bottom_line_scrolls_down/screen:3') - replacement in text_tests.lua at line 1747
App.screen.check(y, 'ghijk', 'F - test_backspace_can_scroll_up_screen_line/screen:1')App.screen.check(y, 'ghij', 'F - test_backspace_can_scroll_up_screen_line/screen:1') - replacement in text_tests.lua at line 1749
App.screen.check(y, 'l', 'F - test_backspace_can_scroll_up_screen_line/screen:2')App.screen.check(y, 'kl', 'F - test_backspace_can_scroll_up_screen_line/screen:2') - replacement in text.lua at line 810
function Text.nearest_pos_less_than(line, x) -- x DOES NOT include left margin-- return the nearest index of line (in utf8 code points) which lies entirely-- within x pixels of the left marginfunction Text.nearest_pos_less_than(line, x)--? print('-- nearest_pos_less_than', line, x) - replacement in text.lua at line 818
local max_x = Text.x(line, len+1)local max_x = Text.x_after(line, len) - edit in text.lua at line 823
--? print('--') - replacement in text.lua at line 825
local currxmin = Text.x(line, curr+1)local currxmax = Text.x(line, curr+2)local currxmin = Text.x_after(line, curr+1)local currxmax = Text.x_after(line, curr+2) - edit in text.lua at line 841
endfunction Text.x_after(s, pos)local offset = Text.offset(s, math.min(pos+1, #s+1))local s_before = s:sub(1, offset-1)--? print('^'..s_before..'$')local text_before = App.newText(love.graphics.getFont(), s_before)return App.width(text_before)