snapshot - no, that's all wrong

[?]
May 20, 2022, 11:41 PM
SVJZZDC3K6AKAXHGRNAZKRE2ZXEKJANNLG7LSSUZJARFBL5F7C4AC

Dependencies

  • [2] RCDVDFJQ comment
  • [3] C42QQZSF another piece of support for line wrapping in cursor up
  • [4] H2DPLWMV snapshot: wrapping long lines at word boundaries
  • [5] MGT5FTJ3 first stab at supporting wrapping in cursor up
  • [6] 5ED3YGHW planning out cursor up/down over wrapped lines
  • [7] 2FBLO5FH adjust window size
  • [8] A2QPFRFJ move
  • [9] OIB2QPRC start remembering where the cursor is drawn in px
  • [10] 2KRK3OBV don't rely on defaults
  • [11] AVQ5MC5D finish uppercasing all globals
  • [12] YKRF5V3Z starting to load/save
  • [13] DLQMM265 scroll past first page
  • [14] LUNH47XX make text and drawings the same width
  • [15] W4UVZETR 2 regressions:
  • [16] OTIBCAUJ love2d scaffold
  • [17] WLHI7KD3 new globals: draw partial screen line up top
  • [18] MGOQ5XAV start uppercasing globals
  • [19] IYW7X3WL left/right cursor movement, deleting characters
  • [20] 2C7CTIQY make space for multiple kinds of width
  • [21] JCSLDGAH beginnings of support for multiple shapes
  • [22] M36DBSDE bit more polish to help screen
  • [23] XNFTJHC4 split keyboard handling between Text and Drawing
  • [24] PWHZPJJM always show current filename in window title
  • [25] FEEGTRGQ bugfix: duplicate character on enter
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] HYEAFRZ2 split mouse_pressed events between Text and Drawing
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • replacement in text.lua at line 222
    [4.4030][4.83:129]()
    if Top_screen_line_starting_pos == 1 then
    [4.4030]
    [4.129]
    local screen_line_index,screen_line_starting_pos = Text.pos_at_start_of_cursor_screen_line()
    if screen_line_starting_pos == 1 then
    print('cursor is at first screen line of its line')
  • replacement in text.lua at line 238
    [3.359][3.359:425]()
    Top_screen_line_starting_pos = screen_line_starting_pos
    [3.359]
    [3.425]
    print('previous screen line starts at '..tostring(screen_line_starting_pos)..' of its line')
    if Screen_top_line == Cursor_line and Top_screen_line_starting_pos == screen_line_starting_pos then
    Top_screen_line_starting_pos = screen_line_starting_pos
    end
  • replacement in text.lua at line 252
    [4.742][4.742:860]()
    local screen_line_index = table.find(Lines[Cursor_line].screen_line_starting_pos, Top_screen_line_starting_pos)
    [4.742]
    [4.860]
    print('cursor is NOT at first screen line of its line')
  • replacement in text.lua at line 254
    [4.896][4.896:1136]()
    Top_screen_line_starting_pos = Lines[Cursor_line].screen_line_starting_pos[screen_line_index-1]
    local s = string.sub(Lines[Cursor_line].data, Top_screen_line_starting_pos)
    Cursor_pos = Text.nearest_cursor_pos(s, Cursor_x)
    [4.896]
    [4.268]
    new_screen_line_starting_pos = Lines[Cursor_line].screen_line_starting_pos[screen_line_index-1]
    print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos))
    if Screen_top_line == Cursor_line and Top_screen_line_starting_pos == screen_line_starting_pos then
    Top_screen_line_starting_pos = new_screen_line_starting_pos
    print('also setting pos of top of screen to '..tostring(Top_screen_line_starting_pos))
    end
    local s = string.sub(Lines[Cursor_line].data, new_screen_line_starting_pos)
    Cursor_pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, Cursor_x) - 1
    print('cursor pos is now '..tostring(Cursor_pos))
  • edit in text.lua at line 279
    [4.366]
    [4.4909]
    end
    end
    end
    function Text.pos_at_start_of_cursor_screen_line()
    if Lines[Cursor_line].screen_line_starting_pos == nil then
    return 1,1
    end
    for i=#Lines[Cursor_line].screen_line_starting_pos,1,-1 do
    local spos = Lines[Cursor_line].screen_line_starting_pos[i]
    if spos <= Cursor_pos then
    return i,spos
  • edit in text.lua at line 293
    [27.464]
    [28.1]
    assert(false)
  • replacement in manual_tests at line 25
    [4.1441][4.1441:1511]()
    if top line wrapped before, it scrolls up by only one screen line
    [4.1441]
    [3.597]
    if cursor line wrapped before, it scrolls up by only one screen line
  • replacement in manual_tests at line 28
    [4.1613][4.1613:1685]()
    if top line wrapped before, it scrolls down by only one screen line
    [4.1613]
    if cursor line wrapped before, it scrolls down by only one screen line
  • replacement in main.lua at line 41
    [4.18][2.3:74]()
    Cursor_pos = 1 -- in Unicode codepoints, from 1 to utf8.len(line) + 1
    [4.18]
    [4.1238]
    Cursor_pos = 15 -- in Unicode codepoints, from 1 to utf8.len(line) + 1
  • replacement in main.lua at line 50
    [4.68][4.271:360]()
    Top_screen_line_starting_pos = 1 -- when top of screen starts in between a wrapped line
    [4.68]
    [4.360]
    Top_screen_line_starting_pos = 6 -- when top of screen starts in between a wrapped line
  • replacement in main.lua at line 64
    [4.23][4.95:136](),[4.95][4.95:136](),[4.136][4.366:434](),[4.434][4.24:78](),[4.102][4.24:78](),[4.78][4.435:505]()
    love.window.setMode(0, 0) -- maximize
    Screen_width, Screen_height, Screen_flags = love.window.getMode()
    -- shrink slightly to account for window decoration
    Screen_width = Screen_width-100
    Screen_height = Screen_height-100
    [4.23]
    [4.505]
    --? love.window.setMode(0, 0) -- maximize
    --? Screen_width, Screen_height, Screen_flags = love.window.getMode()
    --? -- shrink slightly to account for window decoration
    --? Screen_width = Screen_width-100
    --? Screen_height = Screen_height-100
    Screen_width = 120
    Screen_height = 200
  • replacement in main.lua at line 73
    [4.43][4.456:479](),[4.479][4.87:135](),[4.43][4.87:135]()
    --? Line_width = 100
    Line_width = math.floor(Screen_width/2/40)*40
    [4.43]
    [4.2]
    Line_width = 100
    --? Line_width = math.floor(Screen_width/2/40)*40