Vincent Hanquez
2b37028e08
chore: Update dependencies to smol = 2 ( #1404 )
...
just noticed the dependency is set to a fairly old version of smol (=
1), so update to smol = 2.
Also gpui/zed seems to be using smol = 2
2025-10-21 10:56:48 +08:00
Jason Lee
5b2fed0ccb
markdown: Use list for Markdown render and add scrollbar. ( #1357 )
2025-10-13 22:06:07 +08:00
Jason Lee
463f01bb16
theme: Update macos-clasic dark theme color. ( #1320 )
...
<img width="1073" height="1006" alt="image"
src="https://github.com/user-attachments/assets/625df905-b2f9-405f-a806-4574209d39de "
/>
<img width="908" height="893" alt="image"
src="https://github.com/user-attachments/assets/2d816d64-2e69-43dc-a707-a49e5f9842d4 "
/>
2025-10-02 14:46:27 +08:00
Sunli
591cfc8dab
text_view: Use weak references to the state in async task to avoid memory leaks. ( #1311 )
2025-09-30 15:26:59 +08:00
Sunli
880c019fb8
text_view: Reworks TextView to defer state initialization until first layout. ( #1310 )
2025-09-30 13:50:27 +08:00
Sunli
34b570cd8f
text_view: Refactor TextView, SyntaxHighlighter to use async to parsing. ( #1299 )
...
1. Parse content in the background thread
2. Remove unnecessary clones
3. `TextViewStyle` and `LanguageRegistry` can now be used across threads
2025-09-29 14:04:24 +08:00
Jason Lee
512f46aec8
text_view: Add to support custom code block style. ( #1288 )
...
And remove bg, padding for editor hover code blocks.
<img width="589" height="214" alt="image"
src="https://github.com/user-attachments/assets/55870f2f-e49e-4c2d-8899-9aa7edd17630 "
/>
2025-09-25 17:11:14 +08:00
Jason Lee
1c3eca93b8
editor: Revert to use ropey. ( #1284 )
...
For the License reason.
- The performance is slow down, before version can handle 200K lines,
now 150K lines is good.
2025-09-24 20:52:18 +08:00
Jason Lee
f1b6d7c5ed
editor: Add completion, code_action provider. ( #1242 )
2025-09-15 19:25:02 +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
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
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
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
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
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
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
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
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
6ae7558c44
theme: Add ThemeRegistry to load and watch themes dir. ( #1148 )
2025-08-18 19:29:27 +08:00
Jason Lee
406bf8d929
chore: Fork html5minify for HTML render. ( #1140 )
...
Continue #1137
Forked html5minify to improve:
- Resolve `\n` not replaced issue, now no need Regexp to replace.
- Resolve the difference version of html5ever dependency.
2025-08-15 11:10:23 +08:00
Jason Lee
899fbd693a
chore: Use html5minify instead of minify-html. ( #1137 )
...
Ref #1132
This change to reduce release mode binary size from 21MB to 12MB.
## HTML Render example
<img width="1712" height="1312" alt="image"
src="https://github.com/user-attachments/assets/f07c02c9-1b0e-4aa4-b81a-d2b0ac4f7260 "
/>
2025-08-15 09:52:38 +08:00
Jason Lee
a73273a0f1
text_view: Use simple-minify-html instead of minify-html. ( #1134 )
...
To avoid depends on lightningcss, this is a heavy crate.
Ref #1132
```
cargo bloat --release -n 200 --crates
Finished `release` profile [optimized] target(s) in 0.30s
Analyzing target/release/story
File .text Size Crate
4.6% 16.9% 3.4MiB lightningcss
```
2025-08-14 13:54:00 +08:00
Jason Lee
61b7e54bfa
table: Refactor the Table API for describe the columns. ( #1072 )
...
## Break Changes
- The `ColFixed` has renamed to `ColumnFixed`.
- The `ColSort` has renamed to `ColumnSort`.
### TableDelegate
- Removed `col_name`, `col_resizable`, `col_selectable`, `col_width`,
`col_sort`, `col_fixed`, `col_paddings`, `col_movable` method, now use
`col` method to return a TableCol for describe of them.
- The `cols_count` method renamed to `columns_count`.
```diff
- fn cols_count(&self, _: &App) -> usize
+ fn columns_count(&self, _: &App) -> usize
```
- The `move_col` has renamed to `move_column`.
- The `visible_cols_changed` has renamed to `visible_columns_changed`.
### TableEvent
```diff
- TableEvent::SelectCol
+ TableEvent::SelectColumn
- TableEvent::MoveCol
+ TableEvent::MoveColumn
- TableEvent::ColWidthsChanged
+ TableEvent::ColumnWidthsChanged
```
2025-07-21 11:16:35 +08:00
Jason Lee
44427afacb
theme: Add to support highlight color to theme config. ( #1055 )
...
<img width="1058" height="1026" alt="image"
src="https://github.com/user-attachments/assets/300fb16b-c5e4-4eef-9690-54fcabc4fe47 "
/>
<img width="836" height="855" alt="image"
src="https://github.com/user-attachments/assets/3fdc8301-375d-4223-a2ea-8d4f411a90bd "
/>
2025-07-14 17:04:18 +08:00
Jason Lee
82b87d92ab
text_view: Fix nested Blockquote render in Markdown and HTML. ( #1053 )
...
<img width="986" height="271" alt="image"
src="https://github.com/user-attachments/assets/1de04629-2bdc-48f2-ae69-45c33482aeff "
/>
- Also fixed short language name in code block, e.g.: `rs` -> `rust`.
2025-07-14 14:30:40 +08:00
Jason Lee
4156c831c6
chore: Refactor code for Input. ( #1046 )
2025-07-05 14:37:12 +08:00
Jason Lee
9b0ce145f6
alert: Improve Alert styles. ( #1044 )
...
<img width="1201" alt="image"
src="https://github.com/user-attachments/assets/7484132b-8bdd-4353-a6f0-f038189d9b15 "
/>
2025-07-04 15:29:05 +08:00
Jason Lee
4075447c63
text_view: Fix list item to merge inline paragraphs, and fix paragraphs margin. ( #1036 )
...
## Before
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/579385e6-a206-45e4-80a1-e1e2cdd6b164 "
/>
## After
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/2f551d22-5662-4c3c-a0e5-5ce9f26e1e66 "
/>
2025-07-03 18:02:08 +08:00
Jason Lee
a28ad0b1f1
text_view: Fix list item text wrap. ( #1027 )
...
## Before
<img width="911" alt="image"
src="https://github.com/user-attachments/assets/cfe01686-48da-4140-84d0-ead361833131 "
/>
## After
<img width="902" alt="image"
src="https://github.com/user-attachments/assets/fb97f8e8-3f16-43c4-8223-b7c6fdcc269f "
/>
2025-07-02 15:25:58 +08:00
Jason Lee
5b17281374
text_view: Fix li > strong render not in same line. ( #1016 )
...
## Before
<img width="1294" alt="image"
src="https://github.com/user-attachments/assets/0620f33a-914e-4d2a-8832-16c037351352 "
/>
## After
<img width="1131" alt="image"
src="https://github.com/user-attachments/assets/a31b9b5a-6d41-4c04-a415-ff97e7cd1f31 "
/>
2025-06-27 18:41:28 +08:00
Jason Lee
babb04fcaa
text_view: Fix code block background to use accent color. ( #1014 )
2025-06-26 18:30:34 +08:00
Jason Lee
60bebaf51f
markdown: Fix Todo list item checkbox style. ( #962 )
...
<img width="394" alt="image"
src="https://github.com/user-attachments/assets/dee22c50-4110-46e3-9205-320809c2ef00 "
/>
2025-06-17 10:50:57 +08:00
Jason Lee
1032881103
markdown: Add debounce 500ms to update markdown to avoid render slow. ( #953 )
...
Ref #933
2025-06-12 19:15:23 +08:00
Jason Lee
c3ec1deb97
code-editor: Update CodeEditor to support external language. ( #928 )
...
Add [Navi](https://navi-lang.org ) language for example to external
language for CodeEditor.
<img width="864" alt="image"
src="https://github.com/user-attachments/assets/73afa56d-31bd-4867-a9f2-0a8cf790af0f "
/>
2025-06-09 14:27:33 +08:00
Jason Lee
2b796c94e9
highlighter: Improve performance for large file. ( #911 )
...
Still need to improve.
This version can work smooth when the file lines are less than 5000
lines.
> cargo run --release on MacBook Pro, Apple M3 CPU
- Editing at 110 FPS+
- Display at 120 FPS.
<img width="977" alt="image"
src="https://github.com/user-attachments/assets/37958bcb-20d8-486b-8c50-2728d16f971b "
/>
2025-06-03 23:20:33 +08:00
Jason Lee
a4aff404ce
highlighter: Use tree-sitter to highlight code. ( #904 )
...
<img width="1318" alt="image"
src="https://github.com/user-attachments/assets/4a8e7b93-a7e7-4648-b8da-c5a6e7ede4f9 "
/>
<img width="1318" alt="image"
src="https://github.com/user-attachments/assets/bfc35845-719f-4c97-bf50-087feb0f6775 "
/>
2025-05-29 19:54:52 +08:00
Jason Lee
1cbbf6ef18
code-editor: Improve CodeEditor to has default themes. ( #900 )
2025-05-26 18:17:15 +08:00
Jason Lee
1c11b5fb55
inspector: Add Inspector. ( #897 )
...
<img width="1434" alt="image"
src="https://github.com/user-attachments/assets/f6ec2e1d-ff1c-4798-90fe-d29bef20fa9d "
/>
2025-05-26 16:44:11 +08:00
Jason Lee
a95482fdd8
chore: Upgrade GPUI 2025/05/26 with inspector changes. ( #895 )
...
https://github.com/zed-industries/zed/pull/31315
2025-05-26 13:40:27 +08:00
Jason Lee
d0ccb6bf17
code-editor: Improve code highlight performance. ( #885 )
...
- Split code to lines to improve performance and cache hit rate, close
#881
- Update default code highlight theme to use `macOS Classic`.
<img width="1208" alt="image"
src="https://github.com/user-attachments/assets/511b442d-5960-493f-88cc-b8aceb68f77b "
/>
<img width="1208" alt="image"
src="https://github.com/user-attachments/assets/6e5b2728-384f-4b62-b069-268118dec9ab "
/>
2025-05-22 18:09:18 +08:00
Jason Lee
5e4e810c0d
description_list: Add to support border style to DescriptionList vertical layout. ( #706 )
...
<img width="899" alt="image"
src="https://github.com/user-attachments/assets/38108d88-7b27-4964-8b1d-07b81522698b "
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/c4467a72-0011-486b-9918-af21297b8c3e "
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/21e8fc31-1642-4ab4-b180-01aea6e81b38 "
/>
<img width="980" alt="image"
src="https://github.com/user-attachments/assets/65a02a85-7538-4b6f-83e5-33502c30367e "
/>
2025-03-11 17:59:56 +08:00
Jason Lee
6a00cfcc4a
text_view: Fix HTML render to support blockquote. ( #703 )
...
<img width="850" alt="image"
src="https://github.com/user-attachments/assets/4d8f662f-aebe-4c40-bc56-828627f16064 "
/>
2025-03-10 22:53:53 +08:00
Jason Lee
c3f08d52b9
text_view: Add syntax highlight to CodeBlock. ( #684 )
...
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/e7539df4-20db-431b-9bbc-52e08e9de062 "
/>
<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/85d52319-1029-4306-8629-ec0321d0571b "
/>
2025-03-04 21:50:50 +08:00
Jason Lee
793a35eff2
text_view: Fix img height in TextView. ( #679 )
...
Close #643
<img width="1103" alt="image"
src="https://github.com/user-attachments/assets/0f0a0af0-8fe2-4322-b012-0f970ba9e13d "
/>
Ref https://github.com/zed-industries/zed/pull/25632
2025-03-03 20:51:26 +08:00
Jason Lee
7582ad3fb3
text_view: Add heading_base_font_size to TextViewStyle and fix text wrap for list item. ( #670 )
...
- Fix list item to wrap text.
<img width="797" alt="image"
src="https://github.com/user-attachments/assets/9e8156ad-bf58-4d7a-a850-69dfcb56c850 "
/>
2025-02-28 11:43:08 +08:00
Jason Lee
3ba63915ce
text_view: Fix some case may lose spaces, <br> in HTML and Markdown render. ( #667 )
2025-02-26 17:52:18 +08:00
Jason Lee
ffa848fb26
text_view: Fix markdown table alignment. ( #666 )
2025-02-26 15:49:13 +08:00
Jason Lee
c74791aac8
description_list: Add DescriptionList. ( #658 )
...
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/15069422-14aa-4fa3-b661-65fcf7417323 "
/>
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/df4a4b90-b304-40d3-a9ce-1be73eaaa9f4 "
/>
<img width="1089" alt="image"
src="https://github.com/user-attachments/assets/1deaf1e8-4b30-4afd-90af-1bd0eecf53e2 "
/>
2025-02-25 15:32:59 +08:00
Jason Lee
9f429592ce
text_view: Remove last paragraph bottom margin. ( #660 )
...
Now, we can be easy to use TextView for 1 line text.
## Break Changes
- Removed `inline` method by previous #649 added, this is not needed.
2025-02-25 14:27:59 +08:00