Commit graph

1061 commits

Author SHA1 Message Date
Cookie
feabb748ec
calendar: Fixed cross year name and multi month linkage click issues (#1241)
<img width="864" height="298" alt="image"
src="https://github.com/user-attachments/assets/7f0a34d7-e000-4756-b1ae-0e6511679660"
/>
2025-09-12 10:29:07 +08:00
Jason Lee
da85754b96
input: Refactor diagnostics. (#1240)
<img width="613" height="530" alt="image"
src="https://github.com/user-attachments/assets/be86658d-706c-411c-8ba6-09b495208051"
/>

## Break Changes

- The `Markers` has been renamed to use `Diagnostics`.
- The `input::LineNumber` has renamed to `input::Position` and changed
from 1-based to use 0-based.
- Renamed `go_to_line` to `set_cursor_position`, `line_column` to
`cursor_position`.

```diff
- pub fn line_column(&self) -> LineColumn
+ pub fn cursor_position(&self) -> Position

- pub fn go_to_line(&mut self, line: usize, column: Option<usize>, window: &mut Window, cx: &mut Context<Self>)
+ pub fn set_cursor_position(&mut self, position: impl Into<Position>, window: &mut Window, cx: &mut Context<Self>)
```
2025-09-11 16:54:40 +08:00
Jason Lee
3fa996c331
input: Fix line column by use chars offset. (#1239)
- Add autocorrect to markdown example for test `markers`.

<img width="1104" height="590" alt="image"
src="https://github.com/user-attachments/assets/03103088-e828-4039-82b0-c816d5f36141"
/>
2025-09-10 20:56:15 +08:00
Jason Lee
2a918bf4de
input: Improve TextWrapper data structure. (#1237) 2025-09-10 18:52:35 +08:00
Jason Lee
db5ba1e04c
input: Fix horizontal scroll to match the longest line width. (#1238)
Close #1234
2025-09-10 18:17:15 +08:00
Jason Lee
5beaed2a9e
input: Pause blink and keep show cursor on moving or editing. (#1236)
https://github.com/user-attachments/assets/751d0b62-18f9-41c8-80a0-e11439e3b91e
2025-09-10 14:49:14 +08:00
Jason Lee
43c848893c
input: Refactor start_of_line, end_of_line by use Rope. (#1232)
- Removed `Cursor` struct, now use `usize` for selection offset.
2025-09-10 14:43:11 +08:00
Jason Lee
844574befc
input: Fix track scroll to selected end on drag move. (#1231) 2025-09-10 13:59:02 +08:00
Jason Lee
7998d64501
highlighter: Improve Syntax Highlighter performance. (#1230)
Now can support up to 50K lines with code highlight.


https://github.com/user-attachments/assets/3bbba2cd-ea56-4778-b471-6beea323fbaa

----

Ref Links

- https://zed.dev/blog/syntax-aware-editing
2025-09-10 00:11:53 +08:00
Floyd Wang
ab98e53a5a
plot(tooltip): Fix the dots not centered (#1229) 2025-09-09 18:01:01 +08:00
Floyd Wang
51caf932db
plot(tooltip): Add support for custom appearance (#1226) 2025-09-09 14:47:07 +08:00
Jason Lee
03c2327cdb
input: Improve Input performance by only shape visible lines. (#1222)
Close #1193

Ref issue #1220 

This PR aim to shape text in visible ranges to reduce `shape_text` time
for large document case.

- Fix rendering might be delayed and cause blanks when scrolling to
follow the selection.
- Fix `RopeExt::lines` method to avoid call `line` method on skipped
iter.
2025-09-09 14:41:52 +08:00
Floyd Wang
84b2d2a6f5
plot(scale): Add least index support for linear (#1225) 2025-09-09 11:40:09 +08:00
Jason Lee
d71a32d0e4
input: Fix move to to skip \r on Windows. (#1223)
This PR for continue #1214 to fix move cursor to ignore` `\r` for
Windows.
2025-09-09 09:40:07 +08:00
Jason Lee
a9953a9349
input: Use zed's Rope (#1214)
Now with 10K lines plain text, in release mode on macOS. The
`large-text` example can work with:

- 120 FPS for display.
- 90 FPS for update text.

```
MTL_HUD_ENABLED=1 cargo run --example large-text --release
```

- Fixed the cursor position at end of line, also support at start of
line.


https://github.com/user-attachments/assets/1de52f6c-e138-4ed3-a600-06372a807ed8

### Check list

- [x] Modifying Text with Rope
- [x] LineColumn, GoToLine
- [x] Code Highlight
- [x] Delete word, select word
- [x] Delete line
- [x] Move left, right, up, down
2025-09-08 16:44:52 +08:00
Jason Lee
a9e6b49a15
highlighter: Fix #1204 changes cause to incorrect highlight result. (#1218)
This PR for fix some incorrect changes in #1204 

## Before

<img width="854" height="864" alt="image"
src="https://github.com/user-attachments/assets/eebd07e5-3437-444d-a55d-2941228e3b08"
/>

## After

<img width="954" height="962" alt="image"
src="https://github.com/user-attachments/assets/60761848-8d4f-4fe9-88b9-f0b0f0985d2f"
/>
<img width="1515" height="867" alt="image"
src="https://github.com/user-attachments/assets/3d4654a7-f977-4919-9c9e-f013fcdd8fde"
/>
2025-09-08 16:14:07 +08:00
Floyd Wang
78dccd4d79
plot: Apply linear scale based on the direction of given range (#1219)
## Breaking Change
- Apply linear scale based on the direction of given range.

```diff
- ScaleLinear::new(vec![1., 2., 3.], vec![0., 100.])
+ ScaleLinear::new(vec![1., 2., 3.], vec![100., 0.])
```

Currently, you can draw the linear scale from minimum to maximum or from
maximum to minimum; it depends on the direction of the range.
2025-09-08 15:56:58 +08:00
Floyd Wang
5e302866ce
inspector: Improve UI details (#1217) 2025-09-08 13:29:54 +08:00
Floyd Wang
00dd457441
drawer: Ensure the drawer’s height matches the application (#1216) 2025-09-08 10:36:13 +08:00
Jason Lee
f35398d797
input: Fix some Rope method call will crash. (#1213) 2025-09-05 19:09:46 +08:00
Jason Lee
cfc2449820
input: Fix column position update when text added, to support move vertical keep column. (#1211)
Refactor this logic by use Rope line, column.
2025-09-05 18:47:24 +08:00
Jason Lee
344e4407ff
input: Use Rope for InputState. (#1208)
This PR to change the Input to use
[ropey](https://github.com/cessen/ropey) to store the text.

## Break Changes

- The `value` method of `InputState` now returns a `SharedString` type.

```diff
- pub fn value(&self) -> &SharedString
+ pub fn value(&self) -> SharedString
```

Ref links:

- https://github.com/cessen/ropey
- https://zed.dev/blog/zed-decoded-rope-sumtree
- https://github.com/helix-editor/helix/blob/master/docs/architecture.md
2025-09-05 18:20:47 +08:00
Floyd Wang
19be9b8d96
inspector: Trim the diagnostic error at the end (#1210) 2025-09-05 15:21:25 +08:00
Chuqiao Feng
c6f6a9bb09
inspector: Fix Rust parser of inspector. (#1209)
This PR aims to fix a bug of the Rust parser in my last PR #1205.
2025-09-05 15:08:05 +08:00
Chuqiao Feng
8992852165
inspector: Add live editor to inspector (#1205)
Inspired by Zed, this PR implements a simple live Rust and JSON style
editor for the inspector.

The rust style editor only supports `Styled` and `StyledExt` method
calls with no arguments.




https://github.com/user-attachments/assets/df7f1746-92d7-416c-afd5-e389ac3ea9ae

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-09-05 11:58:36 +08:00
Jason Lee
16f9380a63
highlighter: Fix some tokens were highlighted incorrectly (#1204)
Continue #1198

## Before

<img width="1322" height="1043" alt="image"
src="https://github.com/user-attachments/assets/85bedde2-cb24-4eed-be9c-64b7d5627f7c"
/>

## After

<img width="1056" height="1098" alt="image"
src="https://github.com/user-attachments/assets/2b65bd45-c24d-425e-b4ec-0e4408a3f6a4"
/>
2025-09-05 11:21:06 +08:00
Jason Lee
ee40f65fb5
markdown: Add to support LinkReference and Footnote. (#1201) 2025-09-03 16:39:17 +08:00
Jason Lee
2cfb5d24a9
highlighter: Use sum_tree to store the highlight cache. (#1198) 2025-09-03 14:09:46 +08:00
Jason Lee
189bd6e9a3
highlighter: Fix some editing operatons might result incorrect hightlight. (#1197)
This PR just removed the partial update highlight cache code. This logic
will get incorrect offset.

To make sure highlight correct first.

Remove this will slow down performance (On editing), when is more than
5K lines, but if less than this the performance can accept.
2025-09-02 18:52:02 +08:00
Jason Lee
02b432ed17
scrollbar: Fix scrollbar width on always show mode. (#1196)
And fixes #1192 render bug.
2025-09-02 15:48:06 +08:00
Jason Lee
6569bead8b
input: Fix horizontal scrolling offset. (#1191)
Continue #1131 to fix some scroll offset details.

- Keep line number at left.
- Show scrollbar next the line_numbers right side.
- Fix scroll_size calculate issue that will always show vertical
scrollbar, even not have enough contents.

<img width="888" height="641" alt="image"
src="https://github.com/user-attachments/assets/5d388377-3f6d-4530-b837-6c719e1eb48f"
/>
2025-09-02 14:46:28 +08:00
iincity
ca548bd856
input: Add to support horizontal scrolling to multi-line text. (#1131)
- Add `soft_wrap` option to build InputState, default true.

<img width="1156" height="1166" alt="image"
src="https://github.com/user-attachments/assets/2eab2db0-b3fc-48ce-83cb-1d6715313247"
/>

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-09-01 12:33:21 +08:00
Jason Lee
34d2a75894
theme: Add theme_name to get current active theme name. (#1190)
And fix theme menu selected item in example when theme mode changed.
2025-09-01 11:39:01 +08:00
Jason Lee
785df6a5ff
chore: Remove SvgImg element. (#1187)
## Break Change

- The `SvgImg` element has been removed.
This is a special implementation and should not be included in the GPUI
Component.
2025-08-29 17:37:11 +08:00
Floyd Wang
7fb6000189
plot(scale): Correct the least index (#1186) 2025-08-29 16:42:59 +08:00
Floyd Wang
1267857a8c
plot(scale): Point scale support single point (#1185)
<img width="447" height="446" alt="image"
src="https://github.com/user-attachments/assets/fff44252-ff5b-4d73-8b98-0eb4c0877563"
/>
2025-08-29 15:05:51 +08:00
Jason Lee
709a888e15
accordion: Fix Accordion hover background. (#1184)
- Improved `accordion.hover` theme color default fallback to `accent`.
- Fix incorrect Accordion border top radius on hover.
- Removed unused `accordion.active.background` theme variable.

<img width="1106" height="799" alt="image"
src="https://github.com/user-attachments/assets/3b1d3e56-7e77-4118-ac3c-231c6571940a"
/>
2025-08-29 11:51:32 +08:00
Floyd Wang
f98ad5232b
table: Fix ESC event not propagating to modal with selection (#1183) 2025-08-29 10:52:30 +08:00
Jason Lee
74b3aa7e67
text_view: Add to support selection. (#1169)
### Links

Maybe we can do it in TextLayout in GPUI:


fda6eda3c2/crates/gpui/src/elements/text.rs (L309)

## Demo


https://github.com/user-attachments/assets/abbebee7-df8f-4067-86a7-15bc1a4c44cd

## Todo

- [x] Test for HTML View.
- [x] CodeBlock selection support.
- [x] Selection lines sometimes incorrect.
- [x] Listener Bounds changed to unselect.
2025-08-28 18:09:30 +08:00
Floyd Wang
4715a5a2dc
table: Fix the border render issue on stripe table (#1179)
| Before | After |
| - | - |
| <img width="426" height="134" alt="SCR-20250828-pail"
src="https://github.com/user-attachments/assets/1c5f8aa7-a55e-4a8f-a6db-1010303586d1"
/> | <img width="424" height="125" alt="SCR-20250828-paev"
src="https://github.com/user-attachments/assets/dc9950f5-c1a8-4b06-847a-eedb0cd67f60"
/>
2025-08-28 17:16:35 +08:00
Floyd Wang
bafc9fed12
table: Refine the row style (#1178)
Better solution for #1177.
2025-08-28 11:11:36 +08:00
Floyd Wang
f72e858d3a
table: Render custom row background first on striped table (#1177) 2025-08-28 10:44:10 +08:00
Floyd Wang
2a652dcc01
chore: Bump gpui & wireup Keystroke changes (#1176) 2025-08-27 17:44:10 +08:00
Jason Lee
5b6f2dc26e
alert: Fix the icon position and let all size use same text size. (#1175)
<img width="1270" height="1286" alt="image"
src="https://github.com/user-attachments/assets/08c485bf-daac-4490-8fca-1dd2f0efa396"
/>
<img width="1270" height="1286" alt="image"
src="https://github.com/user-attachments/assets/71bb1a59-0669-4102-8529-df81435fcb7d"
/>
<img width="1270" height="1286" alt="image"
src="https://github.com/user-attachments/assets/1ebd6095-4bd8-47e8-88a2-fdd470c47344"
/>
<img width="1270" height="1286" alt="image"
src="https://github.com/user-attachments/assets/71bb1a59-0669-4102-8529-df81435fcb7d"
/>
2025-08-27 11:06:31 +08:00
Remco Smits
e1c354916a
markdown: Fix that style attribute values are extracted correctly from img element (#1171)
This PR fixes an issue with parsing the styles attribute values. The
main issue it fixes is that we tried splitting on `:` twice which we
should only do once.

Before this change see the following variable values: 
decl="width: 10px" 
rule=["width", "10px"] (each iteration one value)

And for each rule value we tried splitting again on `:` which is wrong
we should only do this once.
2025-08-25 09:28:26 +08:00
Jason Lee
09ab49b2d3
tab: Fix segmented and underline tab style details. (#1168) 2025-08-21 20:04:50 +08:00
Jason Lee
4e5aca3842
group_box: Update GroupBox style. (#1167)
- Removed padding x of the Group Title.
- Added `fill` variant and change default to use no background and
paddings style.
 
<img width="1120" height="1337" alt="image"
src="https://github.com/user-attachments/assets/958e902f-3481-424c-a923-62746175aabf"
/>
2025-08-21 18:17:58 +08:00
Jason Lee
554082b969
text_view: Fix inline image render. (#1166)
GPUI does not support inline image into an `InteractiveText` yet. So
here, let it render into a block line.

<img width="1201" height="902" alt="image"
src="https://github.com/user-attachments/assets/797baeae-8764-417a-a907-e0d22956bf62"
/>

<img width="1064" height="805" alt="image"
src="https://github.com/user-attachments/assets/a5ef7000-aa71-4c1b-8a82-2a0f36649fd6"
/>
2025-08-21 16:30:58 +08:00
Jason Lee
8ed135d41a
Revert "modal: Avoid background color with alpha." (#1165)
Reverts longbridge/gpui-component#1154

By #1162 changes, this is not needed anymore.
2025-08-21 10:53:04 +08:00
Jason Lee
c4c948b177
theme: Fix reload theme to keep last selected. (#1164) 2025-08-20 17:33:12 +08:00