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
Kartik K. Agaram
4d1e7f922d
bugfix: obsolete location for attribute
2022-08-14 07:56:12 -07:00
Kartik K. Agaram
0218980add
click to the left of a line
2022-07-29 14:38:45 -07:00
Kartik K. Agaram
1e6b9e25aa
copying to clipboard can never scroll
2022-07-27 20:51:18 -07:00
Kartik K. Agaram
4ce716fe44
line.y -> line_cache.starty in a few more places
...
Disquieting that none of my tests caught these. On the other hand, I
also haven't noticed any issues in practice. Perhaps cache invalidation
is often unnecessary.
2022-07-27 20:45:46 -07:00
Kartik K. Agaram
48162b9816
have file API operate on state object
2022-07-25 19:56:39 -07:00
Kartik K. Agaram
6f74f95a46
extract method
2022-07-23 23:36:04 -07:00
Kartik K. Agaram
1937379da3
move drawing.starty into line cache
2022-07-20 17:08:00 -07:00
Kartik K. Agaram
d61b5dfdeb
use line cache for drawings as well
2022-07-20 16:34:09 -07:00
Kartik K. Agaram
29dac6a6ec
separate data structure for each line's cache data
...
I have no idea what the performance implications of this are..
2022-07-17 21:05:01 -07:00
Kartik K. Agaram
64eed74980
keep all text cache writes inside text.lua
2022-07-17 10:06:39 -07:00
Kartik K. Agaram
2859063d9d
switch to line index in a function
...
- Text.to_pos_on_line
2022-07-17 09:19:53 -07:00
Kartik K. Agaram
48b7de4fde
switch to line index in a function
...
- Text.in_line
2022-07-17 09:14:10 -07:00
Kartik K. Agaram
c0ea369607
drop some extra args
2022-07-17 09:14:10 -07:00
Kartik K. Agaram
2fc5bb9a61
fold together two largely similar cases
2022-07-17 08:05:22 -07:00
Kartik K. Agaram
038f06a342
drop some redundant args from Text.draw
2022-07-17 08:00:56 -07:00
Kartik K. Agaram
0ac44f0756
formatting
2022-07-16 19:27:58 -07:00
Kartik K. Agaram
f61d4269f5
bring back a set of constants
...
It's starting to sink in that I don't want hard-coded constants inside
objects.
2022-07-16 08:48:02 -07:00
Kartik K. Agaram
a1da18c107
more precise name
2022-07-15 22:15:07 -07:00
Kartik K. Agaram
2884f872d8
make test initializations a little more obvious
2022-07-15 22:12:25 -07:00
Kartik K. Agaram
22ad5373c5
a bug I've never run into
...
The previous commit was failing inside a test that I can't reproduce
manually. Perhaps it's something about how often draw/update run in
practice. Anyways, it's definitely uncovered a real issue.
2022-07-13 08:40:04 -07:00
Kartik K. Agaram
70a15b3bc9
replace globals with args in a few functions
...
- Drawing.draw_shape
- Drawing.draw_pending_shape
- Drawing.in_drawing
- Drawing.find_or_insert_point
- Drawing.near
- Drawing.pixels
2022-07-12 21:58:46 -07:00
Kartik K. Agaram
307e875c1c
correct a mis-named threshold
2022-07-12 21:41:09 -07:00
Kartik K. Agaram
2ae9cacd97
deduce left/right from state where possible
2022-07-12 20:59:24 -07:00
Kartik K. Agaram
3b36093553
left/right margin -> left/right coordinates
...
Editor state initialization now depends on window dimensions, so we have
to more carefully orchestrate startup.
2022-07-12 20:54:50 -07:00
Kartik K. Agaram
1ede1c3c6d
add state arg to a few functions
...
- Drawing.current_drawing
- Drawing.select_shape_at_mouse
- Drawing.select_point_at_mouse
- Drawing.select_drawing_at_mouse
2022-07-12 17:27:00 -07:00
Kartik K. Agaram
f7d4deef0c
add state arg to a few functions
...
- Text.cursor_at_final_screen_line
- Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary
- Text.snap_cursor_to_bottom_of_screen
- Text.in_line
- Text.to_pos_on_line
- Text.to2
- Text.to1
- Text.previous_screen_line
- Text.tweak_screen_top_and_cursor
- Text.redraw_all
2022-07-12 17:24:01 -07:00
Kartik K. Agaram
2b1889353b
add state arg to a few functions
...
- Text.pos_at_start_of_cursor_screen_line
- Text.cursor_past_screen_bottom
2022-07-12 17:14:14 -07:00
Kartik K. Agaram
5aae527759
add state arg to a few functions
...
- Text.search_next
- Text.search_previous
2022-07-12 17:02:53 -07:00
Kartik K. Agaram
5b91af1a66
add state arg to a few functions
...
- record_undo_event
- undo_event
- redo_event
- snapshot
2022-07-12 16:55:32 -07:00
Kartik K. Agaram
188bbc73cc
add state arg to a few functions
...
- Text.draw_highlight
- Text.clip_selection
- Text.selection
- Text.cut_selection
- Text.delete_selection
- Text.delete_selection_without_undo
- Text.mouse_pos
- Text.to_pos
2022-07-12 16:51:18 -07:00
Kartik K. Agaram
800a5c064a
add state arg to a few functions
...
- Text.insert_at_cursor
- Text.insert_return
- Text.pageup
- Text.pagedown
- Text.up
- Text.down
- Text.start_of_line
- Text.end_of_line
- Text.word_left
- Text.word_right
2022-07-12 16:39:42 -07:00
Kartik K. Agaram
adeb5416c6
add state arg to Text.textinput
2022-07-12 16:33:26 -07:00
Kartik K. Agaram
b7000215d8
add state arg to schedule_save
2022-07-12 16:30:41 -07:00
Kartik K. Agaram
e990b1be92
add state arg to Drawing.update
2022-07-12 16:26:00 -07:00
Kartik K. Agaram
2307cb3ded
add state arg to Drawing.draw
2022-07-12 16:25:29 -07:00
Kartik K. Agaram
93aca28cb3
add state arg to Text.keychord_pressed
2022-07-12 16:23:28 -07:00
Kartik K. Agaram
cb5524ec58
.
2022-07-12 16:22:35 -07:00
Kartik K. Agaram
d6795f9df0
add state arg to Drawing.mouse_released
2022-07-12 16:21:56 -07:00
Kartik K. Agaram
780105cb13
add state arg to Drawing.keychord_pressed
2022-07-12 16:21:03 -07:00
Kartik K. Agaram
d7ee9a75e4
add state arg to Drawing.mouse_pressed
2022-07-12 16:20:25 -07:00
Kartik K. Agaram
3874f325f8
add state arg to some functions
...
- Text.draw
- Text.draw_cursor
- Text.draw_search_bar
2022-07-12 16:20:20 -07:00
Kartik K. Agaram
92ad99853e
call edit rather than App callbacks in tests
2022-07-12 15:41:17 -07:00
Kartik K. Agaram
81ecca89ff
start passing in Editor_state explicitly
...
In this commit, top-level edit functions:
- edit.draw
- edit.update
- edit.quit
- edit.mouse_pressed
- edit.mouse_released
- edit.textinput
- edit.keychord_pressed
- edit.key_released
2022-07-12 15:33:06 -07:00
Kartik K. Agaram
e95b4fec12
initialize contains test state
2022-07-12 15:29:22 -07:00
Kartik K. Agaram
8bbc1ffe34
group all editor globals
...
We're still accessing them through a global. But we'll change that next.
2022-07-12 15:24:56 -07:00
Kartik K. Agaram
a5f725ab3b
bring couple more globals back to the app level
2022-07-12 13:45:38 -07:00
Kartik K. Agaram
094f3bd7e8
button framework is at the app level
2022-07-12 13:40:53 -07:00
Kartik K. Agaram
3850fbac35
make colors easier to edit
2022-07-11 23:18:26 -07:00
Kartik K. Agaram
2e3a85d94b
experiment: new edit namespace
...
Still lots to do, but the eventual hope is that this will make this
project's code easier to reuse from other LÖVE projects.
One gotcha: even as we start putting code more aggressively into nested
tables, tests must remain at the top-level. Otherwise they won't run.
2022-07-11 23:18:26 -07:00