28 Commits

Author SHA1 Message Date
Mitchell Hashimoto
3f16234f72 terminal: Coordinate uses CellCountInt 2024-04-26 20:52:08 -07:00
Mitchell Hashimoto
522c28207e terminal: remove TODO 2024-03-22 20:28:01 -07:00
Mitchell Hashimoto
a3509f32a9 terminal: selection should use pin iterators 2024-03-22 20:28:01 -07:00
Mitchell Hashimoto
347c57f061 terminal: Selection.containedRow 2024-03-22 20:28:00 -07:00
Mitchell Hashimoto
33e59707e2 terminal: Screen can hold selection 2024-03-22 20:27:44 -07:00
Mitchell Hashimoto
9b4ab0e209 zig build test with renamed terminal package 2024-03-22 20:27:44 -07:00
Mitchell Hashimoto
9f78ec597a terminal2: contains selection 2024-03-22 20:27:39 -07:00
Mitchell Hashimoto
0b3c502268 terminal2: Selection.ordered 2024-03-22 20:27:39 -07:00
Mitchell Hashimoto
5fc4a9c8e3 terminal2: selection topLeft/bottomRight 2024-03-22 20:27:39 -07:00
Mitchell Hashimoto
5c04ebe3bd terminal2: adjust down edges 2024-03-22 20:27:38 -07:00
Mitchell Hashimoto
a303b7628e terminal2: adjust down 2024-03-22 20:27:38 -07:00
Mitchell Hashimoto
8194cb7edb terminal2: sel adjust left 2024-03-22 20:27:38 -07:00
Mitchell Hashimoto
0f5841baca terminal2: start Selection 2024-03-22 20:27:37 -07:00
Chris Marchesi
1b8b59538c Selection: don't alter x position when rectangle select is off viewport
This ensures that the start or end x values do not get adjusted when
they are off the viewport in rectangle select.

This also includes some tests for the toViewport method.

Fixes #1339.
2024-01-21 19:38:25 -08:00
Mitchell Hashimoto
50a119d300 Selection: add adjust method, unit test it, swap for adjustments 2024-01-11 22:14:40 -08:00
Chris Marchesi
aeaf5ea467 Surface: fix some rectangle select behaviors
This fixes a couple of subtle rectangle select behaviors:

* Corrects how selection rolls over when crossing the x-boundary; this
  was mentioned in #1021, this properly corrects it so both sides of the
  x-boundary do not share characters.

* Corrects a minor quirk in the selection of initial cells in a
  selection - this can be more readily observed when selecting a single
  line with rectangle select. To correct this, we only use the x axis
  when calculating this instead of both x and y.
2023-12-13 10:51:17 -08:00
Chris Marchesi
df142e08ad Selection: fix bottom-right/top-left rectangle selections
This fixes an issue where selections from the bottom-right to the
top-left (or top-left to bottom-right), in addition to some single-line
rectangle selections, were not working.

This works by handling situations where only one of the x or y
axes in the start or end points may need to be flipped to get the
correct top-left or bottom-right of a selection. We call these kinds of
orientations "mirrored", like you were looking in a mirror.

This also adds a small bit of logic that keeps these kinds of motions in
rectangle selection from selecting the character before or after it.
This has the current side-effect of anchoring a rectangle selection to
the original characters if you change directions during the selection,
something I will look at in a later commit.

Finally, this also removes rectangle select on double-click. I thought
this might be a good idea, but word select in rectangle mode really
does not work (the effect seems pretty erratic), and it's not
implemented in Kitty either.

Fixes #1008.
2023-12-07 23:51:37 -08:00
Chris Marchesi
b84fb25e55 Add rectangle select
This adds rectangle select mode; when dragging with ctrl+alt (or
super+alt on MacOS), this allows you to select a rectangular region of
the terminal instead of the full start-end points of the buffer.
2023-11-30 12:35:52 -08:00
Mitchell Hashimoto
d856aba84c selection toViewport point should extend to end of last row
Fixes #138
2023-03-28 09:30:47 -07:00
Mitchell Hashimoto
2be4eb0da7 font/shaper: split runs at selection boundaries 2023-03-23 10:24:22 -07:00
Mitchell Hashimoto
d4cbe88c98 selection: containedRow for getting the row that contains a screen point 2023-03-23 10:01:09 -07:00
Mitchell Hashimoto
bf699dd381 terminal: selection within logic is more correct, better tested
Fixes #108
2023-03-21 19:55:56 -07:00
Mitchell Hashimoto
70236ebc33 terminal: screen scroll with full scrollback modifies selection 2023-03-21 10:59:44 -07:00
Mitchell Hashimoto
d213c1a939 fix selection regression caused by screen copy optimization 2022-11-20 20:05:07 -08:00
Mitchell Hashimoto
c68c487e14 Make selection part of the cache key for GPU cells
If the selection state changes for a given row, the row must be
invalidated.
2022-09-14 19:58:36 -07:00
Mitchell Hashimoto
68260cc3d0 fix some selection contains logic on single lines 2022-08-04 14:40:28 -07:00
Mitchell Hashimoto
974138378b introducing dedicated point types 2022-08-04 13:04:42 -07:00
Mitchell Hashimoto
8facf9b942 terminal: add Selection struct 2022-08-04 11:44:36 -07:00