bugfix: pasting newlines

[?]
Jun 3, 2022, 1:35 AM
GN3IF4WF352YK5K4YHVMAIMPL7PNTCEMDWW22PTKDOXKV2FZJ7NQC

Dependencies

  • [2] QVDQMJXV avoid scrolling down if possible
  • [3] VJ77YABH more efficient undo/redo
  • [4] CG3264MM move
  • [5] JY4VK7L2 rename
  • [6] PHFWIFYK scroll on enter
  • [7] 2ZYV7D3W handle tab characters
  • [8] 537TQ2QN some more logging
  • [9] SQLVYKVJ rename
  • [10] 2POFQQLW keep cursor on screen when pressing 'down'
  • [11] 2RXZ3PGO beginning of a new approach to scroll+wrap
  • [12] 73OCE2MC after much struggle, a brute-force undo
  • [13] XNFTJHC4 split keyboard handling between Text and Drawing
  • [*] BULPIBEG beginnings of a module for the text editor
  • [*] KOYAJWE4 extract a couple more methods

Change contents

  • replacement in text.lua at line 1253
    [4.138][4.764:950](),[3.1421][4.764:950](),[4.6491][4.764:950](),[4.655][4.764:950](),[4.950][2.1389:1466](),[2.1466][4.950:1130](),[4.950][4.950:1130]()
    local byte_offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
    table.insert(Lines, Cursor1.line+1, {mode='text', data=string.sub(Lines[Cursor1.line].data, byte_offset)})
    local scroll_down = (Cursor_y + math.floor(15*Zoom)) > App.screen.height
    Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)
    Lines[Cursor1.line].fragments = nil
    Cursor1.line = Cursor1.line+1
    Cursor1.pos = 1
    [3.1421]
    [4.100]
    Text.insert_return()
  • edit in text.lua at line 1255
    [4.134][2.1467:1491](),[2.1491][4.1556:1648](),[4.1556][4.1556:1648]()
    if scroll_down then
    Screen_top1.line = Cursor1.line
    Text.scroll_up_while_cursor_on_screen()
    end
  • replacement in text.lua at line 1377
    [4.156][4.156:201]()
    Text.insert_at_cursor(utf8.char(code))
    [4.156]
    [4.201]
    local c = utf8.char(code)
    if c == '\n' then
    Text.insert_return()
    else
    Text.insert_at_cursor(utf8.char(code))
    end
  • edit in text.lua at line 1487
    [16.40]
    [16.40]
    end
    end
    function Text.insert_return()
    local byte_offset = utf8.offset(Lines[Cursor1.line].data, Cursor1.pos)
    table.insert(Lines, Cursor1.line+1, {mode='text', data=string.sub(Lines[Cursor1.line].data, byte_offset)})
    local scroll_down = (Cursor_y + math.floor(15*Zoom)) > App.screen.height
    Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)
    Lines[Cursor1.line].fragments = nil
    Cursor1.line = Cursor1.line+1
    Cursor1.pos = 1
    if scroll_down then
    Screen_top1.line = Cursor1.line
    Text.scroll_up_while_cursor_on_screen()