Commit Graph

199 Commits

Author SHA1 Message Date
Kartik K. Agaram 7e242db523 Merge lines.love 2023-04-08 22:01:01 -07:00
Kartik K. Agaram c969fcdd85 enhance bugfix of commit a9aa3436f (Dec 2024)
Scenario:
* start out with some text on screen
* select some text A, delete
* select some more text B, delete
* press C-z twice to restore A and B
* press C-y twice

Before this commit only the first C-y was having an effect (deleting B).
The second was failing to delete A.
2023-04-08 21:55:51 -07:00
Kartik K. Agaram 81624d570f Merge text0 2023-04-03 09:50:27 -07:00
Kartik K. Agaram 542f0f261b Merge text.love 2023-04-03 09:28:46 -07:00
Kartik K. Agaram e406fdae0d Merge lines.love 2023-04-03 09:23:28 -07:00
Kartik K. Agaram 282983d084 switch source side to new screen-line-based render
Also copy over the implementation of links from pensieve.love.
2023-04-03 08:33:07 -07:00
Kartik K. Agaram 384fb2d19c streamline the interface for Text.draw 2023-04-02 17:19:03 -07:00
Kartik K. Agaram 38c5014761 Merge text0 2023-04-02 16:50:08 -07:00
Kartik K. Agaram 247c09846c Merge text.love 2023-04-02 16:46:31 -07:00
Kartik K. Agaram 3547c18db6 Merge lines.love 2023-04-02 09:22:32 -07:00
Kartik K. Agaram 24a732ebff update documentation on fragments
I see a path to at least maintain a single fragment per screen line. But
can we do better? It even seems unnecessary to maintain two copies of
the data, chopped up into lines and screen lines.
2023-04-01 18:12:29 -07:00
Kartik K. Agaram f64f680f2b no more Text allocations
Is it just my imagination, or does the app feel lighter and more fluffy?
2023-04-01 18:12:29 -07:00
Kartik K. Agaram 876d6298b4 App.width can no longer take a Text
In the process I discovered the horrible fact that Text.x allocates a new Text.
And it gets called (just once, thank goodness) on every single frame.
2023-04-01 18:12:29 -07:00
Kartik K. Agaram 9153d96951 Merge text0 2023-03-26 10:01:49 -07:00
Kartik K. Agaram b529ea5dc1 Merge text.love 2023-03-26 09:59:38 -07:00
Kartik K. Agaram 46e568c4c5 Merge lines.love 2023-03-26 09:49:03 -07:00
Kartik K. Agaram eae5c9505c bugfix: naming points 2023-03-26 09:36:41 -07:00
Kartik K. Agaram 0ae94b0de5 bugfix 2023-03-26 08:19:40 -07:00
Kartik K. Agaram 7f433753b6 bugfix
scenario: open a file starting with a drawing
After this commit the program doesn't crash.

  Error: [string "edit.lua"]:127: attempt to get length of field 'data' (a nil value)
  stack traceback:
    [love "boot.lua"]:345: in function '__len'
    [string "edit.lua"]:127: in function 'invalid1'
    [string "edit.lua"]:116: in function 'check_locs'
    [string "run.lua"]:35: in function 'initialize'
    main.lua:96: in function 'initialize'
    [string "app.lua"]:144: in function 'run_tests_and_initialize'
    [string "app.lua"]:16: in function <[string "app.lua"]:13>
    [C]: in function 'xpcall'
    [love "boot.lua"]:361: in function <[love "boot.lua"]:348>
    [C]: in function 'xpcall'
2023-03-26 07:19:27 -07:00
Kartik K. Agaram 57ed70d912 clean up some absolute coordinates 2023-03-25 18:34:28 -07:00
Kartik K. Agaram 9390a4a418 Merge text0 2023-03-23 21:51:55 -07:00
Kartik K. Agaram 0264e2ba19 Merge text.love 2023-03-23 21:48:27 -07:00
Kartik K. Agaram aa8994167f Merge lines.love 2023-03-23 21:43:26 -07:00
Kartik K. Agaram a6dcfc5ac8 some minor cleanup
I can't see the mouse wheel ever setting dx, but it's more obvious now
that the editor doesn't support panning left/right.
2023-03-23 21:38:33 -07:00
Kartik K. Agaram 99faf61abb mouse wheel support 2023-03-23 21:00:09 -07:00
Kartik K. Agaram d16dd9c6ce Merge text0 2023-03-19 00:08:08 -07:00
Kartik K. Agaram 398208cf26 Merge text.love 2023-03-19 00:04:53 -07:00
Kartik K. Agaram ab09ec6387 Merge lines.love 2023-03-18 23:59:42 -07:00
Kartik K. Agaram fceb2404fb move default file location
This works better on mobile platforms while seeming about as useful
anywhere else.

I've verified that anyone who already edited a file will continue to use
its path from settings.
2023-03-18 23:12:50 -07:00
Kartik K. Agaram 4e7ff6e3dc Merge text0 2023-03-17 22:47:30 -07:00
Kartik K. Agaram 39651f32d4 Merge text.love 2023-03-17 22:46:11 -07:00
Kartik K. Agaram eca407cf00 Merge lines.love 2023-03-17 22:30:46 -07:00
Kartik K. Agaram ae429cd78a bring a few things in sync between run and source 2023-03-17 21:40:51 -07:00
Kartik K. Agaram 81ebc6a559 bugfix: disallow font size of 0
Thanks Mikoláš Štrajt.
2023-03-17 19:58:53 -07:00
Kartik K. Agaram 5129c4f5ce Merge text0 2023-03-17 11:19:31 -07:00
Kartik K. Agaram d2933583ca Merge text.love 2023-03-17 11:15:48 -07:00
Kartik K. Agaram 4dbc097f83 Merge lines.love 2023-03-17 11:02:10 -07:00
Kartik K. Agaram e2c1bbe4e5 more robust state validation 2023-03-17 10:28:10 -07:00
Kartik K. Agaram b8c7cffbc2 Merge text0 2023-02-09 23:22:49 -08:00
Kartik K. Agaram f2cc22ed67 Merge text.love 2023-02-09 23:22:29 -08:00
Kartik K. Agaram 67334814a3 Merge lines.love 2023-02-09 23:19:52 -08:00
Kartik K. Agaram 224e8fe85a bugfix
scenario:
  press ctrl+f, type in a string
  hit down arrow if needed until the screen scrolls
  press enter
  click with the mouse somewhere

Before this commit the app would crash because cursor was above screen
top.
2023-02-09 23:09:23 -08:00
Kartik K. Agaram 7995e01237 Merge text0 2023-01-28 10:30:13 -08:00
Kartik K. Agaram 25acb412bb Merge text.love 2023-01-28 10:30:07 -08:00
Kartik K. Agaram b936e0f9cf Merge lines.love 2023-01-28 10:26:55 -08:00
Kartik K. Agaram 18f44c9761 wait a little to flush disk before quitting
I've been noticing in pensieve.love in particular that once a month or
so I lose data if I quit immediately after typing in something. Nothing
major, just the odd link between notes which leaves things in an
inconsistent state. Let's see if this helps.
2023-01-28 10:21:34 -08:00
Kartik K. Agaram e0517b7149 Merge text0 2022-12-24 19:30:32 -08:00
Kartik K. Agaram 543c88bc49 Merge text.love 2022-12-24 19:29:29 -08:00
Kartik K. Agaram 4d561e2294 Merge lines.love 2022-12-24 19:26:55 -08:00
Kartik K. Agaram a9aa3436fa bugfix
Scenario: make some edits, select some text, make some more edits. Press
ctrl-z.

Before this commit, undo would stop at the point of selection and
previous edits would become unreachable.

After this commit, both ctrl-z and ctrl-y seem able to span the point of
selection.
2022-12-24 19:24:48 -08:00
Kartik K. Agaram 53fbb905e3 typo 2022-12-24 19:24:48 -08:00
Kartik K. Agaram 45032ebbbe Merge text0 2022-12-23 20:17:16 -08:00
Kartik K. Agaram 98add5023f Merge text.love 2022-12-23 20:11:51 -08:00
Kartik K. Agaram 4854165630 Merge lines.love 2022-12-23 19:47:10 -08:00
Kartik K. Agaram e0448d7d7f consistent names in a few more places 2022-12-23 19:32:58 -08:00
Kartik K. Agaram 2b3e09ca0f make love event names consistent
I want the words to be easy to read, and to use a consistent tense.
update and focus seem more timeless; let's make everything like those.
2022-12-23 18:52:28 -08:00
Kartik K. Agaram e2e3aea2b1 require editor margins to be ints
Not directly relevant here, but forks of this project that permit
zooming can run into weird glitches if margins are not a whole number of
pixels.

I'd always assumed a type system that divided ints into floats was
strictly superior, but now I have experienced a situation where
requiring ints isn't just a compromise for the underlying CPU
implementation. Particularly since Lua's print() silently hides really
tiny fractions.
2022-12-23 16:57:04 -08:00
Kartik K. Agaram 92eccaea5a bugfix in changing shape mid-stroke 2022-12-12 23:17:02 -08:00
Kartik K. Agaram 561c94bbb0 Merge text0 2022-12-12 22:58:16 -08:00
Kartik K. Agaram 9f8861d5cb Merge text.love 2022-12-12 22:54:35 -08:00
Kartik K. Agaram 3897a9d86d Merge lines.love 2022-12-12 22:45:16 -08:00
Kartik K. Agaram 8b30e0608b bugfix: naming points in drawings
We had a regression since commit 60e1023f0 on Nov 27. Turns out we do
need the ancient hack after all.

But no, we won't go back to the hack. It's a simple problem to fix
right. And while we're at it, we'll fix the test harness to be more
realistic so it would have caught this problem.
2022-12-12 22:31:45 -08:00
Kartik K. Agaram 833ef32db1 configurable colors and cursor in editor widget 2022-11-30 19:31:00 -08:00
Kartik K. Agaram af85211247 Merge text.love 2022-11-27 22:24:31 -08:00
Kartik K. Agaram 5283c16e5c Merge lines.love 2022-11-27 22:22:16 -08:00
Kartik K. Agaram 7557e0904a bugfix 2022-11-27 22:20:26 -08:00
Kartik K. Agaram 2e68629898 Merge text.love 2022-11-27 13:21:46 -08:00
Kartik K. Agaram 816e3549b5 Merge text.love 2022-11-27 13:20:27 -08:00
Kartik K. Agaram 356fed8a24 Merge lines.love 2022-11-19 00:28:37 -08:00
Kartik K. Agaram 44aa8226c4 ctrl+a: select entire buffer 2022-11-19 00:27:20 -08:00
Kartik K. Agaram b64a60a509 bring back everything from commit a68647ae22
We only want to unwind the source editing.
2022-11-06 08:53:46 -08:00
Kartik K. Agaram ee18ce96a1 Merge text.love 2022-11-05 21:09:31 -07:00
Kartik K. Agaram 79fd6c4464 purge unused button infrastructure 2022-11-05 19:52:42 -07:00
Kartik K. Agaram 7d310f157c Merge text.love 2022-11-03 21:46:20 -07:00
Kartik K. Agaram 29140d24be back to commit 8123959e52 without code editing 2022-11-03 21:45:25 -07:00
Kartik K. Agaram fd71bc7d94 Merge lines.love 2022-11-03 21:08:11 -07:00
Kartik K. Agaram 0e0f36f8b4 stop tracking wallclock time
We only need time differences.
2022-11-03 21:02:31 -07:00
Kartik K. Agaram b23269f3e0 Merge lines.love 2022-09-10 19:25:00 -07:00
Kartik K. Agaram 511db8cffd bugfix: path munging on Windows 2022-09-10 19:23:34 -07:00
Kartik K. Agaram 901dd1fd94 Merge lines.love 2022-09-07 10:19:16 -07:00
Kartik K. Agaram 06c784b576 self-documenting 0 Test_right_margin 2022-09-07 10:16:24 -07:00
Kartik K. Agaram e0f750913f Merge lines.love 2022-09-05 12:47:27 -07:00
Kartik K. Agaram 528c64d690 support drawings in the source editor 2022-09-05 11:29:39 -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 42762ce062 editing source code from within the app
integrated from pong.love: https://merveilles.town/@akkartik/108933336531898243
2022-09-03 13:58:30 -07:00
Kartik K. Agaram 89081a8a78 Merge lines.love 2022-08-24 13:34:10 -07:00
Kartik K. Agaram ce31b74b10 infrastructure for caching LÖVE text objects 2022-08-24 13:27:04 -07:00
Kartik K. Agaram d011c0ce32 Merge lines.love 2022-08-23 13:25:55 -07:00
Kartik K. Agaram 468b791050 flip return value of button handlers
This is compatible with Javascript, and it also seems like a better
default; when people forget to think about return values in click
handlers, they should be consumed.
2022-08-23 11:43:10 -07:00
Kartik K. Agaram 8057f3e8fe stop putting button state in a global
Symptom: a test (test_click_to_create_drawing) started randomly failing
after I inserted a `return` 2 commits ago.

Cause: my tests call edit.draw, but button handlers only get cleared in
app.draw. So my tests weren't clearing button handlers, and every call
to edit.draw was accumulating states. Still unclear why those were going
to different state objects after the `return`, but anyway. I'm not going
to understand every last thing that happens when things go wrong, just
guarantee they can't go wrong. And the way to do that is to decentralize
button handlers to each state that receives them.

The State object in buttons.lua doesn't have to be Editor_state. It just
has to be some table that provides a Schelling Point for shared state.
2022-08-23 10:59:58 -07:00
Kartik K. Agaram aadc50f3b6 allow buttons to interrupt events
Most button onpress1 handlers will want to return true.
2022-08-23 09:40:48 -07:00
Kartik K. Agaram cfdac28e18 distinguish consistently between mouse buttons and other buttons 2022-08-23 09:36:08 -07:00
Kartik K. Agaram 61b59f4dd6 Merge lines.love 2022-08-18 13:11:41 -07:00
Kartik K. Agaram 3c04310503 subsection headings in a long switch 2022-08-18 10:09:20 -07:00
Kartik K. Agaram 03f3034930 Merge lines.love 2022-08-17 09:51:17 -07:00
Kartik K. Agaram f029c710b5 simplify cursor-on-screen check 2022-08-17 09:36:17 -07:00
Kartik K. Agaram a655c2113c bring back a level of wrapping
Many projects will require the ability to add metadata to lines, so
let's not drop that.
2022-08-15 11:00:35 -07:00
Kartik K. Agaram a85b984021 clean up a few more loose ends 2022-08-14 09:53:16 -07:00
Kartik K. Agaram 9d792a203b new fork: rip out drawing support 2022-08-14 09:20:14 -07:00
Kartik K. Agaram 9459d91abc remove some duplication 2022-08-14 08:10:24 -07:00