Commit Graph

205 Commits

Author SHA1 Message Date
Kartik K. Agaram a77ba7852e Merge pensieve.love 2024-03-01 19:22:04 -08:00
Kartik K. Agaram 868ad7ddb2 rename variable 2024-03-01 18:28:00 -08:00
Kartik K. Agaram 90e195dd64 simplify the palette state machine 2024-03-01 17:52:16 -08:00
Kartik K. Agaram e2265b1ee0 Merge pensieve.love
Also fix an earlier merge bug.
2024-02-04 17:34:04 -08:00
Kartik K. Agaram 9138182131 Merge pensieve.love 2024-01-15 02:26:04 -08:00
Kartik K. Agaram 25c9249b5f Merge lines.love 2024-01-15 02:24:30 -08:00
Kartik K. Agaram 9ae5e9d9b1 Merge pensieve.love 2023-12-29 14:26:24 -08:00
Kartik K. Agaram 334ec7bf7c Merge lines.love 2023-12-29 14:24:04 -08:00
Kartik K. Agaram bd2179d8aa bugfix
scenario: run without config file, quit, run again
expected: font size remains the same on second run

Before this commit it was increasing on each run.
It turns out the font height that you pass into love.graphics.newFont()
is not the result of font:getHeight().
2023-12-29 11:52:28 -08:00
Kartik K. Agaram 0f4aea6db7 pull font into editor
Now it adjusts the current font for itself.
And it's up to the caller to adjust the current font after.
2023-12-29 11:18:41 -08:00
Kartik K. Agaram 76ac609251 Merge pensieve.love 2023-11-21 10:12:14 -08:00
Kartik K. Agaram a898bb7e10 merge bugfix 2023-11-21 10:11:17 -08:00
Kartik K. Agaram ed2a74c043 Merge pensieve.love 2023-11-18 12:18:13 -08:00
Kartik K. Agaram aa592d25c4 Merge lines.love 2023-11-18 12:17:17 -08:00
Kartik K. Agaram aa9a0b0b15 use my name for a dir 2023-10-27 23:58:42 -07:00
Kartik K. Agaram 08a2642406 Merge pensieve.love 2023-09-25 14:35:05 -07:00
Kartik K. Agaram 2f61e8e71e bugfix: stale name 2023-09-25 14:34:23 -07:00
Kartik K. Agaram 02c7c0db24 Merge pensieve.love 2023-09-15 23:52:57 -07:00
Kartik K. Agaram 50559713c8 fail early when given a relative path
Future writes would fail anyway.

(In the past, relative paths have referred to the save dir. The natural
expectation is current working dir. So I'm not going to try to guess.)
2023-09-15 12:56:58 -07:00
Kartik K. Agaram 3e72787ade clean up debug prints 2023-09-15 11:04:48 -07:00
Kartik K. Agaram c4d8a9b6c5 bugfix: crash when naming points in a drawing
This only happens when pressing C-n inside a drawing in normal (not
maximized) mode.

The reason is complicated. First, the baseline:
  * When pressing C-o:
      run.keychord: starty is not nil
      run.keychord: current drawing is nil
      Drawing.keychord C-o: doesn't set current drawing
      plan_draw (only happens in normal mode): clears starty in all lines
      Drawing.update: all good ✓

  * When pressing C-n:
      run.keychord: starty is not nil
      run.keychord: current drawing is nil
      Drawing.keychord C-n: sets current drawing  <===
      plan_draw: clears starty in all lines
      Drawing.update: BOOM

Ugh.

When is starty set? Drawing.draw. This is why I can clean it up with
abandon. But:
  frame = events -> update -> draw

  * plan_draw clears starty while processing events
  * Drawing.update blows up in here               <===
  * Drawing.draw is about to set starty

So one possible interpretation here is that this is an unfortunate
interaction of two special-cases:
  * draw should never mutate state, but it's just the most convenient
    place to track starty
  * keystrokes never set current drawing -- except rare operations like
    naming and moving points

So the current prescription: any code called from within update needs to
protect against starty being nil.

Ugh X-(
2023-09-15 10:25:10 -07:00
Kartik K. Agaram d88239dde4 Merge pensieve.love 2023-09-09 09:39:27 -07:00
Kartik K. Agaram 12ae4f3e98 Merge lines.love 2023-09-09 09:34:44 -07:00
Kartik K. Agaram 4729119350 Merge pensieve.love 2023-09-08 14:31:03 -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 11d2a917f5 get rid of commandline args
Now pensieve.love always manages notes in the data/ subdirectory of the
save dir, and stores its settings in the 'config' file in the save dir.

And main.lua is now much more similar to upstream and most forks. I made
this edit using an external editor, just to keep the comparison with
lines.love in view.
2023-09-08 08:36:54 -07:00
Kartik K. Agaram 0bfcfd0f7d Merge pensieve.love 2023-09-04 14:02:17 -07:00
Kartik K. Agaram 162d408175 bugfix: S-pagedown wasn't scrolling 2023-09-02 18:10:32 -07:00
Kartik K. Agaram e32d4cebbe Merge pensieve.love 2023-08-31 20:17:28 -07:00
Kartik K. Agaram 68f991df51 bugfix: various calls to renamed methods 2023-08-31 20:01:44 -07:00
Kartik K. Agaram b3ed55c104 Merge pensieve.love 2023-08-30 22:23:50 -07:00
Kartik K. Agaram b826451091 Merge lines.love 2023-08-30 22:22:31 -07:00
Kartik K. Agaram 163e341051 add commands to navigate left/right by column
Being smart about the y coordinate is difficult, so they just bounce to
top of column for now. That way we're guaranteed the cursor pane will be
on screen.
2023-07-25 10:02:48 -07:00
Kartik K. Agaram 7df30d5187 Merge pensieve.love 2023-07-11 09:44:56 -07:00
Kartik K. Agaram e895517092 Merge lines.love 2023-07-11 09:41:00 -07:00
Kartik K. Agaram 52ba030eaa drop an unused arg 2023-07-11 08:36:42 -07:00
Kartik K. Agaram e701e4833b Merge pensieve.love 2023-07-10 18:02:01 -07:00
Kartik K. Agaram 7f1370721c Merge lines.love 2023-07-10 17:53:27 -07:00
Kartik K. Agaram bca7f82598 standardize between run and source some more
We shouldn't be thinking about saving settings when we're initializing
window geometry.
2023-07-10 17:16:58 -07:00
Kartik K. Agaram 7f4c5f847b simplify saving settings
We don't ever call one app's settings while Current_app is the other.
2023-07-10 17:14:38 -07:00
Kartik K. Agaram a8747478ff bugfix: Windows pushing title bar off screen
I'm learning the hard way that resizing the window is a big deal. Only
do this when someone explicitly requests it, otherwise follow LÖVE's
defaults.

Therefore we're also going to stop trying to be smart when showing the
log browser. Leave window resizing to manual operations.

Now initialization looks a lot more similar for the run and source apps.
2023-07-10 17:09:09 -07:00
Kartik K. Agaram 3f52063d02 delete flags that have never been exercised
Initialization is getting complex, and I'm finding bugs.
2023-07-10 16:33:17 -07:00
Kartik K. Agaram b42f08cb79 bugfix: preserve window position
I just noticed we hadn't got this bugfix for Linux on the main app. How
had we not noticed this issue before? Answer: lines.love windows tend to
be tall and skinny, and resize must keep the window entirely within the
screen. So the window was staying in place just because it happened to
be running up against the bottom.
2023-07-10 16:08:18 -07:00
Kartik K. Agaram 03aa5192c9 Merge pensieve.love 2023-06-14 23:53:53 -07:00
Kartik K. Agaram 7fd1f0268f bugfix: page-up
Before this commit it was scrolling up too much. Like, 2 screens up
instead of 1.

This commit seems like a follow-up to commits dabb7a6c4 and a9a8d5c17.
I'm not analyzing it too much, just focusing on this location after some
debug logs.

Those commits should probably have noticed the missing symmetric
keystroke. But I'm probably ignoring similar concerns in dealing with
this so superficially.
2023-06-14 23:52:46 -07:00
Kartik K. Agaram 8133f2acb4 Merge pensieve.love 2023-06-10 17:44:20 -07:00
Kartik K. Agaram b7f2727b0e bugfix: screen_bottom1 might never be written
See previous commit.
2023-06-10 17:42:45 -07:00
Kartik K. Agaram 5ba9aa9e57 new bug: screen_bottom1 might never be written
Scenario: press C-f and search for something.
Some of the time we get a crash with this call stack:

  Error
  text.lua:970: attempt to compare nil with number

  Traceback
  [love "callbacks.lua"]:228: in function 'handler'
  text.lua:970: in function 'lt1'
  search.lua:72: in function 'search_next'
  run.lua:985: in function 'search_next_in_pane'
  run.lua:939: in function 'search_next'
  run.lua:784: in function 'text_input'
  main.lua:237: in function <main.lua:230>
  app.lua:31: in function <app.lua:22>
  [C]: in function 'xpcall'

Not fixed yet.

The cause: plan_draw is conservative and sometimes tries to render panes
that never overlap the viewport.

This bug was exacerbated by fixing the inscript bug which started
setting screen_bottom1 to nil. But the problem existed before as well,
we just operated on stale screen_bottom1 locations.

This bug doesn't generalize to many other scenarios. It isn't a problem
for forks without the surface metaphor, though it might affect
driver.love as well. Even in pensieve.love, the only place that uses
screen_bottom while spanning multiple editors is find across the entire
surface.
2023-06-10 17:34:48 -07:00
Kartik K. Agaram 14c08f9bd9 several bugfixes in saving/loading cursor position 2023-06-08 01:02:54 -07:00
Kartik K. Agaram f1886391c5 some temporary logging to catch a bug
The bug has been spotted twice:

1. In snap.love, I selected text in one node, then another, and hit:
  Error: text.lua:789: attempt to compare nil with number
  stack traceback:
    text.lua:789: in function 'lt1'
    select.lua:19: in function 'clip_selection'
    text.lua:32: in function 'draw'
    edit.lua:117: in function 'draw'
    [string "REPL"]:21: in function 'draw'
    main.lua:152: in function 'draw'
    app.lua:102: in function <app.lua:84>
    [C]: in function 'xpcall'
    app.lua:112: in function <app.lua:111>
    [C]: in function 'xpcall'

  Couldn't reproduce.

2. In text.love, inscript selected all text in a small buffer and then
   clicked outside the text. And got:

  Error: text.lua:784: attempt to compare nil with number
  Traceback
    [love "callbacks.lua"]:228: in function 'handler'
    text.lua:784: in function 'lt1'
    select.lua:19: in function 'clip_selection'
    text.lua:27: in function 'draw'
    edit.lua:117: in function 'draw'
    run.lua:136: in function 'draw'
    main.lua:148: in function 'draw'
    app.lua:42: in function <app.lua:22>
    [C]: in function 'xpcall'

  This is reproducible, and also across forks.
2023-06-01 12:30:19 -07:00