Commit graph

840 commits

Author SHA1 Message Date
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
769b1887d0 dock: Ensure add panel to StackPanel is type of TabPanel or StackPanel. (#862) 2025-05-17 22:42:03 +08:00
Jason Lee
1e2cc8315a
dock: Show keybinding for ToggleZoom menu and button. (#861)
And binding `Shift-Esc` for example to toggle zoom panel, `Ctrl-W` for
close panel.


![image](https://github.com/user-attachments/assets/993dcbb3-ae39-467f-bf4c-d5faf5639b35)
2025-05-17 22:23:45 +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
Ratazzi
f3d97bf8e2
chore: Unify icon parameter types in ListItem and Dropdown. (#857)
## Changes

This PR unifies icon parameter types in UI components:

- Changed `ListItem.check_icon` parameter type from `IconName` to `impl
Into<Icon>`
- Changed `Dropdown.icon` parameter type from `impl Into<IconName>` to
`impl Into<Icon>`
- Updated related rendering logic

## Impact

- **API Consistency**: All components now accept the same icon parameter
type
- **Backward Compatible**: Existing code using `IconName` continues to
work
- **Enhanced Flexibility**: Components can now accept custom `Icon`
instances directly
2025-05-15 16:13:30 +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
1535df796e
resizable: Refactor to use stateless Resizable element. (#852)
## Break Changes

- The `ResizablePanelGroup` and `ResizablePanel` are changed to as
stateless element, please check out the diff to migrate.
2025-05-12 17:15:11 +08:00
Jason Lee
0a95f7c0f1
resizable: Add size_range to limit panel size and fix resize and initial_size of panel. (#844)
## Fix panel resize bug

- Fix some panel resizing details.
- Fix initial_size for panel and ensure split dock panel to get average
size.

### Before


https://github.com/user-attachments/assets/cd6c7e10-aec7-46a6-8a4d-11bf4d221f92

### After


https://github.com/user-attachments/assets/90c8b865-630a-4abd-98c9-310800b12fee
2025-05-12 11:07:06 +08:00
Michael Angerman
28582bc905
chore: Remove unused file text_view (#850)
The file text_view was empty.
So it does not need to be in the repo.
2025-05-12 10:40:00 +08:00
Jason Lee
8bea37ed74
dock: Update drop panel target mask to 50% of panel. (#845) 2025-05-09 22:55:48 +08:00
Jason Lee
d288a51e06
dock: Revert panel radio size to back to use Pixels type for panel size. (#842)
This PR to revert previous dock changes to back to use `Pixels` type for
panel size.

- #833 
- #839 
- #840
2025-05-09 16:47:24 +08:00
Losses Don
6caf6f95df
chore: Add Nix/Flake development environment. (#837) 2025-05-08 21:54:58 +08:00
Jason Lee
f8e30c6f5d
dock: Revert dock to use absolute size. (#840)
This change to revert `Dock` to use `Pixels` for size, not use ratio,
because in most case we need to keep dock size, not wants it change when
window resize, we just only want center dock to change.

The `Panel` will keep the relative size changes.
2025-05-08 16:29:55 +08:00
Jason Lee
a26311dc0e
dock: Improve dock, panel to support absolute or fraction size. (#839) 2025-05-08 12:01:16 +08:00
zoubingwu
4aaaaa2d91
doc: Revise README for clarity and grammar improvements. (#836) 2025-05-07 17:05:07 +08:00
Jason Lee
294f7a9a6e
doc: Update README for add features. (#835) 2025-05-07 16:09:16 +08:00
Jason Lee
6514aec22a
dock: Refactor to use ratio for dock, panel size. (#833) 2025-05-07 01:32:31 +08:00
Jason Lee
e530af9b51
notification: Add action button to Notification. (#832)
- Fix `Icon` clone to keep text_color and other attributes.

<img width="1303" alt="image"
src="https://github.com/user-attachments/assets/abb35045-166e-450e-a200-1d4a1d2b6dd8"
/>
2025-05-06 16:58:07 +08:00
Jason Lee
9906a482ec
style: Add smaller, larger method to Size. (#831) 2025-05-06 15:31:11 +08:00
Jason Lee
0c6d631a39
scrollbar: Improve the scrollbar size. (#830)
## Idle

<img width="1086" alt="image"
src="https://github.com/user-attachments/assets/1acd847c-9ea4-477f-a1be-a9dd6305de60"
/>

## Hover

<img width="1086" alt="image"
src="https://github.com/user-attachments/assets/08a700ce-98f5-41ff-b504-37ea3cf90d81"
/>
2025-05-06 14:45:22 +08:00
Jason Lee
f4e8b952e9
modal: Add alert method to create modal with a Ok button. (#829)
- Fix to handle close modal when `on_ok`, `on_cancel` not present.
2025-05-02 10:28:26 +08:00
Jason Lee
2c06a032fb
svg_img: Fix SvgImg first load can work. (#828) 2025-04-30 17:35:11 +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
3a915dba89
chore: Update GPUI 2025/04/30 (#826) 2025-04-30 14:41:08 +08:00
Jason Lee
6dea2cb57c
input: Clean focused_input on Input blur. (#825) 2025-04-30 14:08:39 +08:00
Sunli
69dad78867
svg_img: No longer use the global image loader. (#823)
Update SvgImg load logic and try to drop image to fix VRAM leak issue.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-30 11:56:24 +08:00
Floyd Wang
a5e5fc52b4
dropdown: Support change options for the dropdown (#824) 2025-04-30 10:33:21 +08:00
Jason Lee
dd3b8b1f3d
theme: Export colors attribute. (#822) 2025-04-30 10:16:35 +08:00
Jason Lee
832f8b8f75
svg_img: Refactor SvgImg to avoid assign source image size and fix drop image error. (#821)
## Break Change

- Removed `source` method from `SvgImg`, now need assign source in `new`
method.
- There is no need to give image size, it will read the size from SVG
file.
2025-04-29 19:25:43 +08:00
dependabot[bot]
9d467ac92b
build(deps): bump gpui from 04c0a54 to c56b5d8 (#819)
Bumps [gpui](https://github.com/huacnlee/zed) from `04c0a54` to
`c56b5d8`.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c56b5d8099"><code>c56b5d8</code></a>
gpui: Fix VRAM leak caused by drawing large textures and resize
textures</li>
<li><a
href="3862d87e27"><code>3862d87</code></a>
gpui: Fix <code>window_handle</code> method on Linux.</li>
<li><a
href="7675ad9f8f"><code>7675ad9</code></a>
gpui: Fix <code>update_window</code> to <code>borrow_mut</code> will
crash on Windows.</li>
<li><a
href="5e31d86f1f"><code>5e31d86</code></a>
Fix panic in vim selection restoration (<a
href="https://redirect.github.com/huacnlee/zed/issues/29251">#29251</a>)</li>
<li><a
href="4a8f114528"><code>4a8f114</code></a>
Fix panic when collaborating with new multibuffers (<a
href="https://redirect.github.com/huacnlee/zed/issues/29245">#29245</a>)</li>
<li><a
href="ce1a674eba"><code>ce1a674</code></a>
eval: Fine-grained assertions (<a
href="https://redirect.github.com/huacnlee/zed/issues/29246">#29246</a>)</li>
<li><a
href="0d3fe474db"><code>0d3fe47</code></a>
editor: Use quantize score for code completions sort + Add code
completions t...</li>
<li><a
href="6a009b447a"><code>6a009b4</code></a>
debugger: Open debugger panel on session startup (<a
href="https://redirect.github.com/huacnlee/zed/issues/29186">#29186</a>)</li>
<li><a
href="75ab8ff9a1"><code>75ab8ff</code></a>
zlog: Add default filters (<a
href="https://redirect.github.com/huacnlee/zed/issues/29244">#29244</a>)</li>
<li><a
href="3705986fac"><code>3705986</code></a>
Adjust image cache APIs to enable ElementState based APIs (<a
href="https://redirect.github.com/huacnlee/zed/issues/29243">#29243</a>)</li>
<li>Additional commits viewable in <a
href="04c0a545a7...c56b5d8099">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-28 23:25:16 +08:00
Sunli
dc776224f9
svg_img: Fix memory leak in SvgImg (#818) 2025-04-28 14:42:37 +08:00
Floyd Wang
547c9c1827
gallery: Fix the error active panel display with search keywords (#817)
## Before

https://github.com/user-attachments/assets/25b925e5-c0f3-42b0-97f3-190fb738a10a

## After

https://github.com/user-attachments/assets/2d6e2b23-f3e2-45fd-a58c-69f31d0646a8
2025-04-25 19:06:39 +08:00
Ylin
f946560837
dropdown: Add display_title to DropdownItem to support custom title to dropdown input. (#816)
Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-25 19:05:24 +08:00
Jason Lee
9085879795
gallery: Add DatePicker and Calendar. (#815) 2025-04-25 16:05:47 +08:00
Jason Lee
a9d145dd50
Update disabled menu, button, dropdown etc. to use default cursor. (#814)
To follow macOS UX design.
2025-04-24 21:28:15 +08:00
Jason Lee
bbb267f2bf
accordion: Add gap between title and icon. (#813) 2025-04-24 21:01:11 +08:00
Floyd Wang
f7c900d8eb
input: Add Copy and Eq derives for StepAction (#812) 2025-04-24 11:06:32 +08:00
Jason Lee
b0ff230588
table: Disable auto scroll when resize column out of the table right bounds. (#811)
https://github.com/user-attachments/assets/f1569eb5-e6e6-43f9-9425-0de5e2235163

Do same behavior like the macOS table.
2025-04-23 22:18:40 +08:00
Jason Lee
3cff72cc37
table: Fix render_tr to ensure apply with h_flex. (#810)
- Reduce last empty column to 12px.
2025-04-23 22:09:14 +08:00
Jason Lee
b4449f10cf
dropdown: Avoid selected value text wrap. (#808) 2025-04-22 21:19:20 +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
Jason Lee
373d97ddf0
root: Fix to reset focused_input when close modal or drawer. (#807) 2025-04-22 18:54:07 +08:00
Ylin
affd29dc85
table: Ensure to select row when prev or next. (#805) 2025-04-22 18:46:41 +08:00
Jason Lee
39da30815a
input: Fix Input escape to propagate to parent element. (#806)
Fix #803 changes broke Escape to dismiss dropdown menu.
2025-04-22 18:40:27 +08:00
Jens Krause
f7be6a245a
input: Add Esc to clean. (#803) 2025-04-20 10:24:47 +08:00
Jason Lee
7719d8b6fc
chore: Update gallery download for Windows. (#804) 2025-04-18 00:10:08 +08:00