first test!
[?]
May 23, 2022, 6:17 AM
QYIFOHW3WDDQMK4ATY6IOSQRFHJOQ5QCPDKRC4GVGWLQEH4HGWVQCDependencies
- [2]
PFT5Y2ZYmove - [3]
JY4VK7L2rename - [4]
MGT5FTJ3first stab at supporting wrapping in cursor up - [5]
WLHI7KD3new globals: draw partial screen line up top - [6]
537TQ2QNsome more logging - [7]
DXT4QTAHa few more integer coordinates - [8]
5Q6NIG66bugfix - [9]
BYG5CEMVsupport for naming points - [10]
2RXZ3PGObeginning of a new approach to scroll+wrap - [11]
5L7K4GBDclicking to the right of a wrapped line - [12]
XNFTJHC4split keyboard handling between Text and Drawing - [13]
H2DPLWMVsnapshot: wrapping long lines at word boundaries - [14]
BULPIBEGbeginnings of a module for the text editor - [*]
VHQCNMARseveral more modules
Change contents
- replacement in text.lua at line 26
local frag_width = math.floor(frag_text:getWidth()*Zoom)local frag_width = math.floor(App.width(frag_text)*Zoom) - replacement in text.lua at line 50
love.graphics.draw(frag_text, x,y, 0, Zoom)App.screen.draw(frag_text, x,y, 0, Zoom) - edit in text.lua at line 81
function test_draw_text()App.screen.init{width=120, height=60}Lines = load_array{'abc', 'def', 'ghi'}Line_width = 120Cursor1 = {line=1, pos=1}Screen_top1 = {line=1, pos=1}Screen_bottom1 = {}Zoom = 1App.draw()local screen_top_margin = 15 -- pixelslocal line_height = 15 -- pixelslocal y = screen_top_marginApp.screen.check(y, 'abc', 'F - test_draw_text/screen:1')y = y + line_heightApp.screen.check(y, 'def', 'F - test_draw_text/screen:2')y = y + line_heightApp.screen.check(y, 'ghi', 'F - test_draw_text/screen:3')end - replacement in text.lua at line 105
local frag_text = love.graphics.newText(love.graphics.getFont(), frag)local frag_width = math.floor(frag_text:getWidth()*Zoom)local frag_text = App.newText(love.graphics.getFont(), frag)local frag_width = math.floor(App.width(frag_text)*Zoom) - replacement in text.lua at line 117
local frag1_text = love.graphics.newText(love.graphics.getFont(), frag1)local frag1_width = math.floor(frag1_text:getWidth()*Zoom)local frag1_text = App.newText(love.graphics.getFont(), frag1)local frag1_width = math.floor(frag1App.width(_text)*Zoom) - replacement in text.lua at line 122
frag_text = love.graphics.newText(love.graphics.getFont(), frag)frag_width = math.floor(frag_text:getWidth()*Zoom)frag_text = App.newText(love.graphics.getFont(), frag)frag_width = math.floor(App.width(frag_text)*Zoom) - replacement in text.lua at line 501
local text_before_cursor = love.graphics.newText(love.graphics.getFont(), line_before_cursor)return 25 + math.floor(text_before_cursor:getWidth()*Zoom)local text_before_cursor = App.newText(love.graphics.getFont(), line_before_cursor)return 25 + math.floor(App.width(text_before_cursor)*Zoom) - replacement in text.lua at line 507
local text_before_cursor = love.graphics.newText(love.graphics.getFont(), s_before_cursor)return math.floor(text_before_cursor:getWidth()*Zoom)local text_before_cursor = App.newText(love.graphics.getFont(), s_before_cursor)return math.floor(App.width(text_before_cursor)*Zoom) - edit in file.lua at line 104[16.18207][16.18207]
end-- for testsfunction load_array(a)local result = {}local next_line = ipairs(a)local i,line = 0, ''while true doi,line = next_line(a, i)if i == nil then break endif line == '```lines' then -- inflexible with whitespace since these files are always autogeneratedtable.insert(result, load_drawing_from_array(next_line, a, i))elsetable.insert(result, {mode='text', data=line})endendif #result == 0 thentable.insert(result, {mode='text', data=''})endreturn resultendfunction load_drawing_from_array(iter, a, i)local drawing = {mode='drawing', h=256/2, points={}, shapes={}, pending={}}local linewhile true doi, line = iter(a, i)assert(i)if line == '```' then break endlocal shape = json.decode(line)if shape.mode == 'freehand' then-- no changes neededelseif shape.mode == 'line' or shape.mode == 'manhattan' thenlocal name = shape.p1.nameshape.p1 = Drawing.insert_point(drawing.points, shape.p1.x, shape.p1.y)drawing.points[shape.p1].name = namename = shape.p2.nameshape.p2 = Drawing.insert_point(drawing.points, shape.p2.x, shape.p2.y)drawing.points[shape.p2].name = nameelseif shape.mode == 'polygon' or shape.mode == 'rectangle' or shape.mode == 'square' thenfor i,p in ipairs(shape.vertices) dolocal name = p.nameshape.vertices[i] = Drawing.insert_point(drawing.points, p.x,p.y)drawing.points[shape.vertices[i]].name = nameendelseif shape.mode == 'circle' or shape.mode == 'arc' thenlocal name = shape.center.nameshape.center = Drawing.insert_point(drawing.points, shape.center.x,shape.center.y)drawing.point[shape.center].name = nameelseprint(shape.mode)assert(false)endtable.insert(drawing.shapes, shape)endreturn drawing