Commit graph

1212 commits

Author SHA1 Message Date
Jason Lee
efe7e14e88
menu: Unselect menu item when mouse move out. (#1328) 2025-10-06 09:45:45 +08:00
Jason Lee
794f4d6397
editor: Add to support move vertical for soft wrapped lines. (#1312) 2025-10-03 18:19:37 +08:00
Jason Lee
f59bac8c8b
tab_bar: Let normal/active tab has same border to avoid flash on active change. (#1327) 2025-10-03 16:30:28 +08:00
Jason Lee
a48232cefd
input: Clean to reset selection and scroll offset. (#1326)
- Focus back to input when click `clean` button.
2025-10-03 16:11:27 +08:00
Floyd Wang
9754cab4d7
button: Bind element ID after button is created (#1325)
- Fix the selected-state error in the popup menu.
2025-10-03 14:52:53 +08:00
Floyd Wang
1358b2906e
Bump gpui (#1324)
* Wireup the `Pixels` change
https://github.com/zed-industries/zed/pull/39367.
2025-10-03 14:32:29 +08:00
Floyd Wang
4d459ea160 chore: Remove debugging logs 2025-10-03 13:37:45 +08:00
Jason Lee
cfd060b66d
editor: Split Input and Editor background color. (#1323)
Keep input to use window background color, the `editor.background` only
for Editor mode.
2025-10-03 11:20:01 +08:00
Jason Lee
e84e8ebaad
button: Fix button label display has overflow hidden. (#1322) 2025-10-03 10:18:00 +08:00
Carlo Corradini
908c022efe
chore: Assets interpolate folder path via rust embed (#1318)
Use `rust-embed` feature `interpolate-folder-path` to always
(`debug`/`release`) load assets from the correct `assets` directory
2025-10-02 16:04:33 +08:00
Jason Lee
4ee64cc661
theme: Update theme schema to remove card and add group_box. (#1321) 2025-10-02 15:29:08 +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
Floyd Wang
df8bcefaaa
tag: Implement styled for custom style (#1319) 2025-10-02 14:07:07 +08:00
Xu Desheng
8c6cde3719
highlighter: Use clip_offset to ensure UTF-8 char boundaries (#1317)
## Problem

SyntaxHighlighter panics when highlighting text containing multi-byte
UTF-8 characters (Chinese, Japanese, emoji, etc).

**Error**: `thread 'main' panicked at
ropey-2.0.0-beta.1/src/rope.rs:694:59`

**Root Cause**: tree-sitter may return byte offsets that fall in the
middle of multi-byte UTF-8 characters. When `Rope::slice()` receives
such offsets, it checks `is_char_boundary()` and panics with
`NonCharBoundary` error.

## Solution

Use `RopeExt::clip_offset()` to adjust byte offsets to the nearest char
boundaries before calling `slice()`.

**Changes**:
- Line 395-398: Clip offsets in main highlighting loop
- Line 441-443: Clip offsets when extracting injection content  
- Line 478-479: Added explanatory comment for injection highlighting
- Added imports for `RopeExt` and `Bias`

**Safety**:
- `Bias::Left` for start offset ensures we don't skip the beginning of a
character
- `Bias::Right` for end offset ensures we include the full character
- The adjustment is minimal (at most 3 bytes for UTF-8)
- Uses existing project API (`RopeExt::clip_offset`)

## Testing

Tested with:
-  Chinese text: "你好世界"、"**加粗中文**"
-  Japanese text: "こんにちは"、"日本語"
-  Emoji: "😀🎉🚀"
-  Markdown syntax highlighting with CJK characters
-  Code blocks with mixed languages

All tests pass without panics. Syntax highlighting works correctly. No
performance degradation observed.

## AI Assistance

🤖 This fix was developed with AI assistance (Claude). The solution
approach (using `clip_offset`) was identified through code analysis and
testing. The AI analyzed:
- ropey source code to understand the panic condition
- Existing usage of `clip_offset` in the codebase
- Tree-sitter byte offset behavior with UTF-8

All code has been reviewed and tested by humans, and further validated
by Gemini AI.

## Checklist

- [x] Follows existing code style
- [x] One PR does one thing (UTF-8 panic fix only)
- [x] All manual tests pass
- [x] Tested with real multi-byte UTF-8 content
- [x] No breaking changes
- [x] No performance regression
2025-10-02 12:14:07 +08:00
Jason Lee
de4a7a7026 doc: Update Iced editor info. 2025-09-30 16:50:41 +08:00
Jason Lee
935cd93f5a chore: Fix rust logo URL in test.md. 2025-09-30 16:29:56 +08:00
Jason Lee
f4d3daa72a
theme: Fix Ayu theme comment color. (#1316) 2025-09-30 16:17:28 +08:00
Sunli
d619e00ecb
input: Only recreate the TextView used to display hover information when necessary. (#1313) 2025-09-30 16:11:32 +08:00
Jason Lee
69af1be6e5
chore: Update GPUI and fix DeferredScrollToItem API changes. (#1315) 2025-09-30 16:10:25 +08:00
Jason Lee
8b0898147f
editor: Fix Editor crash when text is empty to display placeholder. (#1314) 2025-09-30 16:07:03 +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
Jason Lee
d5ae887cbb
editor: Fix hover definition to immediately hide when move out. (#1309) 2025-09-30 11:29:59 +08:00
Jason Lee
f92944546f
chore: Disable tab stop for some popover elements. (#1306) 2025-09-29 18:11:25 +08:00
Jason Lee
03cf48a783
input: Avoid scroll on select all. (#1305) 2025-09-29 17:49:59 +08:00
Jason Lee
6028de3b5a
editor: Input enter to get next indent level performance. (#1304)
Now we can handle about 1M lines.

https://github.com/user-attachments/assets/cb55cd18-6755-40cd-a5b0-3d0f865d12e1
2025-09-29 17:35:58 +08:00
Jason Lee
aca03d47c0
input: Fix Input to unselect on blur. (#1303) 2025-09-29 17:29:11 +08:00
Jason Lee
5e504d10bb
chore: Refactor tab key to switch focus. (#991)
Wait https://github.com/zed-industries/zed/pull/33008,
https://github.com/zed-industries/zed/pull/34804 to merge.


https://github.com/user-attachments/assets/3c21ebc9-44a0-4311-bb0f-5f63fe8d4bb3

- Improved `focus_ring` to render like an outline.
- Added to support press `Enter`, `Space` key to trigger Checkbox,
Button, Radio.

## Break Changes

- The `FocusableExt` has been changed to only for crate internal.
- The `FocusableCycle` has been removed, now GPUI has it own tab stop
implementation.
2025-09-29 16:48:24 +08:00
Copilot
ed05c3ebec
chore: Remove Wef code as it has been extracted to separate repository (#1302)
All WEF (Web Embedding Framework) related code has been successfully
removed from the repository as it has been extracted to
https://github.com/longbridge/wef

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: huacnlee <5518+huacnlee@users.noreply.github.com>
2025-09-29 15:31:58 +08:00
Sunli
b8651515f0
chore: Remove unnecessary RefCell (#1301) 2025-09-29 14:39:04 +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
Sunli
3413c33d1c
chore: use async-wry (#1300) 2025-09-29 13:32:12 +08:00
Jason Lee
3ee8d7ffd2
input: Fix input mark text render. (#1298)
Fix #1293 change broken the input mask render (password mask,
placeholder ...)
2025-09-29 10:40:39 +08:00
Jason Lee
172015f147
input: Use shape line for soft wrap lines. (#1293)
This change aim to fix the before version `shape_text` (in Element
paint) and `wrap_line` (in TextWrapper cached soft wrap map) may have
difference wrap width.

Now move to based on TextWrapper's wrap map to paint text by use
`shape_line` method.
2025-09-28 10:31:03 +08:00
Jason Lee
4983300ddf
input: Update RopeExt to use LF style for get correct line when have \r. (#1296) 2025-09-28 01:04:14 +08:00
Jason Lee
328da4da21
input: Fix RopeExt replace method may not on a char boundary. (#1295) 2025-09-26 22:27:44 +08:00
Jason Lee
13e2b08873
editor: Improve line number width by max lines. (#1291) 2025-09-25 22:21:09 +08:00
Jason Lee
6b7a481fc8
editor: Improve TextWrapper performance. (#1292) 2025-09-25 20:02:17 +08:00
Jason Lee
9f1423324a
editor: Improve slice_line method performance. (#1290)
Now we can handle more than 200K lines (before is 150K).
2025-09-25 18:54:06 +08:00
Jason Lee
ef1d727c3d
chore: Improve RopeExt API and add more docs. (#1289) 2025-09-25 18:17:46 +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
a6a14fd57b
input: Disable context menu item for disabled input. (#1280) 2025-09-25 16:36:57 +08:00
Jason Lee
16105da122
editor: Avoid trigger hover on selection. (#1287) 2025-09-25 15:50:12 +08:00
Jason Lee
8f5bff61fb
chore: Fix sum_tree API changes. (#1286)
https://github.com/zed-industries/zed/pull/38776
2025-09-25 10:41:37 +08:00
Jason Lee
5aaf8c6a66
input: Fix move cursor to scroll x to viewport. (#1285) 2025-09-24 21:15:13 +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
ca8d595936
editor: Fix line number to use same editor background. (#1282) 2025-09-24 14:14:32 +08:00
Jason Lee
bd3bffaf67
editor: Fix completion width align to longest item. (#1281) 2025-09-24 11:43:59 +08:00
Jason Lee
bf5650b5db
input: Add context menu for cut, copy, paste. (#1279)
Close #27

<img width="756" height="674" alt="image"
src="https://github.com/user-attachments/assets/07884a7e-366b-47b8-8bd7-a88f3cae52b8"
/>
2025-09-23 22:06:58 +08:00
Jason Lee
993ce34bd8
editor: Avoid scroll on select all. (#1277)
- Add `replace_text_in_range_silent` for some case to avoid show
completion, for example on cut, paster ...
- Improve to only call validation, mask on single line mode.
- Improve move cursor to scroll to visible to keep edge 3 lines.

https://github.com/user-attachments/assets/ca8bcca8-a55b-4c98-af7c-7639d1c34923

- Fix `RopeExt::offset_to_position` may crash.
- Add deffered_scroll_offset to improve paste to scroll to cursor.

https://github.com/user-attachments/assets/1af09a50-37f0-47c8-8185-4b78820d064a
2025-09-23 15:59:48 +08:00