Commit Graph

38 Commits

Author SHA1 Message Date
Kartik K. Agaram 61b59f4dd6 Merge lines.love 2022-08-18 13:11:41 -07:00
Kartik K. Agaram 1d3c9f4708 generalize a function 2022-08-18 10:32:03 -07:00
Kartik K. Agaram 6d3c059964 Merge lines.love 2022-08-17 21:25:44 -07:00
Kartik K. Agaram 2381f7b43f simpler location comparison 2022-08-17 21:23:24 -07:00
Kartik K. Agaram f11c3f2a9b Merge lines.love 2022-08-17 09:17:00 -07:00
Kartik K. Agaram 1d710912cc swap return values 2022-08-17 09:10:52 -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 9d792a203b new fork: rip out drawing support 2022-08-14 09:20:14 -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 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 b95206fd0d drop some redundant args when clearing the cache 2022-07-17 08:18:48 -07:00
Kartik K. Agaram 2ae9cacd97 deduce left/right from state where possible 2022-07-12 20:59:24 -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 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 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 3850fbac35 make colors easier to edit 2022-07-11 23:18:26 -07:00
Kartik K. Agaram 3dccd7f81a stop pretending globals are local
One advantage of this approach: we don't end up with multiple lexical
scopes containing duplicates of the same modules.
2022-07-11 22:11:58 -07:00
Kartik K. Agaram 0106ad4b4f add args to some functions
- Text.pos_at_start_of_cursor_screen_line
2022-07-08 15:49:52 -07:00
Kartik K. Agaram abcc18002b add args to some functions
- Text.to_pos_on_line
2022-07-08 15:45:45 -07:00
Kartik K. Agaram 00c64ed6e4 add args to some functions
- Text.in_line
2022-07-08 15:37:09 -07:00
Kartik K. Agaram a27dd15c1f add args to some functions
- Text.clip_selection
  - Text.cut_selection
  - Text.delete_selection
  - Text.delete_selection_without_undo
  - Text.mouse_pos
  - Text.to_pos
2022-07-08 15:30:10 -07:00
Kartik K. Agaram 048b6d9d3a drop an arg from a function 2022-07-08 09:44:49 -07:00
Kartik K. Agaram 44fb3ecd55 bugfix: deleting a selection spanning pages 2022-06-26 16:34:06 -07:00
Kartik K. Agaram 009c7abb60 extract a function 2022-06-23 11:09:49 -07:00
Kartik K. Agaram 703ed905c1 bugfix: crash in Text.up() after return
Let's just make all the utf8.offset calculations more defensive.
2022-06-19 09:06:41 -07:00
Kartik K. Agaram c1d8201d44 mouse buttons are integers, not strings
Not sure where that idiom comes from or why strings work in some places
(auto-coercion?). I picked it up off some example apps. But
https://love2d.org/wiki/love.mouse.isDown says it should be an integer.
2022-06-14 09:05:02 -07:00
Kartik K. Agaram 059efba79d override mouse state lookups in tests
If I'd had this stuff in my test harness earlier, two recent commits
would have failed tests and given me early warning:
  ff88238ff1
  ff88a2a927
2022-06-12 09:04:21 -07:00
Kartik K. Agaram e4e12c77ad fix a second BSOD in #4 :/
I need more tests.
2022-06-12 07:20:14 -07:00
Kartik K. Agaram 4476eb8946 bugfix: cut (C-x) without first selecting anything 2022-06-09 18:27:09 -07:00
Kartik K. Agaram 4ad51d648b move 2022-06-09 07:29:38 -07:00
Kartik K. Agaram e77157d316 speeding up copy, attempt 1
Problem: repeatedly copying (relatively large) sections of text quickly
makes the app sluggish until it has to be killed. (Thanks John Blommers
for the report.)

When I instrument with prints, the sluggishness seems to happen in
random draw() calls many times after I perform the copy.

I don't know for sure, but I'm initially checking if the cause is
garbage generated by repeated string concatenation.

This attempt doesn't seem to make any difference.
2022-06-09 07:24:40 -07:00
Kartik K. Agaram e2696fcc72 more precise search highlighting 2022-06-03 14:37:32 -07:00
Kartik K. Agaram 1bdb931575 extract a function 2022-06-03 14:30:51 -07:00
Kartik K. Agaram 0d52962b3e extract a couple of files 2022-06-03 14:17:41 -07:00