Commit Graph

2003 Commits

Author SHA1 Message Date
Conrad Irwin
1f611a9c90
Allow copy-pasting dev-server-token (#11992)
Release Notes:

- N/A
2024-05-17 16:41:46 -06:00
Moritz Bitsch
4dd83da627
Fix hang when opening URL in first browser window (#11961)
If opening a url opens the first browser window the call does not return
completely blocking the ui until the browser window is closed. Using
spawn instead of status does not block, but we will loose the exitstatus
of the browser window.

Release Notes:

- N/A
2024-05-17 11:00:57 -07:00
Conrad Irwin
b890fa71ff
Report an error when trying to open ui in linux::headless (#11952)
Release Notes:

- N/A
2024-05-17 09:50:23 -06:00
Piotr Osiewicz
9d10969906
chore: Fix refining_impl_trait lint occurences (#11979)
These show up when compiling Zed with latest nightly, which means that
we'd have to do it one or two Rust releases down the line.
Release Notes:

- N/A
2024-05-17 16:58:22 +02:00
npmania
b60254feca
x11: Add XIM support (#11657)
This pull request adds XIM (X Input Method) support to x11 platform.

The implementation utilizes [xim-rs](https://crates.io/crates/xim), a
XIM library written entirely in Rust, to provide asynchronous XIM
communication.
Preedit and candidate positioning are fully supported in the editor
interface, yet notably absent in the terminal environment.

This work is sponsored by [Rainlab Inc.](https://rainlab.co.jp/en/)

Release Notes:
- N/A

---------

Signed-off-by: npmania <np@mkv.li>
2024-05-16 15:13:51 -07:00
bbb651
746223427e
wayland: Don't reinvert inverted scroll axes (#11937)
Release Notes:

- Wayland: Fixed Natural Scrolling Being Wrongly Reinverted
([#11874](https://github.com/zed-industries/zed/issues/11874)).
2024-05-16 14:43:46 -07:00
张小白
80caa74866
Support setting font feature values (#11898)
Now (on `macOS` and `Windows`) we can set font feature value:
```rust
  "buffer_font_features": {
    "cv01": true,
    "cv03": 3,
    "cv09": 1,
    "VSAH": 7,
    "VSAJ": 8
  }
```

And one can still use `"cv01": true`.



https://github.com/zed-industries/zed/assets/14981363/3e3fcf4f-abdb-4d9e-a0a6-71dc24a515c2




Release Notes:

- Added font feature values, now you can set font features like `"cv01":
7`.

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-05-16 14:27:55 -07:00
Fernando Tagawa
5596a34311
Wayland: Implement text_input_v3 and xkb compose (#11712)
Release Notes:

- N/A

Fixes #9207 
Known Issues:
- [ ] ~~After launching Zed and immediately trying to change input
method, the input panel will appear at Point{0, 0}~~
- [ ] ~~`ime_handle_preedit` should not trigger `write_to_primary`~~
Move to other PR
- [ ] ~~Cursor is visually stuck at the end.~~ Move to other PR
Currently tested with KDE & fcitx5.
2024-05-16 11:42:43 -07:00
Marshall Bowers
fdadbc7174
Add WithRemSize element (#11928)
This PR adds a new `WithRemSize` element to the `ui` crate.

This element can be used to create an element tree that has a different
rem size than the base window.

`WithRemSize` can be nested, allowing for subtrees that have a different
rem size than their parent and their children.

<img width="912" alt="Screenshot 2024-05-16 at 2 25 28 PM"
src="https://github.com/zed-industries/zed/assets/1486634/f599cd9f-c101-496b-93e8-06e570fbf74f">

Release Notes:

- N/A
2024-05-16 14:37:55 -04:00
Marshall Bowers
c1e291bc96
gpui: Improve Global ergonomics (#11923)
This PR adds some ergonomic improvements when working with GPUI
`Global`s.

Two new traits have been added—`ReadGlobal` and `UpdateGlobal`—that
provide associated functions on any type that implements `Global` for
accessing and updating the global without needing to call the methods on
the `cx` directly (which generally involves qualifying the type).

I looked into adding `ObserveGlobal` as well, but this seems a bit
trickier to implement as the signatures of `cx.observe_global` vary
slightly between the different contexts.

Release Notes:

- N/A
2024-05-16 12:47:43 -04:00
张小白
1b261608c6
Add basic proxy settings (#11852)
Adding `proxy` keyword to configure proxy while using zed. After setting
the proxy, restart Zed to acctually use the proxy.

Example setting: 
```rust
"proxy" = "socks5://localhost:10808"
"proxy" = "http://127.0.0.1:10809"
```

Closes #9424, closes #9422, closes #8650, closes #5032, closes #6701,
closes #11890

Release Notes:

- Added settings to configure proxy in Zed

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-05-16 19:43:26 +03:00
张小白
a1e5f6bb7c
windows: Use DwmFlush() to trigger vsync event (#11731)
Currently , on Windows 10, we used a `Timer` to trigger the vsync event,
but the `Timer`'s time precision is only about 15ms, which means a
maximum of 60FPS. This PR introduces a new function to allow for higher
frame rates on Windows 10.

And after reading the codes, I found that zed triggers a draw after
handling mouse or keyboard events, so we don't need to call draw again
when we handle `WM_*` messages. Therefore, I removed the
`invalidate_client_area` function.

Release Notes:

- N/A
2024-05-15 10:45:17 -07:00
张小白
4ae3396253
Make primary clipboard Linux only (#11843)
I guess only Linux supports the primary clipboard.

Release Notes:

- N/A
2024-05-15 10:44:47 -07:00
张小白
f7c5d70740
macOS: Support all OpenType font features (#11611)
This PR brings support for all `OpenType` font features to
`macOS(v10.10+)`. Now, both `Windows`(with #10756 ) and `macOS` support
all font features.

Due to my limited familiarity with the APIs on macOS, I believe I have
made sure to call `CFRelease` on all variables where it should be
called.

Close #11486 , and I think the official website's
[documentation](https://zed.dev/docs/configuring-zed) can be updated
after merging this PR.

> Zed supports a subset of OpenType features that can be enabled or
disabled for a given buffer or terminal font. The following OpenType
features can be enabled or disabled too: calt, case, cpsp, frac, liga,
onum, ordn, pnum, ss01, ss02, ss03, ss04, ss05, ss06, ss07, ss08, ss09,
ss10, ss11, ss12, ss13, ss14, ss15, ss16, ss17, ss18, ss19, ss20, subs,
sups, swsh, titl, tnum, zero.



https://github.com/zed-industries/zed/assets/14981363/44e503f9-1496-4746-bc7d-20878c6f8a93



Release Notes:

- Added support for **all** `OpenType` font features to macOS.
2024-05-15 18:26:50 +02:00
Thorsten Ball
43d79af94a
metal renderer: Increase instance buffer size dynamically (#11849)
Previously, we had an instance buffer pool that could only allocate
buffers with a fixed size (hardcoded to 2mb). This caused certain scenes
to render partially, e.g. when showing tens of thousands of glyphs on a
big screen.

With this commit, when `MetalRenderer` detects that a scene would be too
large to render using the current instance buffer size, it will:

- Clear the existing instance buffers
- Allocate new instance buffers that are twice as large
- Retry rendering the scene that failed with the newly-allocated buffers
during the same frame.

This fixes #11615.

Release Notes:

- Fixed rendering issues that could arise when having large amounts of
text displayed on a large display. Fixed by dynamically increasing the
size of the buffers used on the GPU.
([#11615](https://github.com/zed-industries/zed/issues/11615)).

Before:


https://github.com/zed-industries/zed/assets/1185253/464463be-b61c-4149-a417-01701699decb


After:



https://github.com/zed-industries/zed/assets/1185253/4feacf5a-d862-4a6b-90b8-317ac74e9851

Co-authored-by: Antonio <me@as-cii.com>
2024-05-15 13:43:06 +02:00
jansol
ba26acc1ed
blade: Fix display of straight underlines (#11818)
Fixes: #11715

(also apply alpha of the color to wavy ones while we're at it)

Release Notes:

- Fixed display of straight underlines when using the blade renderer
(#11715)
2024-05-14 18:03:43 -07:00
Marshall Bowers
5b8bb6237f
Scale UI elements in the editor based on the buffer_font_size (#11817)
This PR adjusts how UI elements are rendered inside of full-size editors
to scale with the configured `buffer_font_size`.

This fixes some issues where UI elements (such as the `IconButton`s used
for code action and task run indicators) would not scale as the
`buffer_font_size` was changed.

We achieve this by changing the rem size when rendering the
`EditorElement`, with a rem size that is derived from the
`buffer_font_size`.

`WindowContext` now has a new `with_rem_size` method that can be used to
render an element with a given rem size. Note that this can only be
called during `request_layout`, `prepaint`, or `paint`, similar to
`with_text_style` or `with_content_mask`.

### Before

<img width="1264" alt="Screenshot 2024-05-14 at 2 15 39 PM"
src="https://github.com/zed-industries/zed/assets/1486634/05ad7f8d-c62f-4baa-bffd-38cace7f3710">

<img width="1264" alt="Screenshot 2024-05-14 at 2 15 49 PM"
src="https://github.com/zed-industries/zed/assets/1486634/254cd11c-3723-488f-ab3d-ed653169056c">

### After

<img width="1264" alt="Screenshot 2024-05-14 at 2 13 02 PM"
src="https://github.com/zed-industries/zed/assets/1486634/c8dad309-62a4-444f-bfeb-a0009dc08c03">

<img width="1264" alt="Screenshot 2024-05-14 at 2 13 06 PM"
src="https://github.com/zed-industries/zed/assets/1486634/4d9a3a52-9656-4768-b210-840b4884e381">

Note: This diff is best viewed with whitespace changes hidden:

<img width="245" alt="Screenshot 2024-05-14 at 2 22 45 PM"
src="https://github.com/zed-industries/zed/assets/1486634/7cb9829f-9c1b-4224-95be-82182017ed90">

Release Notes:

- Changed UI elements within the editor to scale based on
`buffer_font_size` (e.g., code action indicators, task run indicators,
etc.).
2024-05-14 14:34:39 -04:00
Flafy
c8ddde27e1
Fix reveal_path blocks on linux (#11702)
If you go to the file tree and press "x" (which is
"project_panel::RevealInFinder"). It will open the default file
manager(in my case nautilus). But on Linux it makes Zed unresponsive.
This fixes that.

Release Notes:

- Fixed Zed blocked after opening file manager in the file tree on
Linux.
2024-05-14 11:18:45 -07:00
Mikayla Maki
bfc066a1ec
Toss return value (#11815)
Release Notes:

- N/A
2024-05-14 11:17:10 -07:00
张小白
d0dd8bf059
windows: Improve handling of the WM_SETTINGCHANGE (#11738)
This event is broadcast to all windows, so we can handle this message in
the `WindowsWindow` ranther than in `WindowsPlatform`.

Release Notes:

- N/A
2024-05-14 10:57:46 -07:00
张小白
491c04e176
windows: Support multi-monitor (#11699)
Zed can detect changes in monitor connections and disconnections and
provide corresponding feedback. For example, if the current window's
display monitor is disconnected, the window will be moved to the primary
monitor. And now Zed always opens on the monitor specified in
`WindowParams`.

Release Notes:

- N/A
2024-05-14 10:54:18 -07:00
张小白
5154910c64
windows: Update crate Windows from 0.53 to 0.56 (#11662)
Version 0.56 has fixed many of the previous bugs, and one of the bugs
prevent me implementing some functions.

Release Notes:

- N/A
2024-05-14 09:59:55 -07:00
apricotbucket28
d1ee2d0749
wayland: Window controls and drag (#11525)
Based on https://github.com/zed-industries/zed/pull/11046

- Partially fixes #10346 
- Fixes https://github.com/zed-industries/zed/issues/9964

## Features
Window buttons

![image](https://github.com/zed-industries/zed/assets/71973804/1b7e0504-3925-45ba-90b5-5adb55e0d739)

Window drag

![image](https://github.com/zed-industries/zed/assets/71973804/9c509a37-e5a5-484c-9f80-c722aeee4380)

Native window context menu

![image](https://github.com/zed-industries/zed/assets/71973804/048ecf52-e277-49bb-a106-91cad226fd8a)

### Limitations

- No resizing
- Wayland only (though X11 always has window decorations)

### Technical

This PR adds three APIs to gpui.

1. `show_window_menu`: Triggers the native title bar context menu.
2. `start_system_move`: Tells the compositor to start dragging the
window.
3. `should_render_window_controls`: Whether the compositor doesn't
support server side decorations.

These APIs have only been implemented for Wayland, but they should be
portable to other platforms.

Release Notes:

- N/A

---------

Co-authored-by: Akilan Elango <akilan1997@gmail.com>
2024-05-14 09:44:55 -07:00
Antonio Scandurra
a13a92fbbf
Introduce recent files ambient context for assistant (#11791)
<img width="1637" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/5aaec657-3499-42c9-9528-c83728f2a7a1">

Release Notes:

- Added a new ambient context feature that allows showing the model up
to three buffers (along with their diagnostics) that the user interacted
with recently.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-05-14 13:48:36 +02:00
Conrad Irwin
5515ba6043
Extract http from util (#11680)
This avoids the CLI linking libssl etc...

Release Notes:

- N/A
2024-05-10 15:50:20 -06:00
Conrad Irwin
c73d6502d6
Make block_with_timeout more robust (#11670)
The previous implementation relied on a background thread to wake up the
main thread,
which was prone to priority inversion under heavy load.

In a synthetic test, where we spawn 200 git processes while doing a 5ms
timeout, the old version blocked for 5-80ms, the new version blocks for
5.1-5.4ms.

Release Notes:

- Improved responsiveness of the main thread under high system load
2024-05-10 13:10:02 -06:00
Piotr Osiewicz
df00854bbc
gpui: Bump taffy to 0.4.3 again (#11655)
We reverted bump to taffy 0.4.3 following an issue spotted by
@maxdeviant where chat text input was not being rendered correctly:

![image](https://github.com/zed-industries/zed/assets/24362066/9d7e6444-47b1-4ac2-808f-bf10404377c0)
This was an issue with the previous attempt to upgrade to taffy 0.4.0 as
well. We bail early in `compute_auto_height_layout` due to a missing
width:
df190ea846/crates/editor/src/element.rs (L5266)
The same issue is visible in story for auto-height editor (or rather,
the breakage is visible - the editor simply does not render at all
there).

I tracked down the breakage to
https://github.com/DioxusLabs/taffy/pull/573 ; it looks like it
specifically affects editors with auto-height. In taffy <0.4 which we
were using previously, we'd eventually get a proper width for
auto-height EditorElement after having initially computed the size. With
taffy 0.4 however (and specifically that PR mentioned earlier), we're
getting `Size::NONE` in layout phase [^1].
I've noticed though that even with taffy <0.3, the
`known_dimensions.width` was always equal to `available_space.width` in
layout phase. Hence, I went with falling back to `available_space.width`
when it is a definite value and we don't have a
`known_dimensions.width`.
Done this way, both chat input and auto-height story render correctly.
/cc @as-cii 
Related:
https://github.com/zed-industries/zed/pull/11606
https://github.com/zed-industries/zed/pull/11622
https://github.com/zed-industries/zed/pull/7868
https://github.com/zed-industries/zed/pull/7896

[^1]: This could possibly be related to change in what gets passed in
https://github.com/DioxusLabs/taffy/pull/573/files#diff-60c916e9b0c507925f032cecdde6ae163e41b84b8e4bc0a6c04f7d846b0aad9eR133
, though I'm not sure if editor is a leaf node in this case

Release Notes:

- N/A
2024-05-10 15:05:50 +02:00
Conrad Irwin
0c2d71f1ac
Remove 'Destructive' prompts (#11631)
While these would match how macOS handles this scenario, they crash on
Catalina, and require mouse clicks to interact.

cc @bennetbo



Release Notes:

- N/A
2024-05-09 18:52:09 -06:00
张小白
95e246ac1c
windows: Better dispatcher (#11485)
This PR leverages a more modern Windows API to implement
`WindowsDispatcher`, aligning its implementation more closely with that
of the `macOS` platform. The following improvements have been made:

1. Similar to `macOS`, there is no longer a need to use `sender` and
`receiver` to dispatch a `Runnable` on the main thread.
2. There is also no longer a need to use an `Event` for synchronization.
3. Consistent with #7506 and #11269, `Runnable` is now executed with
high priority.

However, this PR raises the minimum Windows version requirement of
`GPUI` to Windows 10, specifically Windows 10 Fall Creators Update
(10.0.16299). However, the `alacritty_terminal` dependency in Zed relies
on `conPTY` on Windows, an API introduced in the Windows 10 Fall
Creators Update. Therefore, the impact of this PR on Zed should be
minimal. I'd like to hear your voices about this PR, especially about
the minimum Windows version bumping.

Release Notes:

- N/A
2024-05-09 14:24:57 -07:00
Piotr Osiewicz
f0af508ae5
Revert "chore: Bump taffy version to 0.4.3" (#11622)
Reverts zed-industries/zed#11606
2024-05-09 19:11:37 +02:00
Piotr Osiewicz
3bd53d0441
chore: Bump taffy version to 0.4.3 (#11606)
Taffy 0.4 has been released 2 months ago. We've been using an older
commit from their 0.4 development branch since November.
Compared to the commit we were pinned to, the following relevant changes
have been made:
-
563d5dcee7
-
64f8aa0fb1
-
70b35712a2

![image](https://github.com/zed-industries/zed/assets/24362066/ffdfae03-2743-496f-bb21-7aa38462178f)

Release Notes:

- N/A
2024-05-09 12:51:53 +02:00
Piotr Osiewicz
bd6d385817
gpui: Pass Style by value to request_layout (#11597)
A minor thing I've spotted and decided to fix on the spot.
It was being cloned twice within the body of that function (one of which
was redundant even without this PR); now in most cases we go down from 2
clones to 0.
Release Notes:

- N/A
2024-05-09 11:38:53 +02:00
Antonio Scandurra
5df1481297
Introduce a new markdown crate (#11556)
This pull request introduces a new `markdown` crate which is capable of
parsing and rendering a Markdown source. One of the key additions is
that it enables text selection within a `Markdown` view. Eventually,
this will replace `RichText` but for now the goal is to use it in the
assistant revamped assistant in the spirit of making progress.

<img width="711" alt="image"
src="https://github.com/zed-industries/zed/assets/482957/b56c777b-e57c-42f9-95c1-3ada22f63a69">

Note that this pull request doesn't yet use the new markdown renderer in
`assistant2`. This is because we need to modify the assistant before
slotting in the new renderer and I wanted to merge this independently of
those changes.

Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Alp <akeles@umd.edu>
Co-authored-by: Zachiah Sawyer <zachiah@proton.me>
2024-05-09 11:03:33 +02:00
张小白
9772b7ac33
windows: Fix Zed freezing when resuming from sleep (#11589)
It seems that on the first frame after the system resumes from sleep,
`dcomp_vsync_fn` mistakenly detects the `timer_stop_event` triggering
and exits the loop.

Release Notes:

- N/A
2024-05-08 20:15:32 -07:00
CharlesChen0823
2e0811e113
windows: Improve platform clipboard (#11553)
I thought platform clipboard should share one ctx. and fixed in vim
mode, read from clipboard crash when using `unwrap`.

Release Notes:

- N/A
2024-05-08 16:09:13 -07:00
Conrad Irwin
24ffa0fcf3
Don't panic on failure to allocate an AtlasTile (#11579)
Release Notes:

- Fixed a panic in graphics allocation
2024-05-08 15:47:15 -06:00
Dzmitry Malyshau
a89dc8c42e
blade: Switch to linear color space (#11534)
Release Notes:

- N/A

## What

Addresses a long-standing issue of doing the blending operations in sRGB
space. Currently, the input HSL colors are provided in sRGB space and
converted to linear in the vertex shader. Conversion back to sRGB, which
is required on most platforms today, happens at the very end of the
pipeline when writing into sRGB render target.

Note-1: in the future we may consider doing HSL -> sRGB -> Linear
transform on CPU before feeding into shaders. However, I don't expect
any significant difference here given that we are likely bound by fill
rate and pixel shaders, anyway.

Note-2: the graphics stack is programmed to detect if the platform
supports presenting in linear color space and avoids converting to sRGB
at the end in this case. However, on my Z13 laptop this isn't supported
by the RADV driver.

Closes #7684 
Closes #11462
@jansol please confirm if you can!

## Comparison

Screenshot of the Glazier theme before the change:

![glazier-old](https://github.com/zed-industries/zed/assets/107301/6a9552e1-0819-4a4e-8121-8d62ec012bf4)
Same theme after the change:

![glazier-new](https://github.com/zed-industries/zed/assets/107301/4e61c422-4a4b-4c4b-84a3-55680626d681)
2024-05-08 12:47:29 -07:00
张小白
4b98c35d68
windows: Let IME early return in vim mode (#11551)
This PR follows up #11387 , slightly changes the IME window behavior to
match macOS implementation.

Release Notes:

- N/A
2024-05-08 11:01:48 -07:00
张小白
5103995c32
windows: Fix incorrect font rendering (#11545)
Previously, `DirectWrite` had been following the text system
implementation on `macOS`, using the font's postscript name to
differentiate between different font faces. However, I noticed
occasional rendering issues, such as fonts incorrectly rendering as
italics. Later, I discovered that on `Windows`, the postscript name is
**not** unique. Surprisingly, even the same font can have different
postscript names on macOS and Windows! It's hard to believe! The
postscript name of a font face should be obtained from the same font
table. Why would the same font face have different names?

For example, the postscript name of ZedMono on `macOS` is
`Zed-Mono-Bold-Extended-Italic`, while on `Windows`, it is
`Zed-Mono-Extended`, missing weight and style information, leading to
incorrect rendering.

This PR introduces a `FontIdentifier` struct to uniquely identify font
faces.

Release Notes:

- N/A
2024-05-08 10:58:31 -07:00
张小白
fb4c6dbaa7
windows: Implement ResizeColumn and ResizeRow cursor style (#11533)
This PR follows up #11406

Release Notes:

- N/A
2024-05-08 10:57:09 -07:00
LoganDark
91c1716858
Fix horizontal scrolling direction on Windows (#11520)
As per Microsoft documentation, positive values scroll right, not left.
GPUI was incorrectly assuming it perfectly mirrored vertical scrolling.

Fixes #11515

Release Notes:

- N/A
2024-05-08 10:56:31 -07:00
Thorsten Ball
dbebb40956
linux: Store binary path before restart to handle deleted binary file (#11568)
This fixes restart after updates not working on Linux.

On Linux we can't reliably get the binary path after an update, because
the original binary was deleted and the path will contain ` (deleted)`.

See: https://github.com/rust-lang/rust/issues/69343

We *could* strip ` (deleted)` off, but that feels nasty. So instead we
save the original binary path, before we do the installation, then
restart.

Later on, we can also change this to be a _new_ binary path returned by
the installers, which we then have to start.


Release Notes:

- N/A
2024-05-08 19:13:28 +02:00
张小白
63a5f46df4
Remember window restore size (#10429)
Now, regardless of how the Zed window is closed, Zed can remember the
window's restore size.

- [x] Windows implementation
- [x] macOS implementation
- [x] Linux implementation (partial)
- [x] update SQL data base (mark column `fullscreen` as deprecated)

The current implementation on Linux is basic, and I'm not sure if it's
correct.

The variable `fullscreen` in SQL can be removed, but I'm unsure how to
do it.
edit: mark `fullscreen` as deprecated

### Case 1

When the window is closed as maximized, reopening it will open in the
maximized state, and returning from maximized state will restore the
position and size it had when it was maximized.



https://github.com/zed-industries/zed/assets/14981363/7207752e-878a-4d43-93a7-41ad1fdb3a06


### Case 2

When the window is closed as fullscreen, reopening it will open in
fullscreen mode, and toggling fullscreen will restore the position and
size it had when it entered fullscreen (note that the fullscreen
application was not recorded in the video, showing a black screen, but
it had actually entered fullscreen mode).



https://github.com/zed-industries/zed/assets/14981363/ea5aa70d-b296-462a-afb3-4c3372883ea3

### What's more

- As English is not my native language, some variable and struct names
may need to be modified to match their actual meaning.
- I am not familiar with the APIs related to macOS and Linux, so
implementation for these two platforms has not been done for now.
- Any suggestions and ideas are welcome.

Release Notes:

- N/A
2024-05-07 23:29:03 -06:00
张小白
c260f7d5ac
Refactor Windows platform implementation (#11393)
This aligns the Windows platform implementation with a code style
similar to macOS platform, eliminating most of the `Cell`s and
`Mutex`es. This adjustment facilitates potential future porting to a
multi-threaded implementation if required.

Overall, this PR made the following changes: it segregated all member
variables in `WindowsPlatform` and `WindowsWindow`, grouping together
variables that remain constant throughout the entire app lifecycle,
while placing variables that may change during app runtime into
`RefCell`.

Edit: 
During the code refactoring process, a bug was also fixed.

**Before**: 
Close window when file has changed, nothing happen:


https://github.com/zed-industries/zed/assets/14981363/0bcda7c1-808c-4b36-8953-a3a3365a314e

**After**:
Now `should_close` callback is properly handled


https://github.com/zed-industries/zed/assets/14981363/c8887b72-9a0b-42ad-b9ab-7d0775d843f5


Release Notes:

- N/A
2024-05-07 09:49:39 -07:00
Thorsten Ball
4eedbdedae
linux: Use optional compile-time RELEASE_VERSION variable (#11490)
This implements `app_version` on Linux by using an optional,
compile-time `RELEASE_VERSION` env var that can be set.

We settled on the `RELEASE_VERSION` as the name, since it's similar to
`RELEASE_CHANNEL` which we use in Zed.

cc @ConradIrwin @mikayla-maki 

Release Notes:

- N/A

Co-authored-by: Bennet <bennetbo@gmx.de>
2024-05-07 17:50:19 +02:00
Thorsten Ball
5a7b8f7fe3
linux: Fix restarting by waiting for sockets to be closed (#11488)
This fixes a race-condition that showed up when trying to restart
Nightly/Preview/...

When running with these release channels, Zed tries to ensure that
there's only one instance of Zed running.

It does that by listening on a TCP socket to which other instances can
connect on start. If the other instance receives a message, it knows
that another Zed instance is running and exits.

On Linux, though, we ran into a race condition:

1. `kill -0`, which checks whether a process is still running, returns
an error, signalling that the old Zed process has exited
2. BUT: the process was still listening on the TCP port.

It seems like that on Linux, process resources aren't guaranteed to be
cleaned up as soon as signal handling stops working for a process.

The fix is to wait until the process is no longer listening on any TCP
sockets.

There's a slight downside to this: GPUI processes that never listen on
any TCP sockets now have to pay the cost of an additional `lsof` call
when restarting. We do think that it's a reasonable tradeoff for now
though, since the other options (extending the platform interface to
provide callbacks, sharing the listening port in the framework, ...)
seem wider-reaching only to fix a very local bug.



Release Notes:

- N/A

Co-authored-by: Bennet <bennetbo@gmx.de>
2024-05-07 15:46:41 +02:00
jansol
d6a6330419
gpui/blade: add alpha handling for non-rounded quads (#11461)
Fixes
https://github.com/zed-industries/zed/pull/10973#issuecomment-2096586316

Release Notes:

- N/A
2024-05-06 14:38:00 -07:00
Soroush Mirzaei
da6a6ec36b
Add col/row resize cursor styles (#11406)
This PR fixes a small issue I noticed with resize cursors. The
column/row resize cursors were missing and in a few places we were using
`ew-resize` and `ns-resize` even though the documentation mentions
`col-resize` and `row-resize`.

Finally updated the panes in the workspace to use the new column/row
resize cursors.

Before:

![Screenshot_20240505_111515](https://github.com/zed-industries/zed/assets/829535/50f28a1b-33e2-431a-8fc8-5048d89c8f7b)

![Screenshot_20240505_111521](https://github.com/zed-industries/zed/assets/829535/45856f7e-4ca9-4b39-9f8c-144934e9d41e)

After:

![Screenshot_20240505_110606](https://github.com/zed-industries/zed/assets/829535/2b247ec1-44ef-4293-87b3-7fda4b2ebf8f)

![Screenshot_20240505_110611](https://github.com/zed-industries/zed/assets/829535/b558e1ce-3e08-4de3-8a11-6a80184d84fe)



Release Notes:

- Added column/row resize cursor styles to GPUI
- Fixed the existing references that were incorrectly using `ew-resize`
for column resize and `ns-resize` for row resize
- Updated panes to use column/row resize cursors instead on `ew-resize`
and `ns-resize`

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-05-06 14:22:56 -07:00
CharlesChen0823
530bc5c99e
windows: Fix crash in vim normal mode when IME key is pressed (#11387)
Fixed crash in vim normal mode when ime key press.

Release Notes:

- N/A
2024-05-06 13:31:49 -07:00
apricotbucket28
11bc28080f
linux: Fix some small issues (#11458)
Fixed various small issues on Linux, mainly on Wayland.

Apart from the first commit (which should be self-describing), the other
commits have a description explaining the issue and what they do.

caadc58bea should fix
https://github.com/zed-industries/zed/issues/11037

Release Notes:

- N/A
2024-05-06 13:23:49 -07:00