Kartik K. Agaram
9bbfc2be13
crisp font rendering
2022-06-02 23:36:07 -07:00
Kartik K. Agaram
b94b007db5
find text
2022-06-02 22:53:34 -07:00
Kartik K. Agaram
9121a263a6
.
2022-06-02 19:08:06 -07:00
Kartik K. Agaram
22817492a3
rename
2022-06-02 16:44:18 -07:00
Kartik K. Agaram
b4e76eac4e
bugfix: undo drawing creation
...
Also clean up drawing state to make sure we don't get into hard-to-debug
situations.
2022-06-02 15:51:44 -07:00
Kartik K. Agaram
670886240f
after much struggle, a brute-force undo
...
Incredibly inefficient, but I don't yet know how to efficiently encode
undo mutations that can span multiple lines.
There seems to be one bug related to creating new drawings; they're not
spawning events and undoing past drawing creation has some weird
artifacts. Redo seems to consistently work, though.
2022-06-02 15:45:25 -07:00
Kartik K. Agaram
5b95e51c36
.
2022-05-29 16:34:36 -07:00
Kartik K. Agaram
23e9be3e10
selecting text and deleting selections
...
I've written a few tests for delete_selection, but the way different
operations initialize the selection seems fairly standard and not worth
testing so far.
2022-05-29 08:12:47 -07:00
Kartik K. Agaram
2b69b71c7a
update some documentation
2022-05-29 07:56:55 -07:00
Kartik K. Agaram
86532eef4b
move some code
...
I had this idea originally to keep text.lua oblivious to drawings.
But that hasn't been true for some time. Losing battle.
2022-05-28 22:45:08 -07:00
Kartik K. Agaram
229e1514f2
.
2022-05-27 23:35:01 -07:00
Kartik K. Agaram
815c4f010a
assert for a bug I saw a while ago but can no longer reproduce
...
I saw screen_top not at start of screen line, but at cursor location in
middle of line.
2022-05-25 15:00:13 -07:00
Kartik K. Agaram
442133fe7f
no, make sure to compute line width after screen dimensions
2022-05-25 13:35:32 -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
e581a2b7d1
get rid of debug variables
2022-05-23 23:00:07 -07:00
Kartik K. Agaram
8d5ac5da75
keep one screen line of overlap on pagedown
...
I'm now extracting the concern of computing
line.screen_line_starting_pos out of Text.draw. Earlier
I had to make sure I ran through the whole line to compute
screen_line_starting_pos, but that had the side-effect of updating
Screen_bottom1.pos as well with lines that had never been rendered.
In this process I hit my first bug due to an accidental global. It
doesn't show up in the patch because I accidentally deleted a local
declaration. (I thought I didn't need screen_line_starting_pos anymore,
deleted everywhere, then brought it back everywhere from the bottom of
the function up, but forgot to put back the very first occurrence.)
The amount of yoyoing this caused between App.draw and Text.draw, I very
much have spaghetti on my hands.
Accidental globals are _terrible_ in a program with tests. Cross test
contamination X-(
2022-05-23 22:51:52 -07:00
Kartik K. Agaram
b3251b23b5
a few tests for pageup, and a bugfix
...
It wasn't screen-line aware. Now it is.
2022-05-23 20:57:56 -07:00
Kartik K. Agaram
6b10c94dd5
disable all debug prints
2022-05-23 15:38:42 -07:00
Kartik K. Agaram
254ae7ad99
.
2022-05-23 13:18:34 -07:00
Kartik K. Agaram
e0b2c2dede
couple of tests for cursor down
2022-05-23 10:56:39 -07:00
Kartik K. Agaram
4f6a324975
bugfix: don't rely on Screen_bottom1 while scrolling
...
Setting up the test just right to test the thing I want to test was a
rube goldberg machine of constants.
2022-05-23 08:52:13 -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
8aa72be226
fold variables for screen dimensions into the app framework
2022-05-22 18:45:21 -07:00
Kartik K. Agaram
f421e1daa5
basic test-enabled framework
...
Tests still have a lot of side-effects on the real screen. We'll
gradually clean those up.
2022-05-22 18:29:52 -07:00
Kartik K. Agaram
555726a87d
rename
2022-05-22 18:23:04 -07:00
Kartik K. Agaram
ac74592c42
beginnings of a test harness
...
I have no fucking idea what I'm doing. All I know is that there's still
too many goddamn bugs[1]. Test motherfucking harness or bust. For
starters this is just the default love.run from
https://love2d.org/wiki/love.run
[1] The following file crashes if you repeatedly press cursor-down:
<<
a
b
c
```lines
```
x
>>
2022-05-22 10:40:34 -07:00
Kartik K. Agaram
84898ed43a
bugfix: printing the first part of a line at the bottom made it seem non-wrapping
...
Still lots wrong here.
2022-05-21 22:32:43 -07:00
Kartik K. Agaram
1e63bf0e0a
I feel confident now that page-down is working.
2022-05-21 20:52:44 -07:00
Kartik K. Agaram
c0df6f86a4
beginning of a new approach to scroll+wrap
...
So far I've just changed how existing variables are organized, and put
some scaffolding in place for dealing with the new types. Next up:
rewriting the code for scrolling to something that feels more obviously
correct.
2022-05-21 16:42:22 -07:00
Kartik K. Agaram
9a18b09de3
bugfix: escape key to hide online help
2022-05-21 14:22:34 -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
e420245ee3
keep cursor on screen when pressing 'down'
2022-05-20 22:18:39 -07:00
Kartik K. Agaram
a3f72abbde
reduce ambitions a bit: page up/down need not start screen from the middle of a line
...
But we still have work to do for cursor up/down.
2022-05-20 21:30:59 -07:00
Kartik K. Agaram
5d139f4327
ensure Filename is writable when opened outside a terminal
...
Thanks Jimmy Miller for reporting this.
2022-05-20 20:11:00 -07:00
Kartik K. Agaram
c28f6ba031
snapshot - no, that's all wrong
...
I've been only thinking about up arrow when cursor is at top of screen.
Hopefully this is better.
2022-05-20 16:56:04 -07:00
Kartik K. Agaram
3ec8019cc0
new globals: draw partial screen line up top
...
I'm not setting these yet. Rendering seems to be working after manually
setting them.
2022-05-20 06:58:17 -07:00
Kartik K. Agaram
1573dd8425
start using some globals
2022-05-20 06:10:04 -07:00
Kartik K. Agaram
05ac4a5057
move
2022-05-20 06:00:20 -07:00
Kartik K. Agaram
7fd3c92efe
start remembering where the cursor is drawn in px
...
We'll start using this in cursor up/down motions.
2022-05-20 05:41:25 -07:00
Kartik K. Agaram
5f2ef2faaf
extract a function
2022-05-20 05:40:42 -07:00
Kartik K. Agaram
e2b371ea37
bugfix: text past cursor was rendered red on wrapped lines
2022-05-19 22:41:03 -07:00
Kartik K. Agaram
7749e459a7
change text cursor shape
2022-05-19 22:34:28 -07:00
Kartik K. Agaram
d4daac442b
clicking now moves the cursor even on long, wrapped lines
2022-05-19 22:07:12 -07:00
Kartik K. Agaram
6e89f6c63f
make text and drawings the same width
2022-05-19 22:02:18 -07:00
Kartik K. Agaram
c9e69530a0
comment
2022-05-19 21:59:56 -07:00
Kartik K. Agaram
f7ff4dc9c2
eliminate assumptions that line length == size in bytes
2022-05-19 17:46:02 -07:00
Kartik K. Agaram
a9398e499b
snapshot: wrapping long lines at word boundaries
...
Still not working:
clicking on text to move the cursor aborts
up/down motions still move by logical lines rather than screen lines
2022-05-19 17:29:14 -07:00
Kartik K. Agaram
21f166689a
a few more integer coordinates
2022-05-19 16:35:52 -07:00
Kartik K. Agaram
58169561b7
this is a bit clearer
2022-05-19 08:23:25 -07:00
Kartik K. Agaram
6a5864e382
redo y computations
2022-05-19 05:52:16 -07:00
Kartik K. Agaram
f144bdfc20
simpler
2022-05-19 05:50:33 -07:00
Kartik K. Agaram
35d14c8aff
delete another arg that can be deduced
2022-05-19 05:44:57 -07:00
Kartik K. Agaram
d482694a2a
delete unused arg
2022-05-19 05:41:12 -07:00
Kartik K. Agaram
18bb4624b3
ensure integer coordinates
...
https://love2d.org/wiki/Text says text can appear blurry otherwise.
I can't tell yet, though.
2022-05-19 04:28:08 -07:00
Kartik K. Agaram
ec410d5223
bugfix: ensure Cursor_line is always on a text line
...
Manual test used here:
abc
```lines
{"p1":{"y":72,"x":82},"mode":"line","p2":{"y":29,"x":169}}
```
def
```lines
{"p1":{"y":36,"x":56},"mode":"line","p2":{"y":59,"x":163}}
```
```lines
```
ghi
jkl
Hitting page-down moves the cursor from abc to ghi. The 'ghi' line
should be fully visible on screen.
2022-05-18 18:19:27 -07:00
Kartik K. Agaram
b586c7332e
bugfix: position cursor up top when loading file
2022-05-18 18:18:34 -07:00
Kartik K. Agaram
f91e520124
scroll past first page
...
Still some limitations. The text cursor has to be visible on screen, so
if you have a long series of drawings without intervening lines of text
you won't be able to scroll through them all.
2022-05-18 17:42:08 -07:00
Kartik K. Agaram
dc618a419c
highlight another global
2022-05-17 23:24:46 -07:00
Kartik K. Agaram
b544e8c357
forgot to move this special case out
2022-05-17 23:23:26 -07:00
Kartik K. Agaram
6e152a9f3f
.
2022-05-17 23:18:56 -07:00
Kartik K. Agaram
c1ba40ac70
delegate update events to drawings
2022-05-17 23:16:08 -07:00
Kartik K. Agaram
10bc32e2f0
DRY some code
2022-05-17 23:10:58 -07:00
Kartik K. Agaram
4818672c11
move mouse_released events to Drawing
2022-05-17 22:55:45 -07:00
Kartik K. Agaram
92bd6839c7
split mouse_pressed events between Text and Drawing
2022-05-17 22:53:09 -07:00
Kartik K. Agaram
222a11a8dd
split keyboard handling between Text and Drawing
2022-05-17 22:43:41 -07:00
Kartik K. Agaram
82742330f8
autosave in a couple more places
2022-05-17 22:26:15 -07:00
Kartik K. Agaram
23176de0e0
assume we always have a filename
2022-05-17 22:24:41 -07:00
Kartik K. Agaram
2241f33a8f
.
2022-05-17 22:23:15 -07:00
Kartik K. Agaram
dcfa2d04ca
bugfix: duplicate character on enter
2022-05-17 22:22:45 -07:00
Kartik K. Agaram
9a42128eb4
jump between lines on left/right
...
Also skip past drawings.
2022-05-17 22:12:08 -07:00
Kartik K. Agaram
6c031fc1d0
split lines on enter
2022-05-17 22:05:46 -07:00
Kartik K. Agaram
a787ef1716
rename
2022-05-17 22:05:21 -07:00
Kartik K. Agaram
61845c335b
.
2022-05-17 22:05:00 -07:00
Kartik K. Agaram
319617141b
join lines on delete
2022-05-17 21:59:48 -07:00
Kartik K. Agaram
e1bc81408f
move
2022-05-17 21:55:19 -07:00
Kartik K. Agaram
8d2f81948a
enable pressing and holding backspace
2022-05-17 21:37:39 -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
Kartik K. Agaram
91ce333ae0
bugfix typo
2022-05-17 20:52:00 -07:00
Kartik K. Agaram
476bbcdadf
beginnings of a module for the text editor
2022-05-17 20:29:08 -07:00
Kartik K. Agaram
40b1780bca
longer names for indices in long loops
2022-05-17 19:48:12 -07:00
Kartik K. Agaram
2aa8c67a22
extract a module
...
I want to use `drawing` for locals, so I'll use uppercase the module
name just like globals.
2022-05-17 19:41:42 -07:00
Kartik K. Agaram
9ade4d2782
finish uppercasing all globals
2022-05-17 19:38:33 -07:00
Kartik K. Agaram
45eee7ad49
start uppercasing globals
...
We're starting to have a few. Text editing is surprisingly more complex than drawing.
2022-05-17 19:27:54 -07:00
Kartik K. Agaram
cfdd563499
let's prevent the text cursor from ever getting on a drawing
2022-05-17 19:18:23 -07:00
Kartik K. Agaram
359056eb7e
bugfix typo
2022-05-17 18:58:42 -07:00
Kartik K. Agaram
12681b6307
start imposing some organization
2022-05-17 18:57:47 -07:00
Kartik K. Agaram
76efb63671
much better help color and copy
2022-05-17 18:55:26 -07:00
Kartik K. Agaram
0999ae9929
bit more polish to help screen
...
Still looks like ass.
2022-05-17 08:18:55 -07:00
Kartik K. Agaram
0b252a4ab7
reset zoom
2022-05-17 08:12:09 -07:00
Kartik K. Agaram
8446ec0fbb
respect zoom when drawing drawings
2022-05-16 23:06:44 -07:00
Kartik K. Agaram
2194b388f8
respect zoom when printing online help
2022-05-16 23:04:39 -07:00
Kartik K. Agaram
680999087b
ctrl-+ and ctrl-- to adjust font size
2022-05-16 23:01:21 -07:00
Kartik K. Agaram
643e55309e
reorg
2022-05-16 22:54:44 -07:00
Kartik K. Agaram
8e074b0a93
more precise cursor positioning
2022-05-16 22:50:52 -07:00
Kartik K. Agaram
e2d4edb4d8
position cursor by clicking on text
...
In the process, a bugfix: up/down from line to drawing or vice versa.
2022-05-16 22:42:54 -07:00
Kartik K. Agaram
97531d9d05
allow text to be typed while mouse hovers over drawing
...
The whole point of my keyboard shortcuts scheme is that if you press a
regular key and the mouse is not down, it goes in at the cursor.
2022-05-16 22:30:53 -07:00
Kartik K. Agaram
04dc87482d
save each line's y coordinate, whether it's a drawing or not
2022-05-16 22:29:05 -07:00
Kartik K. Agaram
3a9f02c9f2
move
2022-05-16 22:28:34 -07:00
Kartik K. Agaram
2ea683f4f2
stop handling drawings in cursor_pos computations
2022-05-16 22:24:24 -07:00
Kartik K. Agaram
3af32571a5
change data model; text can now have metadata
2022-05-16 22:23:24 -07:00