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function run.draw_file_select_bar()local h = Editor_state.line_height+2local y = App.screen.height-hlove.graphics.setColor(0.9,0.9,0.9)love.graphics.rectangle('fill', 0, y-10, App.screen.width-1, h+8)love.graphics.setColor(0.6,0.6,0.6)love.graphics.line(0, y-10, App.screen.width-1, y-10)App.color(Text_color)local prompt = to_text('open file: ')love.graphics.draw(prompt, 15, y-5)love.graphics.setColor(1,1,1)local text_start_x = App.width(prompt)+20love.graphics.rectangle('fill', text_start_x-5, y-6, App.screen.width-text_start_x-20, h+2, 2,2)love.graphics.setColor(0.6,0.6,0.6)love.graphics.rectangle('line', text_start_x-5, y-6, App.screen.width-text_start_x-20, h+2, 2,2)App.color(Text_color)if File_select_bar_text == nil thenFile_select_bar_text = App.newText(love.graphics.getFont(), File_select_bar_value)endApp.screen.draw(File_select_bar_text, text_start_x,y-5)Text.draw_cursor(Editor_state, text_start_x+App.width(File_select_bar_text),y-5)end
if File_select_bar_value thenif chord == 'escape' thenFile_select_bar_value = nilFile_select_bar_text = nilelseif chord == 'return' thenrun.switch_to_file(File_select_bar_value)File_select_bar_value = nilFile_select_bar_text = nilelseif chord == 'backspace' thenlocal len = utf8.len(File_select_bar_value)local byte_offset = Text.offset(File_select_bar_value, len)File_select_bar_value = string.sub(File_select_bar_value, 1, byte_offset-1)File_select_bar_text = nilendreturnelseif chord == 'C-w' thenFile_select_bar_value = ''File_select_bar_text = nilend
function run.switch_to_file(filename)-- first make sure to save edits on any existing fileif Editor_state.next_save thensave_to_disk(Editor_state)end-- clear the slate for the new fileEditor_state.filename = filenameload_from_disk(Editor_state)Text.redraw_all(Editor_state)Editor_state.screen_top1 = {line=1, pos=1}Editor_state.cursor1 = {line=1, pos=1}love.window.setTitle('lines.love - '..Editor_state.filename)end
By default, lines.love reads/writes the file `lines.txt` in your defaultuser/home directory (`https://love2d.org/wiki/love.filesystem.getUserDirectory`).
By default, lines.love reads/writes the file `lines.txt` in a directoryspecific to this app (https://love2d.org/wiki/love.filesystem.getSourceBaseDirectory).
Updates to lines.love can be downloaded from the following mirrors in additionto the website above:* https://github.com/akkartik/lines.love* https://repo.or.cz/lines.love.git* https://tildegit.org/akkartik/lines.love* https://git.tilde.institute/akkartik/lines.love* https://git.sr.ht/~akkartik/lines.love* https://notabug.org/akkartik/lines.love* https://codeberg.org/akkartik/lines.love* https://pagure.io/lines.loveForks of lines.love are encouraged. If you show me your fork, I'll link to ithere.
* https://github.com/akkartik/lines-polygon-experiment -- an experiment thatuses separate shortcuts for regular polygons. `ctrl+3` for triangles,`ctrl+4` for squares, etc.* https://git.sr.ht/~akkartik/text.love -- a stripped down version withoutdrawings; useful starting point for some forks* https://git.sr.ht/~akkartik/pensieve.love -- a note-taking app on aninfinite 2D surface. Still in development.* https://git.sr.ht/~akkartik/capture.love -- a blank-slate mode for thenote-taking app, so all the stuff pensieve.love puts on screen doesn't causeyou to forget what you came to write down.
This repo is a fork of [lines.love](http://akkartik.name/lines.html), aneditor for plain text where you can also seamlessly insert line drawings.Updates to it can be downloaded from:
* https://codeberg.org/akkartik/lines2md exports lines.love files to Markdownand (non-editable) SVG.* https://git.sr.ht/~akkartik/lines2html.love exports lines.love files to htmland inline SVG.
Further forks are encouraged. If you show me your fork, I'll link to it here.