18 Commits

Author SHA1 Message Date
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
86322db991 terminal: point coord y needs to be a larger int
See comment.
2024-06-03 14:25:37 -07:00
Mitchell Hashimoto
3f16234f72 terminal: Coordinate uses CellCountInt 2024-04-26 20:52:08 -07:00
Mitchell Hashimoto
21f09a9159 remove point.Viewport 2024-03-22 20:27:52 -07:00
Mitchell Hashimoto
d966e74f45 core: surface compiles 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
b573ff137a terminal: resize cols should treat old cursor pos as active point
Fixes #1159

The cursor position is an "active" coordinate (defined at the top of
Screen.zig), but our resize was treating it as a "viewport" coordinate.
2023-12-26 13:59:22 -08:00
Mitchell Hashimoto
af6cc66369 core: Fix various double-click word selection bugs
Fixes #741

This completely reimplements double-click-and-drag logic for selecting
by word. The previous implementation was horribly broken. See #741 for
all the details.

The implemented logic now is:

* A double-click initiates a select-by-word selection mechanism.
  - A double-click may start on a word or whitespace
  - If the initial double-click is on a word, that word is immediately selected.
  - If the initial double-click is on whitespace, the whitespace is not selected.
* A "word" is determined by a non-boundary character meeting a boundary character.
  - A boundary character is `NUL` ` ` (space) `\t` `'` `"`
  - This list is somewhat arbitrary to make the terminal "feel" good.
  - Cell SGR states (fg/bg, bold, italic, etc.) have no effect on boundary determination or selection logic.
* As the user drags _on the same line_:
  - No selection change occurs until the cursor is over a new word. Whitespace change does nothing.
  - When selection is over a new word, that entire word added to the selection.
* When the user drags _up_ one or more lines:
  - If the cursor is over whitespace, all lines from the selection point up to but not including the cursor line are selected.
    * This selection is done in accordance to the previous rules.
  - If the cursor is over a word, the word becomes the beginning of the selection.
  - The end of the selection in all cases is the first word at or before the initial double-click point.
* When the user drags _down_ one or more lines:
  - The same logic as _up_ but swap the "beginning" and "end" of selection terminology.
* With this logic, the behavior of Ghostty has the following invariants:
  - Whitespace is never selected unless it is between two selected words
  - Selection implies at least one word is highlighted
  - The initial double-click point marks the beginning or end of a selection, never the middle.
2023-11-11 22:45:31 -08:00
Mitchell Hashimoto
36c9d607b2 core: do not send repeat mouse events if cell didn't change 2023-09-17 11:49:25 -07:00
Mitchell Hashimoto
de66d4925a terminal: rename scroll "delta/delta_no_grow" to screen/viewport 2023-07-08 13:47:16 -07: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
d6e243cde1 resize with reflow more cols 2022-09-03 17:28:26 -07:00
Mitchell Hashimoto
41f2b756ae fix scrolling and new row calculation 2022-09-03 12:18:45 -07:00
Mitchell Hashimoto
77c8ec0a20 the big screen switchover 2022-09-01 00:58:47 -07:00
Mitchell Hashimoto
bfbeceeefa when cols grow, move cursor if it unwraps the line it is on 2022-08-08 13:47:49 -07:00
Mitchell Hashimoto
0855d391a8 fix selection of a single character
This logic is truly terrible and I know for certain there is an easier
way to calculate this. I also know there are some bugs here. But, the
user-facing result is not bad so let's start with this.
2022-08-04 16:53:10 -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