Commit Graph

48 Commits

Author SHA1 Message Date
Kartik K. Agaram aa592d25c4 Merge lines.love 2023-11-18 12:17:17 -08:00
Kartik K. Agaram 007b965b11 audit all asserts
Each one should provide a message that will show up within LÖVE. Stop
relying on nearby prints to the terminal.

I also found some unnecessary ones.

There is some potential here for performance regressions: the format()
calls will trigger whether or not the assertion fails, and cause
allocations. So far Lua's GC seems good enough to manage the load even
with Moby Dick, even in some situations that caused issues in the past
like undo.
2023-11-18 11:32:01 -08:00
Kartik K. Agaram 4512f67aae get search working again
In the process, I'm getting rid of the search/ directory that cached
results and that I never ever used. This might pose an additional
migration issue: someone might need to `rm -rf` the `search/`
subdirectory in their notes.
2023-09-08 15:28:38 -07:00
Kartik K. Agaram 209dc38a9b change how we provide the notes directory
Before:
- notes directory is saveDir/data by default
  where saveDir = love.filesystem.getSaveDirectory()
- providing a commandline arg of x makes the notes directory saveDir/data.x

Now:
- there is no default directory; you get an error message instead
  telling you what to do.
- the commandline arg is the (preferably absolute) path of the notes
  directory you want to load

Unchanged: once you set the notes directory it gets remembered for
future runs.

Now the Readme is a lot simpler.

I tried to make migrating simpler, but this is complicated enough (see
Manual_tests.md)
2023-09-08 14:20:42 -07:00
Kartik K. Agaram 6e54ad55d9 yet another set of bugfixes
The key API change I'd underestimated: opening a file used to return nil
on failure, and now returns false.
2023-08-30 23:52:25 -07:00
Kartik K. Agaram 1af1a173f2 bugfix: files weren't being written 2023-08-30 23:33:18 -07:00
Kartik K. Agaram b826451091 Merge lines.love 2023-08-30 22:22:31 -07:00
Kartik K. Agaram da21512440 bugfix: drawings in source editor
Broken since 2022-09 X-(

Scenario:
* switch to source editor
* draw a line
* wait 3 seconds

Before this commit the app would crash and then fail to restart until
you deleted the created .lua file from save dir.

This is not the first time I've confused Lua's files and LÖVE's
droppedFile objects. Just never rely on multiple args in file:write().
2023-05-30 00:02:09 -07:00
Kartik K. Agaram 728aa48d3c bugfix: never clobber in-memory links for a note
scenario: add note to a note in a column by itself
Before this commit, the new note would seem to be added fine, but the
old note's link would never be persisted.

It isn't enough just to fix run.lua, I also need to make add_note and
populate_unroll_column behave more composably. Which increases the risk
that this bugfix is going to introduce cascading bugs. (There must have
been some reason I was erroring out when trying to unroll a note with no
next link? And yet the check only occurs for the very first node in the
chain?) But hopefully we're going in the right direction and any
follow-on bugs will eventually damp down to 0. This seems worth doing
even if it introduces bugs.
2023-03-20 22:52:16 -07:00
Kartik K. Agaram 2f6db30a76 lots more logs
I just ran into this again after a few days of being sick.
Unfortunately I hadn't logged add_link, only can_add_link.
2023-03-16 20:21:31 -07:00
Kartik K. Agaram eef0e2bc3b some more logs
The previous commit was super useful. The links are not actually being
lost when I exit pensieve. Instead, they're somehow not being set in
some code path that I haven't tracked down yet.

The important thing is, I've been missing things because I wasn't
running it from a terminal. prints (that the links are empty) were
disappearing that would have helped diagnose it. Lesson learned: always
send error prints to the log as well. At least there we have a hope of
spotting them.

Once we start emitting prints to the log, also include the function
name. On errors so far we've not bothered because the default LOVE error
handler shows the stack trace. However the logs don't record the stack,
and we might go looking at them long after the app crashes. The print
doesn't need function names, but the log does so we'll just
lowest-common-denominator both.
2023-03-08 18:23:37 -08:00
Kartik K. Agaram da397e7154 new logs
I'm disabling the logs for the bug of 3a9f1ed91e, losing the cursor.
Now focusing on the bug of losing links between notes sometimes. I
suspect it happens because I quit soon after creating a link. We'll see.

I don't recally any other bugs bothering me recently.
2023-03-08 11:26:31 -08:00
Kartik K. Agaram 3f1bb8fd92 temporary log against yet another new crash
file.lua:283: bad argument #1 to 'pairs' (table expected, got nil)
  Traceback
    [love "callbacks.lua"]:228: in function 'handler'
    [C]: in function 'pairs'
    file.lua:283: in function 'empty'
    file.lua:157: in function 'save_links'
    run.lua:1358: in function 'fn'
    commands.lua:1486: in function 'process_all_links'
    run.lua:1357: in function 'stop_editing'
    commands.lua:1112: in function 'link'
    commands.lua:477: in function 'run_command'
    commands.lua:557: in function 'run_command_with_args'
    commands.lua:226: in function 'keychord_press_on_command_palette'
    run.lua:775: in function 'keychord_press'
    main.lua:207: in function 'keychord_press'
    keychord.lua:11: in function <keychord.lua:5>
    app.lua:31: in function <app.lua:22>
    [C]: in function 'xpcall'

I'm not able to reproduce it. How can decoding the json metadata ever
yield nil?
2023-02-14 23:26:41 -08:00
Kartik K. Agaram 3e0bbf14dc split cross-links out of Cache 2022-11-22 21:55:32 -08:00
Kartik K. Agaram 48f73234ec revert commit 75dfab79db
Needing a pane (containing lines) to update just the links is
counter-productive; we might not have such panes visible on the pane.
2022-11-22 21:11:51 -08:00
Kartik K. Agaram 75dfab79db slightly encapsulate Cache usage around link management 2022-11-20 14:03:12 -08:00
Kartik K. Agaram 70493f9d99 Merge lines.love 2022-09-26 15:33:41 -07:00
Kartik K. Agaram d1dd3e441f fix support for absolute paths in Windows 2022-09-26 15:19:47 -07:00
Kartik K. Agaram ad5a0ac177 Merge lines.love 2022-09-11 08:51:25 -07:00
Kartik K. Agaram 9a41c7c176 more correct absolute path detection 2022-09-11 08:31:05 -07:00
Kartik K. Agaram 528c64d690 support drawings in the source editor 2022-09-05 11:29:39 -07:00
Kartik K. Agaram 523ac7b0bb Merge lines.love 2022-09-03 19:50:41 -07:00
Kartik K. Agaram 1a6f533e2c dedup points while loading drawing from disk 2022-09-03 19:24:40 -07:00
Kartik K. Agaram 0e96198edb Merge lines.love
Pensieve.love can now edit itself. This is a large change and possibly
destabilizing.
2022-09-03 18:13:00 -07:00
Kartik K. Agaram e1c5a42f31 editing source code from within the app
integrated from pong.love via text.love:
  https://merveilles.town/@akkartik/108933336531898243
2022-09-03 14:13:22 -07:00
Kartik K. Agaram aeaa7d150c helper: file_exists 2022-08-23 15:04:30 -07:00
Kartik K. Agaram 4f56181bd0 always emit .json files in a consistent order 2022-08-05 07:23:46 -07:00
Kartik K. Agaram 32bd406f66 persist link files only if necessary
And be careful to actually clear deleted links.
2022-07-31 10:07:30 -07:00
Kartik K. Agaram 75982e411f get persisting links to actually work some of the time 2022-07-31 10:06:52 -07:00
Kartik K. Agaram 5fd6af96e6 start persisting links 2022-07-31 00:41:12 -07:00
Kartik K. Agaram a21f5105ef support symlinks when opening files 2022-07-29 11:32:53 -07:00
Kartik K. Agaram 51aadc69ab update 'recently modified' when editing 2022-07-26 00:19:27 -07:00
Kartik K. Agaram 1d3ce71db5 Merge upstream into main 2022-07-25 21:27:12 -07:00
Kartik K. Agaram 48162b9816 have file API operate on state object 2022-07-25 19:56:39 -07:00
Kartik K. Agaram c66fa36aae switch to love.filesystem for file operations
It's safer, ensures I can't accidentally access anything outside the
app's directory.
2022-07-23 23:23:59 -07:00
Kartik K. Agaram 252438c1b7 command palette
Currently only searches prefixes of available alternatives.
2022-07-20 15:43:01 -07:00
Kartik K. Agaram 3dccd7f81a stop pretending globals are local
One advantage of this approach: we don't end up with multiple lexical
scopes containing duplicates of the same modules.
2022-07-11 22:11:58 -07:00
Kartik K. Agaram 8d00da889d better error message
akkartik/lines.love#1
2022-07-05 14:02:52 -07:00
Kartik K. Agaram 15acc38da9 test: autosave after any shape 2022-06-14 22:06:08 -07:00
Kartik K. Agaram fbad3dd205 avoid some string concatenations
file:write can write multiple args one after another; no need to
concatenate them first.

I'm starting to pay attention to memory usage after the experience of
turning off the JIT.
2022-06-10 07:14:45 -07:00
Kartik K. Agaram 26033f40f1 ignore 'deleted' shapes when saving to disk 2022-05-30 15:26:31 -07:00
Kartik K. Agaram f49e2fd104 typos 2022-05-25 17:07:06 -07:00
Kartik K. Agaram fa103ca2e8 couple more tests
Along with the App helpers needed for them.
2022-05-25 12:59:12 -07:00
Kartik K. Agaram 37f1313b16 first successful pagedown test, first bug found by test
I also really need to rethink how people debug my programs. My approach
of inserting and deleting print() takes a lot of commitment. I need my
old trace-based whitebox testing idea. However, in my past projects I
never did figure out a good framework for tweaking how verbose a trace
to emit.

Perhaps that's too many knobs. Perhaps we just need a way to run a
single test with the most verbose trace possible. Then it's just a
matter of having the trace tell a coherent story? But even if the trace
stays out of program output in that situation, it's still in the
programmer's face in the _code_. Ugh.

Current plan: ship program with maximum tests and zero commented-out
prints. If you want to debug, insert prints. This is better than
previous, text-mode, projects just by virtue of the stdout channel being
dedicated to debug stuff.
2022-05-23 08:17:40 -07:00
Kartik K. Agaram 46d4c4de10 first test! 2022-05-22 23:17:06 -07:00
Kartik K. Agaram bb9e23a638 support for naming points
There's still an absence of affordance showing when you're in naming mode.
2022-05-21 14:03:06 -07:00
Kartik K. Agaram 10c961855a bugfix: rectangles and squares are now saved 2022-05-21 08:28:34 -07:00
Kartik K. Agaram de495ae0f1 several more modules
This is probably not ideal; let's see how it goes..
2022-05-17 21:34:55 -07:00