clicking to the right of a line within line width
[?]
Jun 29, 2022, 4:30 PM
IWYLK45KJSPRXKW55OD4GEPMLTYMMTXNFJJU26JTZN3RE35DWSCQCDependencies
- [2]
EMHRPJ3Rno, that's not right - [3]
J6WEC2D6. - [4]
5L7K4GBDclicking to the right of a wrapped line - [5]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines - [6]
4VKEE43Zbugfix - [*]
LXTTOB33extract a couple of files - [*]
BULPIBEGbeginnings of a module for the text editor - [*]
IMEJA43Lsnapshot
Change contents
- edit in text_tests.lua at line 236
endfunction test_click_past_end_of_word_wrapping_line()io.write('\ntest_click_past_end_of_word_wrapping_line')-- display a long line wrapping at a word boundary on a screen of more realistic lengthApp.screen.init{width=200, height=80}-- 0 1 2-- 123456789012345678901Lines = load_array{'the quick brown fox jumped over the lazy dog'}Line_width = 160Cursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}App.draw()local y = Margin_topApp.screen.check(y, 'the quick brown fox ', 'F - test_click_past_end_of_word_wrapping_line/baseline/screen:1')y = y + Line_height-- click past the end of the screen line but within Line_widthApp.draw()App.run_after_mouse_click(Line_width-2,y-2, 1)-- cursor moves to end of screen linecheck_eq(Cursor1.pos, 20, 'F - test_click_past_end_of_word_wrapping_line/cursor') - replacement in text.lua at line 686
if screen_line_index < #line.screen_line_starting_pos and mx > Line_width thenif screen_line_index < #line.screen_line_starting_pos and mx > Text.screen_line_width(line, screen_line_index) then - edit in text.lua at line 713[9.469][10.7085]
function Text.screen_line_width(line, i)local start_pos = line.screen_line_starting_pos[i]local start_offset = Text.offset(line.data, start_pos)local screen_lineif i < #line.screen_line_starting_pos thenlocal past_end_pos = line.screen_line_starting_pos[i+1]local past_end_offset = Text.offset(line.data, past_end_pos)screen_line = string.sub(line.data, start_offset, past_end_offset-1)elsescreen_line = string.sub(line.data, start_pos)endlocal screen_line_text = App.newText(love.graphics.getFont(), screen_line)return App.width(screen_line_text)end