fix a regression in line wrapping
[?]
May 28, 2022, 4:02 PM
R5OKMVVCPAKL2IUMIY7A7ZMTJQZS6UWKW4EVLAVCPLPVNI5DCEYQCDependencies
- [2]
AD34IX2Zcouple more tests - [3]
QYIFOHW3first test! - [4]
IMEJA43Lsnapshot - [5]
PFT5Y2ZYmove - [*]
BULPIBEGbeginnings of a module for the text editor
Change contents
- edit in text.lua at line 118
function test_draw_word_wrapping_text()io.write('\ntest_draw_word_wrapping_text')App.screen.init{width=60, height=60}Lines = load_array{'abc def ghi', 'jkl'}Line_width = App.screen.widthCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1App.draw()local screen_top_margin = 15 -- pixelslocal line_height = 15 -- pixelslocal y = screen_top_marginApp.screen.check(y, 'abc ', 'F - test_draw_word_wrapping_text/screen:1')y = y + line_heightApp.screen.check(y, 'def ', 'F - test_draw_word_wrapping_text/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_draw_word_wrapping_text/screen:3')endfunction test_draw_text_wrapping_within_word()-- arrange a screen line that needs to be split within a wordio.write('\ntest_draw_text_wrapping_within_word')App.screen.init{width=60, height=60}Lines = load_array{'abcd e fghijk', 'xyz'}Line_width = App.screen.widthCursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1App.draw()local screen_top_margin = 15 -- pixelslocal line_height = 15 -- pixelslocal y = screen_top_marginApp.screen.check(y, 'abcd ', 'F - test_draw_text_wrapping_within_word/screen:1')y = y + line_heightApp.screen.check(y, 'e fghi', 'F - test_draw_text_wrapping_within_word/screen:2')y = y + line_heightApp.screen.check(y, 'jk', 'F - test_draw_text_wrapping_within_word/screen:3')end - edit in text.lua at line 784
assert(25 + frag_width > line_width) -- avoid infinite loop when window is too narrow - edit in text.lua at line 785
--? print(x, frag, frag_width, line_width) - edit in text.lua at line 791
assert(b > 0) -- avoid infinite loop when window is too narrow - edit in text.lua at line 811
x = x + frag_width