position cursor by clicking on text

[?]
May 17, 2022, 5:42 AM
2INHXC3KRJVZTX2BQ63ZQLHIC5SWPUG4PQKCMLC7SQKN5R7LJZ6QC

Dependencies

  • [2] 3D5RFWHV stop handling drawings in cursor_pos computations
  • [3] ZUOL7X6V move
  • [4] IYW7X3WL left/right cursor movement, deleting characters
  • [5] 3CS5KKCI up/down cursor movement
  • [6] KHFU5NFD bugfix: up/down across drawings
  • [7] XX7G2FFJ intermingle freehand line drawings with text
  • [8] OTIBCAUJ love2d scaffold
  • [9] RJGZD4IN binary search to most natural up/down with proportional fonts
  • [10] PRPPZGDY speed up some obvious common cases
  • [11] 3SYFA5JQ show cursor even on empty lines
  • [12] VVXVV2D2 change data model; text can now have metadata
  • [13] U76D4P36 fix a typo

Change contents

  • replacement in main.lua at line 163
    [4.50][4.547:695]()
    love.graphics.print('_', 25+cursor_x(line.data, cursor_pos)*1.5, y+6) -- drop the cursor down a bit to account for the increased font size
    [4.50]
    [4.411]
    love.graphics.print('_', cursor_x(line.data, cursor_pos), y+6) -- drop the cursor down a bit to account for the increased font size
  • replacement in main.lua at line 200
    [3.2][3.2:76]()
    for i,drawing in ipairs(lines) do
    if drawing.mode == 'drawing' then
    [3.2]
    [3.76]
    for i,line in ipairs(lines) do
    if line.mode == 'text' then
    -- move cursor
    if x >= 16 and y >= line.y and y < y+25 then
    cursor_line = i
    cursor_pos = nearest_cursor_pos(line.data, x, 1)
    end
    elseif line.mode == 'drawing' then
    local drawing = line
  • replacement in main.lua at line 565
    [4.581][2.1:49]()
    if lines[cursor_line].mode == 'text' then
    [4.581]
    [2.49]
    if lines[cursor_line].mode == 'text' and lines[cursor_line-1].mode == 'text' then
  • replacement in main.lua at line 575
    [4.779][2.295:343]()
    if lines[cursor_line].mode == 'text' then
    [4.779]
    [2.343]
    if lines[cursor_line].mode == 'text' and lines[cursor_line+1].mode == 'text' then
  • replacement in main.lua at line 738
    [4.739][4.739:778]()
    return text_before_cursor:getWidth()
    [4.739]
    [4.778]
    return 25+text_before_cursor:getWidth()*1.5