Jason Lee
692ee83b61
chore: Move shadow_xs to StyledExt trait. ( #1010 )
...
This PR for fix https://github.com/longbridge/gpui-component/pull/1009
mistake.
2025-06-25 16:54:48 +08:00
Jason Lee
c8481bee19
theme: Update theme details to match Shadcn. ( #1009 )
...
## Light
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/b1893648-5994-4c08-a79a-30b10dc62c47 "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/de5b4e13-7889-473b-b0c0-9ac11de0a4b0 "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/9f17c2a1-3a71-4d56-be6c-49f26f5e7406 "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/a4e99a61-a618-4c3b-a237-93bbc17d4cae "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/64313ae5-8284-46ff-a75f-5a14a1e3b339 "
/>
<img width="1193" alt="image"
src="https://github.com/user-attachments/assets/5c134172-0ab6-4299-950d-bac3dda7b61d "
/>
<img width="1374" alt="image"
src="https://github.com/user-attachments/assets/c8816288-d008-490d-9db3-4fa796278001 "
/>
<img width="1428" alt="image"
src="https://github.com/user-attachments/assets/d903a854-15e3-48aa-8ebd-969c1c91c624 "
/>
## Dark
<img width="1467" alt="image"
src="https://github.com/user-attachments/assets/720418b4-8a9b-42c9-814b-a0be660e8eba "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/4ca20f31-c998-40bb-b4bf-6079c506f9ec "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/ae828624-55b3-4d33-8a20-2c71a0a838cc "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/7014c76c-5e18-4cd5-9cf1-6bccbb58e56a "
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/6e1c514d-5f76-460a-9c7e-a38f2f0e712a "
/>
<img width="1374" alt="image"
src="https://github.com/user-attachments/assets/07ad8c20-317b-4209-9f92-b500f53dd4c0 "
/>
<img width="1428" alt="image"
src="https://github.com/user-attachments/assets/6bd2969d-9bec-4ed7-9280-109a81144dfa "
/>
2025-06-25 16:40:27 +08:00
Jason Lee
67f0ffbc9c
chore: Upgrade GPUI and fix action API changes. ( #1008 )
...
Ref https://github.com/zed-industries/zed/pull/33263
2025-06-25 11:06:12 +08:00
Jason Lee
3a6741f990
input: Fix wrap text not draw in multi-line mode. ( #998 )
...
Close #997
https://github.com/user-attachments/assets/6ad9f431-b5a2-42f1-93e6-6425f0851898
2025-06-23 18:14:29 +08:00
Jason Lee
d7e04ecdd0
scrollbar: Improve Scrollbar to get correct scroll size. ( #985 )
...
Continue #984
- Fixes there may Scrollbar size not match the content size. Close #979
- Improved Table scrollbar to only render at scrollable area when there
have fixed columns.
<img width="850" alt="image"
src="https://github.com/user-attachments/assets/84f54515-e61a-484f-b2b4-ea5abb98ddb8 "
/>
## Break Changes
- The `Scrollbar` has been removed `entity_id` and `scroll_size`
argument from new method, it will get that value from `scroll_handle`.
- There still have a `scroll_size` optional method, if you want to give
your own.
- Also changed the `scroll_state`, `scroll_handle` to receive a ref.
```diff
- Scrollbar::vertical(entity_id, scroll_state, scroll_handle, scroll_size);
+ Scrollbar::vertical(&scroll_state, &scroll_handle);
+ Scrollbar::vertical(&scroll_state, &scroll_handle).scroll_size(scroll_size);
```
2025-06-18 19:09:34 +08:00
Jason Lee
a478f000d4
input: Add MovePageUp, MovePageDown keymap to multi-line mode. ( #969 )
2025-06-17 20:57:53 +08:00
Jason Lee
edf9ed7e5f
input: Fix move up/down to keep same column. ( #968 )
...
Close #908
https://github.com/user-attachments/assets/f050dd1a-501c-4784-a45b-78ba77cdf19c
2025-06-17 15:23:37 +08:00
Jason Lee
3d7f1f8a73
input: Keep showing the blink cursor when typing or moving. ( #967 )
...
https://github.com/user-attachments/assets/3b7d2cfd-50b0-4744-bb74-1deafc5710e3
2025-06-17 14:20:27 +08:00
Jason Lee
869d48b446
input: Fix Input cursor x position when scrolled. ( #966 )
...
https://github.com/user-attachments/assets/db76d3a3-ecd6-45c6-8377-0afa4746f2db
2025-06-17 14:14:23 +08:00
Jason Lee
de491a790c
input: Fix Input prefix, suffix position, and mask * in vertical center. ( #965 )
...
- Fix Input, NumberInput padding x with prefix, suffix.
- Fix Input mask char to render in vertical center.
<img width="498" alt="image"
src="https://github.com/user-attachments/assets/f7b34e17-2503-4a24-9e16-3a30b48bacb5 "
/>
- Fix to only use `Tab`, `Shift-Tab` to indent in multi-line mode.
- Improve blink cursor to render with 1.5px width and same as
line-height.
2025-06-17 13:59:02 +08:00
Jason Lee
61283a71f0
scrollbar: Refactor ScrollbarState to have Cell inside. ( #959 )
...
## Break Change
- Now we added `Rc<Cell<>>` inside the ScrollbarState.
```diff
- scroll_state: Rc<Cell<ScrollbarState>>,
+ scroll_state: ScrollbarState,
```
2025-06-16 15:11:52 +08:00
Victor Quiroz
769c0990a4
number_input: Allow signed numbers ( #957 )
...
Allow negative numbers and explicit positive numbers.
Added these tests:
1. Only one sign at the start of the number.
2. No signs in the middle of the number.
3. No signs in the fractional part.
4. Sign doesn't break formatting.
https://github.com/user-attachments/assets/89c4f4c7-d3bf-4cc1-aeca-7e9bedd02e20
---------
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-06-16 10:05:37 +08:00
Jason Lee
d61b0d2510
highlighter: Fix highlight offset and reset highlight when replace all text. ( #950 )
...
- Improve JSON highlights.
<img width="839" alt="image"
src="https://github.com/user-attachments/assets/3f28ae1c-9f07-4df4-a477-f875a26d4c7d "
/>
2025-06-12 14:11:01 +08:00
Jason Lee
ed6adc2dae
input: Simplify newline logic for multi-line text and fix auto-grow lines count. ( #948 )
...
- Fix to only keep indent in CodeEditor mode.
https://github.com/user-attachments/assets/4b926a18-b0b5-4419-97dd-21778cd20fb3
2025-06-12 10:59:41 +08:00
Jason Lee
6ea427549a
input: Add focus_bordered method to toggle Input focus border. ( #946 )
2025-06-11 21:34:37 +08:00
Jason Lee
c5201e6de9
input: Revert #929 changed replace_text_in_range result an incorrect cursor pos. ( #930 )
2025-06-09 19:02:09 +08:00
Jason Lee
d648874860
input: Add cmd-], cmd-[ to indent, outdent text. ( #929 )
2025-06-09 18:31:14 +08:00
Jason Lee
6aab9d3345
code-editor: Show hover popover for diagnostics. ( #924 )
...
<img width="719" alt="image"
src="https://github.com/user-attachments/assets/75fa9737-09e1-4baa-b7ac-304e847005c8 "
/>
2025-06-09 16:16:15 +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
Floyd Wang
936ee27a2c
input: Fix the panic issue in end_of_line ( #922 )
2025-06-06 10:07:11 +08:00
Jason Lee
a8f5ced4e6
code-editor: Add markers for display diagnostics to CodeEditor. ( #920 )
...
Ref:
https://microsoft.github.io/monaco-editor/typedoc/functions/editor.setModelMarkers.html


2025-06-05 23:04:01 +08:00
Jason Lee
c97cdd7b89
input: Fix line number width, when line number not enable. ( #916 )
2025-06-03 23:40:21 +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
372c78fac6
input: Fix enter newline position incorrect by #901 change. ( #905 )
2025-05-27 17:25:54 +08:00
Jason Lee
9073818d4e
input: Fix outdent when selection first line is no indent. ( #903 )
...
## Before
https://github.com/user-attachments/assets/67f94a09-b01b-43e4-9809-2e876f53a7b7
## After
https://github.com/user-attachments/assets/0ff7fee8-cbbc-4f55-8877-96c7ad07d662
2025-05-26 22:46:26 +08:00
Jason Lee
5419600fcd
input: Fix Input may out of char boundary ( #901 )
...
```
byte index 3 is not a char boundary; it is inside '吧' (bytes 1..4) of `L吧2`: 0: <unknown>
```
2025-05-26 22:42:31 +08:00
Jason Lee
1cbbf6ef18
code-editor: Improve CodeEditor to has default themes. ( #900 )
2025-05-26 18:17:15 +08:00
Jason Lee
0a9de15d79
input: Change InputState::disabled to as builder method. ( #898 )
...
## Break Changes
- The `disabled` method now is for builder method, and `is_disabled` for
get state.
```diff
- pub fn disabled(mut self) -> bool
+ pub fn is_disabled(&self) -> bool
+ pub fn disabled(mut self, disabled: bool) -> Self
```
2025-05-26 17:00:17 +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
Floyd Wang
a1ad647527
number_input: Add support for prefix and suffix ( #896 )
...
<img width="1097" alt="image"
src="https://github.com/user-attachments/assets/b4c1fc69-88ad-4ecd-b1c8-1a5a92836e82 "
/>
2025-05-26 16:16:22 +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
8dc9666214
input: Fix cursor and IME popup position when IME typing. ( #889 )
...
- Fix cursor position when IME typing.
- Fix selection range when canceled IME typing.
- Fix IME popup position to follow the cursor position.
- Fix IME text to render with underline style.
Close #55
<img width="1231" alt="image"
src="https://github.com/user-attachments/assets/c746703f-23de-4b3b-bd5b-210a8447eeba "
/>
2025-05-23 15:00:24 +08:00
Jason Lee
2c4a28a6da
code-editor: Add current line background. ( #887 )
...
https://github.com/user-attachments/assets/3ab6a1b5-648c-4431-91d2-7ebefee2f511
2025-05-22 23:03:53 +08:00
Jason Lee
2d6284694d
code-editor: Fix highlight offset on Windows. ( #886 )
...
Again, caused by need `split('\n')` not use `.lines()`.
2025-05-22 22:10:59 +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
Floyd Wang
244090ddc5
number_input: Remove InputEvent from NumberInputEvent ( #884 )
...
## Break Change
- Number input no longer emits `InputEvent`; you need an additional
subscription for `InputEvent`.
2025-05-22 14:38:43 +08:00
Jason Lee
119d348e4a
input: Fix indent, outdent to consider \r on Windows. ( #880 )
...
https://github.com/user-attachments/assets/c662c251-36e5-4a80-bad9-7438ba1b395c
2025-05-21 22:37:07 +08:00
Jason Lee
445b1e4e02
input: Fix click can not to position cursor on empty line on Windows. ( #875 )
...
Reverts longbridge/gpui-component#874
Ref https://github.com/zed-industries/zed/pull/31031
2025-05-21 10:01:53 +08:00
Jason Lee
5658db42c7
input: Add CodeEditor mode. ( #863 )
...
## TODO
- [x] Cache highlight result.
- [x] Add a `code-editor` example with more languages test.
- [x] Support setup font to Input (Base on window scope text style).
- [x] Line number
- [x] Change font size and font family.
- [x] Enter newline to keep indent.
- [x] Height with flex_1
- [x] Add to support press `up`, `down` to move cursor to start or end
of the selection, if there is selected.
- [x] Add `Tab`, `Shift-Tab` to indent or outdent for cursor and
selection.
- [x] Double click to select at least 1 char.
https://github.com/user-attachments/assets/af74862d-15a9-4802-b4b4-2aeb606227ec
2025-05-20 15:51:00 +08:00
Jason Lee
67dd658635
input: Fix selection rendering for empty lines. ( #868 )
...
<img width="491" alt="image"
src="https://github.com/user-attachments/assets/b24e4fbc-40e8-4570-b254-2974aa7735a7 "
/>
2025-05-19 20:32:46 +08:00
Jason Lee
b97abd6394
input: Fix auto-grow height. ( #865 )
...
Fix #864
Updated InputState API to split `single_line`, `multi_line` and
`auto_grow`.
The `InputState::new` for default single_line, and added `multi_line`
and `auto_grow` to change other mode.
### With no wrap
https://github.com/user-attachments/assets/22a8f0d6-e264-4f39-bb30-386a41975d2b
### With soft wrap
https://github.com/user-attachments/assets/b71f0fb1-5937-470b-a278-8b1de7cfd7d7
2025-05-19 19:26:27 +08:00
Jason Lee
3c85ccbe2a
number_input: Fix NumberInput appearance by #858 change. ( #860 )
2025-05-17 10:51:04 +08:00
Jason Lee
bc398adbf3
input: Refactor Input, Picker as stateless mode. ( #858 )
2025-05-16 23:41:26 +08:00
Jason Lee
c0e0d82594
input: Add mask pattern to format display. ( #854 )
...
- Add `mask_pattern` to Input, NumberInput.
- Fix Input `set_text` to move cursor to end.
https://github.com/user-attachments/assets/2d7e362a-3f80-47a4-94e3-efd729bffcac
2025-05-14 22:27:46 +08:00
Jason Lee
38d9c24af5
chore: Update getter method to return reference to view components. ( #827 )
2025-04-30 17:18:44 +08:00
Jason Lee
6dea2cb57c
input: Clean focused_input on Input blur. ( #825 )
2025-04-30 14:08:39 +08:00
Floyd Wang
f7c900d8eb
input: Add Copy and Eq derives for StepAction ( #812 )
2025-04-24 11:06:32 +08:00
Jason Lee
5cacffcc06
chore: Fix cargo clippy.
2025-04-22 19:36:09 +08:00
Jason Lee
a195795978
input: Refactor window.focused_input by use better way to ensure update. ( #809 )
2025-04-22 19:34:41 +08:00