couple of renames

[?]
May 25, 2022, 10:20 PM
ULKLJBN6Q2EXYOXGIJLJ5NZPZD2MQSWR63Z2I3KDYJDAJQA5VNZAC

Dependencies

  • [2] DFSDPDO7 bugfix
  • [3] DXT4QTAH a few more integer coordinates
  • [4] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [5] 5Q6NIG66 bugfix
  • [6] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [7] QYIFOHW3 first test!
  • [8] IMEJA43L snapshot
  • [9] DAENUOGV eliminate assumptions that line length == size in bytes
  • [10] BULPIBEG beginnings of a module for the text editor
  • [*] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [*] BOFNXP5G clicking now moves the cursor even on long, wrapped lines

Change contents

  • replacement in text.lua at line 54
    [3.326][3.326:397]()
    Text.draw_cursor(x+Text.cursor_x2(frag, Cursor1.pos-pos+1), y)
    [3.326]
    [3.2594]
    Text.draw_cursor(x+Text.x(frag, Cursor1.pos-pos+1), y)
  • edit in text.lua at line 1047
    [12.100]
    [13.419]
    -- mx,my in pixels
  • replacement in text.lua at line 1096
    [3.383][3.383:426]()
    local max_x = Text.cursor_x(line, len+1)
    [3.383]
    [3.598]
    local max_x = 25+Text.x(line, len+1)
  • replacement in text.lua at line 1108
    [3.914][3.914:1010]()
    local currxmin = Text.cursor_x(line, curr)
    local currxmax = Text.cursor_x(line, curr+1)
    [3.914]
    [2.1624]
    local currxmin = 25+Text.x(line, curr)
    local currxmax = 25+Text.x(line, curr+1)
  • replacement in text.lua at line 1135
    [3.7300][3.7300:7344]()
    local max_x = Text.cursor_x2(line, len+1)
    [3.7300]
    [3.7344]
    local max_x = Text.x(line, len+1)
  • replacement in text.lua at line 1143
    [3.7496][3.7496:7596]()
    local currxmin = Text.cursor_x2(line, curr+1)
    local currxmax = Text.cursor_x2(line, curr+2)
    [3.7496]
    [3.7596]
    local currxmin = Text.x(line, curr+1)
    local currxmax = Text.x(line, curr+2)
  • replacement in text.lua at line 1161
    [3.7881][3.1184:1230](),[3.1184][3.1184:1230](),[3.1230][2.1692:1912](),[2.1912][3.1079:1226](),[3.1290][3.1079:1226](),[3.271][3.1433:1438](),[3.1226][3.1433:1438](),[3.1433][3.1433:1438](),[3.1438][3.3053:3092](),[3.3092][2.1913:2040](),[2.2040][3.1227:1366](),[3.3141][3.1227:1366]()
    function Text.cursor_x(line_data, cursor_pos)
    --? print(cursor_pos, #line_data, line_data)
    local cursor_offset = utf8.offset(line_data, cursor_pos)
    --? print(cursor_offset)
    assert(cursor_offset)
    local line_before_cursor = line_data:sub(1, cursor_offset-1)
    local text_before_cursor = App.newText(love.graphics.getFont(), line_before_cursor)
    return 25 + math.floor(App.width(text_before_cursor)*Zoom)
    end
    function Text.cursor_x2(s, cursor_pos)
    local cursor_offset = utf8.offset(s, cursor_pos)
    assert(cursor_offset)
    local s_before_cursor = s:sub(1, cursor_offset-1)
    local text_before_cursor = App.newText(love.graphics.getFont(), s_before_cursor)
    return math.floor(App.width(text_before_cursor)*Zoom)
    [3.7881]
    [3.3290]
    function Text.x(s, pos)
    local offset = utf8.offset(s, pos)
    assert(offset)
    local s_before = s:sub(1, offset-1)
    local text_before = App.newText(love.graphics.getFont(), s_before)
    return math.floor(App.width(text_before)*Zoom)