Commit Graph

1145 Commits

Author SHA1 Message Date
Kartik K. Agaram da250585c0 disable some debug prints
I'm still very much in the region where this is valuable sensor data.
This is a new domain.
2022-05-20 22:46:32 -07:00
Kartik K. Agaram 0773b986dd more precise height calculation when scrolling up as much as possible while keeping cursor on screen 2022-05-20 22:45:49 -07:00
Kartik K. Agaram e420245ee3 keep cursor on screen when pressing 'down' 2022-05-20 22:18:39 -07:00
Kartik K. Agaram e3dc4c330b rename 2022-05-20 22:17:47 -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 6b91c0688e first stab at equally hacky cursor down support 2022-05-20 20:33:30 -07:00
Kartik K. Agaram ec5706e1ea stop recomputing Cursor_x now that we're saving it 2022-05-20 20:32:55 -07:00
Kartik K. Agaram e223df41bc clearer comments 2022-05-20 20:32:00 -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 7d9125b0b0 some more logging
Still lots of signs it's all messed up, but I can't be sure until I
bring all the other keyboard shortcuts in sync.

I just need a better data structure that simplifies the logic. Perhaps
talk in terms of screen lines. In which case:
  We'll need to convert lines to screen lines at some point.
  We'll need to fix up screen lines when inserting and deleting
  characters.
2022-05-20 18:16:13 -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 ce94f8bf79 another piece of support for line wrapping in cursor up 2022-05-20 15:19:43 -07:00
Kartik K. Agaram 7e6705a113 first stab at supporting wrapping in cursor up
Looks pretty clean.
2022-05-20 08:55:45 -07:00
Kartik K. Agaram 1c20d514f2 bugfix
I'd wrapped currx in two conditionals, and not noticed that it gets
reclaimed within the other.

The hint is clearly more work than it's worth. Just take it out.
2022-05-20 08:02:03 -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 bca0c1fab9 bugfix 2022-05-20 05:44:04 -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 e223182ad5 move 2022-05-19 22:58:04 -07:00
Kartik K. Agaram d622043284 planning out cursor up/down over wrapped lines 2022-05-19 22:56:55 -07:00
Kartik K. Agaram a7c7fd6bce bugfix: cursor past end of screen line 2022-05-19 22:41:24 -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 2f8d727c0b bugfix: show cursor when past end of line 2022-05-19 22:35:26 -07:00
Kartik K. Agaram 7749e459a7 change text cursor shape 2022-05-19 22:34:28 -07:00
Kartik K. Agaram 8f85b29893 clicking to the right of a wrapped line 2022-05-19 22:26:15 -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 4fb4e0eb25 rename 2022-05-19 22:02:49 -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 839d2df3ea bugfix
As usual, binary search is hard to get right. This time I was never
actually selecting between left and right when they were just one
character apart.
2022-05-19 21:53:08 -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 76dbb4bd1e drop unused arg 2022-05-19 08:17:34 -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 f69e17d350 another integer coordinate 2022-05-19 05:49:32 -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 b63a33dd06 handle tab characters 2022-05-18 20:22:57 -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 e27165cb9f rectangle and square shapes 2022-05-18 15:29:18 -07:00
Kartik K. Agaram 28c29eecde lighter color for in-progress strokes 2022-05-18 13:09:06 -07:00
Kartik K. Agaram d0eeb8586f use the provided args everywhere
This will be important when we implement scrolling..
2022-05-18 07:38:02 -07:00