couple of renames
[?]
May 25, 2022, 10:20 PM
ULKLJBN6Q2EXYOXGIJLJ5NZPZD2MQSWR63Z2I3KDYJDAJQA5VNZACDependencies
- [2]
DFSDPDO7bugfix - [3]
DXT4QTAHa few more integer coordinates - [4]
H2DPLWMVsnapshot: wrapping long lines at word boundaries - [5]
5Q6NIG66bugfix - [6]
2RXZ3PGObeginning of a new approach to scroll+wrap - [7]
QYIFOHW3first test! - [8]
IMEJA43Lsnapshot - [9]
DAENUOGVeliminate assumptions that line length == size in bytes - [10]
BULPIBEGbeginnings of a module for the text editor - [*]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [*]
BOFNXP5Gclicking now moves the cursor even on long, wrapped lines
Change contents
- replacement in text.lua at line 54
Text.draw_cursor(x+Text.cursor_x2(frag, Cursor1.pos-pos+1), y)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
local max_x = Text.cursor_x(line, len+1)local max_x = 25+Text.x(line, len+1) - replacement in text.lua at line 1108
local currxmin = Text.cursor_x(line, curr)local currxmax = Text.cursor_x(line, curr+1)local currxmin = 25+Text.x(line, curr)local currxmax = 25+Text.x(line, curr+1) - replacement in text.lua at line 1135
local max_x = Text.cursor_x2(line, len+1)local max_x = Text.x(line, len+1) - replacement in text.lua at line 1143
local currxmin = Text.cursor_x2(line, curr+1)local currxmax = Text.cursor_x2(line, curr+2)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)endfunction 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)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)