bugfix

[?]
Jun 14, 2022, 12:23 AM
4VKEE43Z7MUPNIAOCK36INVBNHRTSWRRN37TIKRPXPH3DRKGHHAQC

Dependencies

  • [2] U52E2XZN fix a crash
  • [3] MHOUX5JF experiment: turn off JIT
  • [4] J2SVGR2E experiment: blinking cursor
  • [5] RMKMPFT5 fix a corner case when selecting text
  • [6] GCEF4N3V stop repeatedly checking for line wrapping
  • [7] R53OF3ON one bug I've repeatedly run into while testing with Moby Dick
  • [8] CVGE3SIG I feel confident now that page-down is working.
  • [9] 5FW7YOFT highlight selection while dragging
  • [10] BULPIBEG beginnings of a module for the text editor
  • [11] 5L7K4GBD clicking to the right of a wrapped line
  • [12] XOAHJ6M3 similar tests for cursor up
  • [13] HOSPP2AN crisp font rendering
  • [14] U7M4M2F7 bugfix: don't rely on Screen_bottom1 while scrolling
  • [15] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [16] 3TFEAQSW start using some globals
  • [17] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [18] BOFNXP5G clicking now moves the cursor even on long, wrapped lines
  • [*] LXTTOB33 extract a couple of files
  • [*] GN3IF4WF bugfix: pasting newlines
  • [*] OTIBCAUJ love2d scaffold
  • [*] 73OCE2MC after much struggle, a brute-force undo
  • [*] AJB4LFRB try to maintain a reasonable line width
  • [*] R6GUSTBY default font size and line-height
  • [*] NEXUNNCF extract a function
  • [*] Z4XRNDTR find text
  • [*] QZH3PQFU .

Change contents

  • edit in text_tests.lua at line 130
    [20.2457]
    [20.2457]
    function test_click_on_wrapping_line_containing_non_ascii()
    io.write('\ntest_click_on_wrapping_line_containing_non_ascii')
    -- display a wrapping line containing non-ASCII
    App.screen.init{width=80, height=80}
    -- 12345678901234
    Lines = load_array{'madam I’m adam'} -- notice the non-ASCII apostrophe
    Line_width = 75
    Cursor1 = {line=1, pos=1}
    Screen_top1 = {line=1, pos=1}
    Screen_bottom1 = {}
    App.draw()
    local y = Margin_top
    App.screen.check(y, 'madam ', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:1')
    y = y + Line_height
    App.screen.check(y, 'I’m ada', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:2')
    y = y + Line_height
    App.screen.check(y, 'm', 'F - test_click_on_wrapping_line_containing_non_ascii/baseline/screen:3')
    y = y + Line_height
    -- click past the end of it
    App.draw()
    App.run_after_mouse_click(App.screen.width-2,y-2, '1')
    -- cursor moves to end of line
    check_eq(Cursor1.pos, 15, 'F - test_click_on_wrapping_line_containing_non_ascii/cursor') -- one more than the number of UTF-8 code-points
    end
  • replacement in text.lua at line 15
    [7.50][7.1:26]()
    --? print('text.draw')
    [7.50]
    [7.109]
    --? print('text.draw', line_index)
  • edit in text.lua at line 383
    [21.296]
    [21.296]
    --? print(Cursor1.line, Cursor1.pos, #Lines[Cursor1.line].data)
    --? print(Lines[Cursor1.line].data)
    assert(byte_offset)
  • edit in text.lua at line 684
    [7.1193]
    [2.3]
    --? print('Text.to_pos_on_line', mx, my, 'width', Line_width)
  • edit in text.lua at line 692
    [7.133]
    [7.3874]
    --? print('iter', y, screen_line_index, screen_line_starting_pos, string.sub(line.data, screen_line_starting_pos))
  • edit in text.lua at line 699
    [7.437]
    [7.1245]
    --? print('past end of non-final line; return')
  • replacement in text.lua at line 702
    [7.538][7.1121:1185](),[7.1121][7.1121:1185]()
    local s = string.sub(line.data, screen_line_starting_pos)
    [7.538]
    [7.1312]
    local screen_line_starting_byte_offset = utf8.offset(line.data, screen_line_starting_pos)
    assert(screen_line_starting_byte_offset)
    local s = string.sub(line.data, screen_line_starting_byte_offset)
    --? print('return', mx, Text.nearest_cursor_pos(s, mx), '=>', screen_line_starting_pos + Text.nearest_cursor_pos(s, mx) - 1)
  • edit in text.lua at line 884
    [7.2480][7.2480:2503]()
    --? print(x, frag)
  • edit in text.lua at line 886
    [7.3986]
    [7.2587]
    --? print(x, pos, frag, frag_width)
  • edit in text.lua at line 889
    [7.2640][6.130:194]()
    --? print(' ', #line.screen_line_starting_pos, line.data)
  • edit in text.lua at line 890
    [6.249]
    [7.2818]
    --? print('new screen line:', #line.screen_line_starting_pos, pos)
  • edit in main.lua at line 88
    [4.240]
    [23.8163]
    Quit = false
  • edit in main.lua at line 106
    [24.39]
    [25.126]
    --? Line_width = 80
  • edit in main.lua at line 128
    [3.73]
    [26.40]
    Quit = true
  • edit in main.lua at line 266
    [27.2875]
    [22.416]
    --? if Quit then os.exit(1) end
  • edit in main.lua at line 329
    [28.157]
    [5.2423]
    --? print(Cursor1.line, Cursor1.pos)