Commit Graph

975 Commits

Author SHA1 Message Date
Kartik K. Agaram 6c6a7aab07 move 2022-07-25 15:25:22 -07:00
Kartik K. Agaram fe8e4fd9da simplify hysteresis logic 2022-07-25 15:23:01 -07:00
Kartik K. Agaram 3265abacb4 bugfix: skip over drawings when searching 2022-07-25 09:49:26 -07:00
Kartik K. Agaram 6f74f95a46 extract method 2022-07-23 23:36:04 -07:00
Kartik K. Agaram b7a67ab1e9 bugfix: online help
Broken in the commit before last.
2022-07-22 02:29:23 -07:00
Kartik K. Agaram 0251b3f0c2 bugfix: search
Broken since commit 188bbc73 9 days ago :/ At least we have a test for
it now.
2022-07-21 16:55:05 -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 e2734cd572 bugfix: where cursor is drawn
The published version of lines.love was broken for almost an hour. The
cursor would render one position to the right of where it really is. To
fix it, this commit rolls back 26ba6e4e5a. There doesn't seem a good
way to test it.
2022-07-20 09:11:29 -07:00
Kartik K. Agaram 192e16b42f reorg manual tests doc 2022-07-20 08:53:31 -07:00
Kartik K. Agaram 88013000fc . 2022-07-20 07:50:33 -07:00
Kartik K. Agaram 9f4b41d829 exclude left margin from my word-split heuristic
Gratifying how few tests need changing. Recent commits seem on the right
track.
2022-07-20 07:15:46 -07:00
Kartik K. Agaram a472d218f2 allow Text.nearest_pos_less_than to return 0
This eliminates another case of overflowing margins.
2022-07-20 07:08:28 -07:00
Kartik K. Agaram 7dc47edde8 drop an unnecessary level of indent 2022-07-20 07:03:33 -07:00
Kartik K. Agaram 39f71784c9 clean up some prints
(Looking at prints in Text.draw, Text.compute_fragments and
Text.nearest_pos_less_than)
2022-07-20 07:00:39 -07:00
Kartik K. Agaram b5451e4351 move a var closer to its use 2022-07-20 06:56:19 -07:00
Kartik K. Agaram d41301c1b7 more clearly skip prints before screen top 2022-07-20 06:54:03 -07:00
Kartik K. Agaram 26ba6e4e5a unify two similar functions
The cost is just having to tweak a few more brittle tests. I can't
actually perceive any difference in how the cursor moves when I click on
text.
2022-07-19 17:13:16 -07:00
Kartik K. Agaram efd4a8a883 keep text from overflowing right margin
I've been sloppy about this so far, and outside of tests I can't find
any examples where it matters, but it matters in a potential fork where
I'm rendering multiple columns of text.

It's unfortunate that my tests have this level of brittleness. What I'd
really like to assert in many of these changed lines is that the text
stays inside the margins and that more text would overflow margins.
2022-07-19 16:49:08 -07:00
Kartik K. Agaram cc5ab51c53 delete some duplicate initialization 2022-07-19 08:04:21 -07:00
Kartik K. Agaram 8abd986054 clean up a cross-test leakage 2022-07-19 07:50:53 -07:00
Kartik K. Agaram 82cdd9ddd1 bugfix: couple of margin-relative computations 2022-07-17 22:29:37 -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 4ff6de9951 switch to line index in a function
- Text.screen_line_width
2022-07-17 09:37:50 -07:00
Kartik K. Agaram 7e7f5b9256 switch to line index in a function
- Text.compute_fragments
2022-07-17 09:30:50 -07:00
Kartik K. Agaram 860cd49f67 make a function oblivious to line data structure
- Text.screen_line_index
2022-07-17 09:21:57 -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 6b3ddc816f switch to line index in a function
- Text.populate_screen_line_starting_pos
2022-07-17 09:14:10 -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 b95206fd0d drop some redundant args when clearing the cache 2022-07-17 08:18:48 -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 c26b377ab3 more decoupling editor tests from App 2022-07-16 08:33:05 -07:00
Kartik K. Agaram a2b654b534 more decoupling editor tests from App 2022-07-16 08:27:11 -07:00
Kartik K. Agaram 51b4efa59a more decoupling editor tests from App 2022-07-16 08:20:47 -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 fc6b602342 bugfix: zoom in/out hotkeys
Broken since commit 3b36093553 5 hours ago.
2022-07-13 23:31:52 -07:00
Kartik K. Agaram 119abbd52e bugfix: resize 2022-07-13 15:40:14 -07:00
Kartik K. Agaram e4f9d50a55 a more radical attempt at ignoring nil y's 2022-07-13 09:31:54 -07:00
Kartik K. Agaram d231f4d37d no, bring back that defense
Scenario where I ran into it:
  start a stroke inside a drawing
  press 'o' to switch to circle mode (but any mode switch will do)

The problem is that Text.textinput unconditionally blows away all .y
values. Sometimes we have to wait for a draw() to fill them back in.
2022-07-13 09:21:19 -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 6659de60f3 hoist couple of variables out
This seems to uncover a corner case I'd never run into until now.
2022-07-13 08:24:16 -07:00
Kartik K. Agaram 3b1f2cf9de use available variables 2022-07-13 08:19:58 -07:00
Kartik K. Agaram 5017659bf4 more idiomatic variable names 2022-07-13 08:19:06 -07:00
Kartik K. Agaram 457136a986 chunking by simple local variable 2022-07-13 08:14:01 -07:00