Merge text.love

[?]
Apr 2, 2023, 11:46 PM
QD4LOFQRYRXS5GCJLR4EKQPQBFYZA5CGRVJYVFT2U7GXZDAIUJNQC

Dependencies

Change contents

  • file deletion: help.lua (----------)help.lua (----------)
    [5.2][5.11545:11577](),[5.11577][5.6622:6622](),[5.2][5.11545:11577]()
    return App.width('* ')
    end
    end
    function draw_help_without_mouse_pressed(State, drawing_index)
    local drawing = State.lines[drawing_index]
    local line_cache = State.line_cache[drawing_index]
    App.color(Help_color)
    local y = line_cache.starty+10
    love.graphics.print("Things you can do:", State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Press the mouse button to start drawing a "..current_shape(State), State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Hover on a point and press 'ctrl+u' to pick it up and start moving it,", State.left+30,y)
    y = y + State.line_height
    love.graphics.print("then press the mouse button to drop it", State.left+30+bullet_indent(),y)
    y = y + State.line_height
    love.graphics.print("* Hover on a point and press 'ctrl+n', type a name, then press 'enter'", State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Hover on a point or shape and press 'ctrl+d' to delete it", State.left+30,y)
    y = y + State.line_height
    if State.current_drawing_mode ~= 'freehand' then
    love.graphics.print("* Press 'ctrl+p' to switch to drawing freehand strokes", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'line' then
    love.graphics.print("* Press 'ctrl+l' to switch to drawing lines", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'manhattan' then
    love.graphics.print("* Press 'ctrl+m' to switch to drawing horizontal/vertical lines", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'circle' then
    love.graphics.print("* Press 'ctrl+o' to switch to drawing circles/arcs", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'polygon' then
    love.graphics.print("* Press 'ctrl+g' to switch to drawing polygons", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'rectangle' then
    love.graphics.print("* Press 'ctrl+r' to switch to drawing rectangles", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'square' then
    love.graphics.print("* Press 'ctrl+s' to switch to drawing squares", State.left+30,y)
    y = y + State.line_height
    end
    love.graphics.print("* Press 'ctrl+=' or 'ctrl+-' to zoom in or out, ctrl+0 to reset zoom", State.left+30,y)
    y = y + State.line_height
    love.graphics.print("Press 'esc' now to hide this message", State.left+30,y)
    y = y + State.line_height
    App.color(Help_background_color)
    love.graphics.rectangle('fill', State.left,line_cache.starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-line_cache.starty))
    end
    function draw_help_with_mouse_pressed(State, drawing_index)
    local drawing = State.lines[drawing_index]
    local line_cache = State.line_cache[drawing_index]
    App.color(Help_color)
    local y = line_cache.starty+10
    love.graphics.print("You're currently drawing a "..current_shape(State, drawing.pending), State.left+30,y)
    y = y + State.line_height
    love.graphics.print('Things you can do now:', State.left+30,y)
    y = y + State.line_height
    if State.current_drawing_mode == 'freehand' then
    love.graphics.print('* Release the mouse button to finish drawing the stroke', State.left+30,y)
    y = y + State.line_height
    elseif State.current_drawing_mode == 'line' or State.current_drawing_mode == 'manhattan' then
    love.graphics.print('* Release the mouse button to finish drawing the line', State.left+30,y)
    y = y + State.line_height
    elseif State.current_drawing_mode == 'circle' then
    if drawing.pending.mode == 'circle' then
    love.graphics.print('* Release the mouse button to finish drawing the circle', State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Press 'a' to draw just an arc of a circle", State.left+30,y)
    else
    love.graphics.print('* Release the mouse button to finish drawing the arc', State.left+30,y)
    end
    y = y + State.line_height
    elseif State.current_drawing_mode == 'polygon' then
    love.graphics.print('* Release the mouse button to finish drawing the polygon', State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Press 'p' to add a vertex to the polygon", State.left+30,y)
    y = y + State.line_height
    elseif State.current_drawing_mode == 'rectangle' then
    if #drawing.pending.vertices < 2 then
    love.graphics.print("* Press 'p' to add a vertex to the rectangle", State.left+30,y)
    y = y + State.line_height
    else
    love.graphics.print('* Release the mouse button to finish drawing the rectangle', State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Press 'p' to replace the second vertex of the rectangle", State.left+30,y)
    y = y + State.line_height
    end
    elseif State.current_drawing_mode == 'square' then
    if #drawing.pending.vertices < 2 then
    love.graphics.print("* Press 'p' to add a vertex to the square", State.left+30,y)
    y = y + State.line_height
    else
    love.graphics.print('* Release the mouse button to finish drawing the square', State.left+30,y)
    y = y + State.line_height
    love.graphics.print("* Press 'p' to replace the second vertex of the square", State.left+30,y)
    y = y + State.line_height
    end
    end
    love.graphics.print("* Press 'esc' then release the mouse button to cancel the current shape", State.left+30,y)
    y = y + State.line_height
    y = y + State.line_height
    if State.current_drawing_mode ~= 'line' then
    love.graphics.print("* Press 'l' to switch to drawing lines", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'manhattan' then
    love.graphics.print("* Press 'm' to switch to drawing horizontal/vertical lines", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'circle' then
    love.graphics.print("* Press 'o' to switch to drawing circles/arcs", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'polygon' then
    love.graphics.print("* Press 'g' to switch to drawing polygons", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'rectangle' then
    love.graphics.print("* Press 'r' to switch to drawing rectangles", State.left+30,y)
    y = y + State.line_height
    end
    if State.current_drawing_mode ~= 'square' then
    love.graphics.print("* Press 's' to switch to drawing squares", State.left+30,y)
    y = y + State.line_height
    end
    App.color(Help_background_color)
    love.graphics.rectangle('fill', State.left,line_cache.starty, State.width, math.max(Drawing.pixels(drawing.h, State.width),y-line_cache.starty))
    end
    function current_shape(State, shape)
    if State.current_drawing_mode == 'freehand' then
    return 'freehand stroke'
    elseif State.current_drawing_mode == 'line' then
    return 'straight line'
    elseif State.current_drawing_mode == 'manhattan' then
    return 'horizontal/vertical line'
    elseif State.current_drawing_mode == 'circle' and shape and shape.start_angle then
    return 'arc'
    else
    return State.current_drawing_mode
    end
    end
    function bullet_indent()
  • file deletion: drawing.lua (----------)drawing.lua (----------)
    [5.2][5.1542:1577](),[5.2][5.1542:1577](),[5.1577][5.98:98]()
    -- after mouse_release
    love.graphics.rectangle('fill', x,y, name_width, State.line_height)
    end
    end
    end
    end
    App.color(Current_stroke_color)
    Drawing.draw_pending_shape(line, line_cache.starty, State.left,State.right)
    end
    function Drawing.draw_shape(drawing, shape, top, left,right)
    local width = right-left
    local function px(x) return Drawing.pixels(x, width)+left end
    local function py(y) return Drawing.pixels(y, width)+top end
    if shape.mode == 'freehand' then
    local prev = nil
    for _,point in ipairs(shape.points) do
    if prev then
    love.graphics.line(px(prev.x),py(prev.y), px(point.x),py(point.y))
    end
    prev = point
    end
    elseif shape.mode == 'line' or shape.mode == 'manhattan' then
    local p1 = drawing.points[shape.p1]
    local p2 = drawing.points[shape.p2]
    love.graphics.line(px(p1.x),py(p1.y), px(p2.x),py(p2.y))
    elseif shape.mode == 'polygon' or shape.mode == 'rectangle' or shape.mode == 'square' then
    local prev = nil
    for _,point in ipairs(shape.vertices) do
    local curr = drawing.points[point]
    if prev then
    love.graphics.line(px(prev.x),py(prev.y), px(curr.x),py(curr.y))
    end
    prev = curr
    end
    -- close the loop
    local curr = drawing.points[shape.vertices[1]]
    love.graphics.line(px(prev.x),py(prev.y), px(curr.x),py(curr.y))
    elseif shape.mode == 'circle' then
    -- TODO: clip
    local center = drawing.points[shape.center]
    love.graphics.circle('line', px(center.x),py(center.y), Drawing.pixels(shape.radius, width))
    elseif shape.mode == 'arc' then
    local center = drawing.points[shape.center]
    love.graphics.arc('line', 'open', px(center.x),py(center.y), Drawing.pixels(shape.radius, width), shape.start_angle, shape.end_angle, 360)
    elseif shape.mode == 'deleted' then
    -- ignore
    else
    print(shape.mode)
    assert(false)
    end
    end
    function Drawing.draw_pending_shape(drawing, top, left,right)
    local width = right-left
    local pmx,pmy = App.mouse_x(), App.mouse_y()
    local function px(x) return Drawing.pixels(x, width)+left end
    local function py(y) return Drawing.pixels(y, width)+top end
    local mx = Drawing.coord(pmx-left, width)
    local my = Drawing.coord(pmy-top, width)
    -- recreate pixels from coords to precisely mimic how the drawing will look
    name_width = App.width(p.name)
    end
    name_width = App.width('m')
    else
    local name_width
    if p.name == '' then
  • file deletion: source_undo.lua (----------)source_undo.lua (----------)
    [5.2][5.3520:3559](),[5.2][5.3520:3559](),[5.3559][5.68:68]()
    table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}})
    else
    print(line.mode)
    assert(false)
    end
    table.insert(event.lines, {mode='text', data=line.data}) -- I've forgotten: should we deepcopy(line.data)?
    elseif line.mode == 'drawing' then
  • file deletion: source_select.lua (----------)source_select.lua (----------)
    [5.2][5.30050:30091](),[5.2][5.30050:30091](),[5.30091][5.23288:23288]()
    love.graphics.rectangle('fill', x+lo_px,y, App.width(s),State.line_height)
    App.color(Text_color)
    return lo_px
    end
    end
    -- inefficient for some reason, so don't do it on every frame
    function Text.mouse_pos(State)
    local time = love.timer.getTime()
    if State.recent_mouse.time and State.recent_mouse.time > time-0.1 then
    return State.recent_mouse.line, State.recent_mouse.pos
    end
    State.recent_mouse.time = time
    local line,pos = Text.to_pos(State, App.mouse_x(), App.mouse_y())
    if line then
    State.recent_mouse.line = line
    State.recent_mouse.pos = pos
    end
    return State.recent_mouse.line, State.recent_mouse.pos
    end
    function Text.to_pos(State, x,y)
    for line_index,line in ipairs(State.lines) do
    if line.mode == 'text' then
    if Text.in_line(State, line_index, x,y) then
    return line_index, Text.to_pos_on_line(State, line_index, x,y)
    end
    end
    end
    end
    function Text.cut_selection(State)
    if State.selection1.line == nil then return end
    local result = Text.selection(State)
    Text.delete_selection(State)
    return result
    end
    function Text.delete_selection(State)
    if State.selection1.line == nil then return end
    local minl,maxl = minmax(State.selection1.line, State.cursor1.line)
    local before = snapshot(State, minl, maxl)
    Text.delete_selection_without_undo(State)
    record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
    end
    function Text.delete_selection_without_undo(State)
    if State.selection1.line == nil then return end
    -- min,max = sorted(State.selection1,State.cursor1)
    local minl,minp = State.selection1.line,State.selection1.pos
    local maxl,maxp = State.cursor1.line,State.cursor1.pos
    if minl > maxl then
    minl,maxl = maxl,minl
    minp,maxp = maxp,minp
    elseif minl == maxl then
    if minp > maxp then
    minp,maxp = maxp,minp
    end
    end
    -- update State.cursor1 and State.selection1
    State.cursor1.line = minl
    State.cursor1.pos = minp
    if Text.lt1(State.cursor1, State.screen_top1) then
    State.screen_top1.line = State.cursor1.line
    State.screen_top1.pos = Text.pos_at_start_of_screen_line(State, State.cursor1)
    end
    State.selection1 = {}
    -- delete everything between min (inclusive) and max (exclusive)
    Text.clear_screen_line_cache(State, minl)
    local min_offset = Text.offset(State.lines[minl].data, minp)
    local max_offset = Text.offset(State.lines[maxl].data, maxp)
    if minl == maxl then
    --? print('minl == maxl')
    State.lines[minl].data = State.lines[minl].data:sub(1, min_offset-1)..State.lines[minl].data:sub(max_offset)
    return
    end
    assert(minl < maxl)
    local rhs = State.lines[maxl].data:sub(max_offset)
    for i=maxl,minl+1,-1 do
    table.remove(State.lines, i)
    table.remove(State.line_cache, i)
    end
    State.lines[minl].data = State.lines[minl].data:sub(1, min_offset-1)..rhs
    end
    function Text.selection(State)
    if State.selection1.line == nil then return end
    -- min,max = sorted(State.selection1,State.cursor1)
    local minl,minp = State.selection1.line,State.selection1.pos
    local maxl,maxp = State.cursor1.line,State.cursor1.pos
    if minl > maxl then
    minl,maxl = maxl,minl
    minp,maxp = maxp,minp
    elseif minl == maxl then
    if minp > maxp then
    minp,maxp = maxp,minp
    end
    end
    local min_offset = Text.offset(State.lines[minl].data, minp)
    local max_offset = Text.offset(State.lines[maxl].data, maxp)
    if minl == maxl then
    return State.lines[minl].data:sub(min_offset, max_offset-1)
    end
    assert(minl < maxl)
    local result = {State.lines[minl].data:sub(min_offset)}
    for i=minl+1,maxl-1 do
    if State.lines[i].mode == 'text' then
    table.insert(result, State.lines[i].data)
    end
    end
    table.insert(result, State.lines[maxl].data:sub(1, max_offset-1))
    return table.concat(result, '\n')
    end
    lo_px = App.width(before)
    end
    --? print(lo,pos,hi, '--', lo_offset,pos_offset,hi_offset, '--', lo_px)
    local s = line.data:sub(lo_offset, hi_offset-1)
  • file deletion: source_text.lua (----------)source_text.lua (----------)
    [5.2][5.147125:147164](),[5.2][5.147125:147164](),[5.147164][5.83786:83786]()
    return App.width(s_before)
    end
    function Text.to2(State, loc1)
    return App.width(s_before)
    end
    function Text.x(s, pos)
    local offset = Text.offset(s, pos)
    local s_before = s:sub(1, offset-1)
    return App.width(screen_line)
    end
    table.insert(line_cache.fragments, frag)
    end
    x = x + frag_width
    frag_width = App.width(frag)
    end
    x = State.left -- new line
    end
    if #frag > 0 then
    table.insert(line_cache.fragments, frag1)
    frag = string.sub(frag, boffset)
    local frag1_width = App.width(frag1)
    assert(x + frag1_width <= State.right)
    local frag_width = App.width(frag)
    while x + frag_width > State.right do
    pos = pos + utf8.len(f)
    end
    end
    function Text.compute_fragments(State, line_index)
    local frag_width = App.width(f)
    if x + frag_width > State.right then
    x = State.left
    table.insert(line_cache.screen_line_starting_pos, pos)
    end
    x = x + frag_width
    Text.draw_cursor(State, x+Text.x(f, State.cursor1.pos-pos+1), y)
    App.color(Text_color)
    end
    end
    end
    x = x + frag_width
    end
    pos = pos + frag_len
    end
    App.screen.print(f, x,y)
    -- render cursor if necessary
    button(State, 'link', {x=x+App.width('[['), y=y, w=App.width(filename), h=State.line_height, color={1,1,1},
    icon = icon.hyperlink_decoration,
    onpress1 = function()
    source.switch_to_file(filename)
    end,
    })
    end
    end
    local trimmed_word = rtrim(f) -- compute_fragments puts whitespace at the end
    if starts_with(trimmed_word, '[[') and ends_with(trimmed_word, ']]') then
    local filename = trimmed_word:gsub('^..(.*)..$', '%1')
    if source.link_exists(State, filename) then
    local frag_width = App.width(f)
    if x + frag_width > State.right then
    assert(x > State.left) -- no overfull lines
    y = y + State.line_height
    if y + State.line_height > App.screen.height then
    --? print('skipping', f)
    else
    -- render fragment
    select_color(f)
    local frag_len = utf8.len(f)
    --? print('text.draw:', f, 'at', line_index,pos, 'after', x,y)
    if pos < startpos then
    -- render nothing
    Text.populate_screen_line_starting_pos(State, line_index)
    local pos = 1
    initialize_color()
    for _, f in ipairs(line_cache.fragments) do
    App.color(Text_color)
  • file deletion: source_file.lua (----------)source_file.lua (----------)
    [5.2][5.152462:152501](),[5.2][5.152462:152501](),[5.152501][5.150304:150304]()
    line_info.data = line
    table.insert(result, line_info)
    table.insert(result, {mode='text', data=line})
    end
  • file deletion: source_edit.lua (----------)source_edit.lua (----------)
    [5.2][5.165788:165827](),[5.2][5.165788:165827](),[5.165827][5.152503:152503]()
    -- fragments: snippets of the line guaranteed to not straddle screen lines
    -- screen_line_starting_pos: optional array of grapheme indices if it wraps over more than one screen line
    line_cache = {},
    -- Given wrapping, any potential location for the text cursor can be described in two ways:
    -- * schema 1: As a combination of line index and position within a line (in utf8 codepoint units)
    -- * schema 2: As a combination of line index, screen line index within the line, and a position within the screen line.
  • file deletion: source.lua (----------)source.lua (----------)
    [5.2][5.177715:177749](),[5.2][5.177715:177749](),[5.177749][5.165829:165829]()
    source.initialize_window_geometry(App.width('m'))
    Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
  • file deletion: run.lua (----------)run.lua (----------)
    [5.2][5.183867:183898](),[5.2][5.183867:183898](),[5.183898][5.178107:178107]()
    function width(s)
    return love.graphics.getFont():getWidth(s)
    end
    run.initialize_window_geometry(App.width('m'))
    Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
    Editor_state.font_height = font_height
    Editor_state.line_height = math.floor(font_height*1.3)
  • file deletion: log_browser.lua (----------)log_browser.lua (----------)
    [5.2][5.202684:202723](),[5.2][5.202684:202723](),[5.202723][5.191243:191243]()
    love.graphics.print(line.section_stack[i].name, x, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2)
    end
    end
    return log_browser.right_margin(State, line)
    end
    function should_show(line)
    -- Show a line if every single section it's in is expanded.
    for i=1,#line.section_stack do
    local section = line.section_stack[i]
    if not section.expanded then
    return false
    end
    end
    return true
    end
    function log_browser.left_margin(State, line)
    return State.left + #line.section_stack*Section_border_padding_horizontal
    end
    function log_browser.right_margin(State, line)
    return State.right - #line.section_stack*Section_border_padding_horizontal
    end
    function log_browser.update(State, dt)
    end
    function log_browser.quit(State)
    end
    love.graphics.print(line.section_stack[i].name, x+State.font_height+5, App.screen.height-App.width(line.section_stack[i].name)-5, --[[vertically]] math.pi/2)
    end
    end
    return log_browser.left_margin(State, line)
    end
    function render_stack_right_margin(State, line_index, line, y)
    App.color(Section_border_color)
    for i=1,#line.section_stack do
    local x = State.right - (i-1)*Section_border_padding_horizontal
    love.graphics.line(x,y, x,y+log_browser.height(State, line_index))
    if y < 30 then
    love.graphics.print(line.section_stack[i].name, x, y+5, --[[vertically]] math.pi/2)
    end
    if y > App.screen.height-log_browser.height(State, line_index) then
    love.graphics.print(line.section_name, xleft+50,y)
    love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony)
    end
    else
    if type(line.data) == 'string' then
    local old_left, old_right = State.left,State.right
    State.left,State.right = xleft,xright
    y = Text.draw(State, line_index, y, --[[startpos]] 1)
    State.left,State.right = old_left,old_right
    else
    height = log_render[line.data.name](line.data, xleft, y, xright-xleft)
    end
    end
    if App.mouse_x() > Log_browser_state.left and line_index == mouse_line_index then
    App.color(Cursor_line_background_color)
    love.graphics.rectangle('fill', xleft,y, xright-xleft, height)
    end
    y = y + height
    end
    end
    end
    function render_stack_left_margin(State, line_index, line, y)
    if line.section_stack == nil then
    -- assertion message
    for k,v in pairs(line) do
    print(k)
    end
    end
    App.color(Section_border_color)
    for i=1,#line.section_stack do
    local x = State.left + (i-1)*Section_border_padding_horizontal
    love.graphics.line(x,y, x,y+log_browser.height(State, line_index))
    if y < 30 then
    love.graphics.print(line.section_stack[i].name, x+State.font_height+5, y+5, --[[vertically]] math.pi/2)
    end
    if y > App.screen.height-log_browser.height(State, line_index) then
    love.graphics.print(line.section_name, xleft+50,y)
    love.graphics.line(xleft+50+App.width(line.section_name)+2,sectiony, xright,sectiony)
    else assert(line.section_end)
    local sectiony = y+State.line_height-Section_border_padding_vertical
    love.graphics.line(xleft,y, xleft,sectiony)
    love.graphics.line(xright,y, xright,sectiony)
    love.graphics.line(xleft,sectiony, xleft+50-2,sectiony)
  • file deletion: commands.lua (----------)commands.lua (----------)
    [5.2][5.207182:207218](),[5.2][5.207182:207218](),[5.207218][5.203826:203826]()
    local width = App.width(filename)
    if x + width > App.screen.width - 5 then
    y = y + Editor_state.line_height
    x = 5
    end
    if y == fy then
    log(2, ('%d: correct row; considering %d %s %d %d'):format(y, i, filename, x, width))
    if best_guess == nil then
    log(2, 'nil')
    best_guess = i
    best_guess_x = x
    best_guess_width = width
    elseif math.abs(fx + fwidth/2 - x - width/2) < math.abs(fx + fwidth/2 - best_guess_x - best_guess_width/2) then
    best_guess = i
    best_guess_x = x
    best_guess_width = width
    end
    log(2, ('best guess now %d %s %d %d'):format(best_guess, File_navigation.candidates[best_guess], best_guess_x, best_guess_width))
    end
    x = x + width + 30
    end
    log_end('file index')
    return best_guess
    end
    local width = App.width(filename)
    if x + width > App.screen.width - 5 then
    y = y + Editor_state.line_height
    x = 5
    end
    if i == index then
    return y, x, width
    end
    x = x + width + 30
    end
    end
    function file_index(fy, fx, fwidth)
    log_start('file index')
    log(2, ('for %d %d %d'):format(fy, fx, fwidth))
    local y,x = Menu_status_bar_height, 5
    local best_guess, best_guess_x, best_guess_width
    for i,filename in ipairs(File_navigation.candidates) do
    App.screen.print(filename, x + x3-menu_xmin, y3)
    end
    x3 = x3 + width + 30
    end
    --
    return h+20
    end
    function file_navigator_up()
    local y, x, width = file_coord(File_navigation.index)
    local index = file_index(y-Editor_state.line_height, x, width)
    if index then
    File_navigation.index = index
    end
    end
    function file_navigator_down()
    local y, x, width = file_coord(File_navigation.index)
    local index = file_index(y+Editor_state.line_height, x, width)
    if index then
    File_navigation.index = index
    end
    end
    function file_coord(index)
    local y,x = Menu_status_bar_height, 5
    for i,filename in ipairs(File_navigation.candidates) do
    width = App.width(filename)
    if x3 + width > App.screen.width - 5 then
    y3 = y3 + Editor_state.line_height
    x3 = 0
    end
    if i == o.index then
    App.color(Menu_highlight_color)
    love.graphics.rectangle('fill', x + x3-menu_xmin - 5, y3-2, width+5*2, Editor_state.line_height+2*2)
    end
    if x3 >= menu_xmin and x3 + width < menu_xmax then
    App.color(Menu_command_color)
    width = App.width(filename)
    if x2 + width > App.screen.width - 5 then
    y2 = y2 + Editor_state.line_height
    x2 = 0
    end
    if i == o.index then
    break
    end
    x2 = x2 + width + 30
    end
    -- figure out how much of the menu to display
    local menu_xmin = math.max(0, x2-w/2)
    local menu_xmax = math.min(App.screen.width, x2+w/2)
    -- now selectively print out entries
    local x3,y3 = 0,y -- x3 is relative, y3 is absolute
    local width = 0
    for i,filename in ipairs(o.files) do
    App.screen.print(s, x,y)
    x = x + width + 30
    return x,y
    local width = App.width(s)
    if x + width > App.screen.width - 5 then
    y = y + Editor_state.line_height
    x = 5
    local width = App.width(filename)
    if x + width > App.screen.width - 5 then
    result = result+1
    x = 5 + width
    else
    x = x + width + 30
    end
    end
    return result
    end
    function add_file_to_menu(x,y, s, cursor_highlight)
    App.screen.print(File_navigation.filter, 5, 5)
    draw_cursor(5 + App.width(File_navigation.filter), 5)
    if File_navigation.num_lines == nil then
    File_navigation.num_lines = source.num_lines_for_file_navigator(File_navigation.candidates)
    end
    App.color(Menu_background_color)
    love.graphics.rectangle('fill', 0,Menu_status_bar_height, App.screen.width, File_navigation.num_lines * Editor_state.line_height + --[[highlight padding]] 2)
    local x,y = 5, Menu_status_bar_height
    for i,filename in ipairs(File_navigation.candidates) do
    App.screen.print(s, Menu_cursor,5)
    Menu_cursor = Menu_cursor + width + 30
    end
    function source.draw_file_navigator()
    local width = App.width(s)
    if Menu_cursor > App.screen.width - 30 then
  • edit in text.lua at line 94
    [5.2940][5.3:120](),[5.2940][5.3:120](),[5.2940][5.3:120]()
    --? print('x: '..tostring(x)..'; frag_width: '..tostring(frag_width)..'; '..tostring(State.right-x)..'px to go')
  • resurrect zombie in text.lua at line 94
    [5.747][5.89:128](),[5.747][5.89:128](),[5.128][5.1613:1820](),[5.128][5.1613:1820]()
    local frag_width = App.width(frag)
    --? print('-- frag:', frag, pos, x, frag_width, State.width)
    while x + frag_width > State.width do
    --? print('frag:', frag, pos, x, frag_width, State.width)
    if x < 0.8 * State.width then
  • resurrect zombie in edit.lua at line 267
    [5.7565][5.3689:3861](),[5.7565][5.3689:3861]()
    State.search_backup = {
    cursor={line=State.cursor1.line, pos=State.cursor1.pos},
    screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos},
    }
  • edit in app.lua at line 143
    [5.4492][5.305:305](),[5.35229][4.10165:10263](),[5.35229][4.10165:10263](),[5.209859][4.10265:10265](),[5.209859][4.10265:10265]()
    error(('There were %d test failures:\n\n%s'):format(#Test_errors, table.concat(Test_errors)))
  • resolve order conflict in app.lua at line 143
    [5.4492]
    [5.5849]
  • resurrect zombie in app.lua at line 415
    [5.8162][5.8570:8726](),[5.8162][5.8570:8726]()
    App.open_for_reading = function(filename) return io.open(filename, 'r') end
    App.open_for_writing = function(filename) return io.open(filename, 'w') end