Commit Graph

2265 Commits

Author SHA1 Message Date
Marshall Bowers
89632ff5c2
gpui: Fix typo in DefaultThemeAppearance doc comment (#17157)
Release Notes:

- N/A
2024-08-30 09:48:13 -04:00
Jason Lee
0835d456dc
gpui: Fix text ellipsis appearing even the flex element has space (#17149)
Release Notes:

- N/A

There was a calculation bug before. When we added `text_ellipsis` to the
flex element, it would always show ellipsis no matter how long it was.

Actually we can't use `flex` and `text_ellipsis` at same time, the CSS
also not support this. But this bug will let user confuse.

### Before

<img width="731" alt="image"
src="https://github.com/user-attachments/assets/b7d60017-6785-45f5-8b40-dd5efa154a1e">

### After

<img width="521" alt="image"
src="https://github.com/user-attachments/assets/a3117793-284e-48d4-8c15-059fe61abe60">
2024-08-30 09:01:46 -04:00
Nate Butler
01f8d27f22
Add a simple set of default colors to gpui (#17110)
This PR adds an initial set of default colors to `gpui`. 

These will power default-styled gpui components (things like checkboxes,
buttons, inputs, etc.), storybook, and give a very simple,
appearance-aware set of colors out of the box for folks to build with.

These colors will evolve and be updated in the near future, they are
literally pulled from Finder for now :)

The API might not be perfect, I focused on getting something in quickly
that we can iterate on!

### Usage

```rs
use gpui::{colors, DefaultColor}

fn auto(cx: &WindowContext) -> {
  // Init the full set of DefaultColors
  let colors = colors(cx.appearance());
  // Use a color
  // It will automatically give you the correct color for the system's
  // current appearance.
  let background = DefaultColor::Background.hsla(&colors)
}

fn manual() -> {
  // Init the full sets of DefaultColors
  let light_colors = DefaultColors::light();
  let dark_colors = DefaultColors::dark();
  // Use a color
  // Maybe for some fancy inverted element
  let background = DefaultColor::Background.hsla(&light_colors)
  let inverted_background = DefaultColor::Background.hsla(&dark_colors)
  let inverted_text = DefaultColor::Text.hsla(&dark_colors)
}

```

Note: We need `cx` for the auto way as we need to get the system
appearance from the App/Window/ViewContext via `cx.appearance()`.

### Example

You can run `script/storybook default_colors` to open the Default Colors
story:

| Light | Dark |
|-------|------|
| ![CleanShot 2024-08-29 at 16 19
20@2x](https://github.com/user-attachments/assets/80369de4-8926-4b30-80f5-f81a8a7b9531)
| ![CleanShot 2024-08-29 at 16 19
33@2x](https://github.com/user-attachments/assets/fd7a2aae-27e6-460f-a054-8f37623dc96d)
|


Release Notes:

- N/A
2024-08-29 16:50:03 -04:00
张小白
64fa7a5234
Set *_font_fallbacks default to None (#16941)
In the current `default.json`, `*_font_fallbacks=[]`, which results in
the `fallbacks` value in the `Font` struct always being `Some(...)`.

This PR introduces the following improvements:
1. Changed `*_font_fallbacks = []` to `*_font_fallbacks = null` in
`default.json`.
2. Enhanced the macOS and Windows implementations.

Release Notes:

- N/A
2024-08-28 22:30:46 -07:00
renovate[bot]
5d5ae1ec6f
Update Rust crate bindgen to 0.70.0 (#17024)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bindgen](https://rust-lang.github.io/rust-bindgen/)
([source](https://togithub.com/rust-lang/rust-bindgen)) |
build-dependencies | minor | `0.65.1` -> `0.70.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust-bindgen (bindgen)</summary>

###
[`v0.70.1`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0701-2024-08-20)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.70.0...v0.70.1)

#### Added

#### Changed

#### Removed

#### Fixed

- Fix regression where the `const` layout tests were triggering the
`unnecessary_operation` and `identity_op` clippy warnings.

#### Security

###
[`v0.70.0`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0700-2024-08-16)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.69.4...v0.70.0)

#### Added

-   Add target mappings for riscv64imac and riscv32imafc.
- Add a complex macro fallback API
([#&#8203;2779](https://togithub.com/rust-lang/rust-bindgen/issues/2779)).
- Add option to use DST structs for flexible arrays (--flexarray-dst,
[#&#8203;2772](https://togithub.com/rust-lang/rust-bindgen/issues/2772)).
- Add option to dynamically load variables
([#&#8203;2812](https://togithub.com/rust-lang/rust-bindgen/issues/2812)).
- Add option in CLI to use rustified non-exhaustive enums
(--rustified-non-exhaustive-enum,
[#&#8203;2847](https://togithub.com/rust-lang/rust-bindgen/issues/2847)).

#### Changed

- Remove which and lazy-static dependencies
([#&#8203;2809](https://togithub.com/rust-lang/rust-bindgen/issues/2809),
[#&#8203;2817](https://togithub.com/rust-lang/rust-bindgen/issues/2817)).
- Generate compile-time layout tests
([#&#8203;2787](https://togithub.com/rust-lang/rust-bindgen/issues/2787)).
- Print `bindgen-cli` errors to stderr instead of stdout
([#&#8203;2840](https://togithub.com/rust-lang/rust-bindgen/issues/2840))

#### Removed

#### Fixed

- Fix `--formatter=prettyplease` not working in `bindgen-cli` by adding
`prettyplease` feature and
enabling it by default for `bindgen-cli`
([#&#8203;2789](https://togithub.com/rust-lang/rust-bindgen/issues/2789))
.
- Fix `--allowlist-item` so anonymous enums are no longer ignored
([#&#8203;2827](https://togithub.com/rust-lang/rust-bindgen/issues/2827)).
- Use clang_getFileLocation instead of clang_getSpellingLocation to fix
clang-trunk
([#&#8203;2824](https://togithub.com/rust-lang/rust-bindgen/issues/2824)).
- Fix generated constants: `f64::INFINITY`, `f64::NEG_ INFINITY`,
`f64::NAN`
([#&#8203;2854](https://togithub.com/rust-lang/rust-bindgen/issues/2854)).

#### Security

- Update `tempfile` and `rustix` due to
[GHSA-c827-hfw6-qwvm](https://togithub.com/advisories/GHSA-c827-hfw6-qwvm).

###
[`v0.69.4`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0694-2024-02-04)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.69.3...v0.69.4)

#### Added

#### Changed

- Allow older itertools.
([#&#8203;2745](https://togithub.com/rust-lang/rust-bindgen/issues/2745))

#### Removed

#### Fixed

#### Security

###
[`v0.69.3`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0693-2024-02-04)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.69.2...v0.69.3)

#### Added

- Added blocklist_var
([#&#8203;2731](https://togithub.com/rust-lang/rust-bindgen/issues/2731))
- Stabilized thiscall_abi
([#&#8203;2661](https://togithub.com/rust-lang/rust-bindgen/issues/2661))

#### Changed

- Use CR consistently on windows
([#&#8203;2698](https://togithub.com/rust-lang/rust-bindgen/issues/2698))
- Replaced peeking_take_while by itertools
([#&#8203;2724](https://togithub.com/rust-lang/rust-bindgen/issues/2724))

#### Removed

#### Fixed

- Try to avoid repr(packed) for explicitly aligned types when not needed
([#&#8203;2734](https://togithub.com/rust-lang/rust-bindgen/issues/2734))
- Improved destructor handling on Windows
([#&#8203;2663](https://togithub.com/rust-lang/rust-bindgen/issues/2663))
- Support Float16
([#&#8203;2667](https://togithub.com/rust-lang/rust-bindgen/issues/2667))
- Fix alignment contribution from bitfields
([#&#8203;2680](https://togithub.com/rust-lang/rust-bindgen/issues/2680))
-   Fixed msrv build.

#### Security

-   Updated shlex dependency (RUSTSEC-2024-0006)

###
[`v0.69.2`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0692-2024-01-13)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.69.1...v0.69.2)

#### Added

#### Changed

#### Removed

#### Fixed

- Fixed generation of extern "C" blocks with llvm 18+. See
[#&#8203;2689](https://togithub.com/rust-lang/rust-bindgen/issues/2689).

#### Security

###
[`v0.69.1`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0691-2023-11-02)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.69.0...v0.69.1)

#### Fixed

-   Allow to run `bindgen -v` without an input header argument.

###
[`v0.69.0`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0690-2023-11-01)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.68.1...v0.69.0)

#### Added

- Added the `ParseCallbacks::header_file` callback which runs on every
filename passed to `Builder::header`.
- Added the `CargoCallbacks::new` constructor which emits a cargo-rerun
line
    for every input header file by default.
- Added the `CargoCallbacks::rerun_on_header_files` method to configure
whether
    a cargo-rerun line should be emitted for every input header file.

#### Changed

- The `--wrap-static-fns` feature was updated so function types that has
no
    argument use `void` as its sole argument.
-   `CargoCallbacks` is no longer a [unit-like
struct](https://doc.rust-lang.org/reference/items/structs.html) and the
`CargoCallbacks` constant was added to mitigate the breaking nature of
this
change. This constant has been marked as deprecated and users will have
to
    use the new `CargoCallbacks::new` method in the future.

#### Removed

#### Fixed

-   Allow compiling `bindgen-cli` with a static libclang.
- Emit an opaque integer type for pointer types that don't have the same
size
    as the target's pointer size.
- Avoid escaping Objective-C method names unless they are `Self`,
`self`,
    `crate` or `super`.

#### Security

###
[`v0.68.1`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0681)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.68.0...v0.68.1)

#### Fixed

-   Fixed errors on the windows artifact build process.

###
[`v0.68.0`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0680)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.66.1...v0.68.0)

#### Added

- The `system` ABI is now supported as an option for the
`--override-abi` flag.
- The `allowlist_item` method and the `--allowlist-item` flag have been
    included to filter items regardless or their kind.
-   Include installers as release artifacts on Github.

#### Changed

- The `Clone` implementation for `_BindgenUnionField` has been changed
to pass
    the `incorrect_clone_impl_on_copy_type` Clippy lint.
- The `c_unwind` ABI can be used without a feature gate for any Rust
target version
    equal to or greater than 1.71.
    This comes as a result of the ABI being stabilised (in Rust 1.71).
- Formatting changes when using prettyplease as a formatter due to a new
    prettyplease version.
- Avoid generating invalid `CStr` constants when using the
`--generate-cstr`
    option.

#### Removed

- The `extra_assert` and `extra_assert_eq` macros are no longer
exported.

#### Fixed

- Bindgen no longer panics when parsing an objective-C header that
includes a
Rust keyword that cannot be a raw identifier, such as: `self`, `crate`,
    `super` or `Self`.

###
[`v0.66.1`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0661)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.66.0...v0.66.1)

#### Removed

- Revert source order sorting
([#&#8203;2543](https://togithub.com/rust-lang/rust-bindgen/issues/2543))
due to correctness regressions
[#&#8203;2558](https://togithub.com/rust-lang/rust-bindgen/issues/2558).

###
[`v0.66.0`](https://togithub.com/rust-lang/rust-bindgen/blob/HEAD/CHANGELOG.md#0660)

[Compare
Source](https://togithub.com/rust-lang/rust-bindgen/compare/v0.65.1...v0.66.0)

#### Added

- Added the `--generate-cstr` CLI flag to generate string constants as
`&CStr`
    instead of `&[u8]`. (Requires Rust 1.59 or higher.)
- Added the `--generate-shell-completions` CLI flag to generate
completions for
    different shells.
- The `--wrap-static-fns` option can now wrap `va_list` functions as
variadic functions
    with the experimental `ParseCallbacks::wrap_as_variadic_fn` method.
-   Add target mappings for riscv32imc and riscv32imac.
- Add the `ParseCallbacks::field_visibility` method to modify field
visibility.

#### Changed

- Non-UTF-8 string constants are now generated as references (`&[u8;
SIZE]`)
    instead of arrays (`[u8; SIZE]`) to match UTF-8 strings.
- Wrappers for static functions that return `void` no longer contain a
`return`
    statement and only call the static function instead.
- The `--wrap-static-fns` option no longer emits wrappers for static
variadic
    functions.
- Depfiles generated with `--depfile` or `Builder::depfile` will now
properly
generate module names and paths that include spaces by escaping them. To
make
    the escaping clear and consistent, backslashes are also escaped.
- Updated `bitflags` dependency to 2.2.1. This changes the API of
`CodegenConfig`.
- Prettyplease formatting is gated by an optional, enabled by default
Cargo
    feature when depending on `bindgen` as a library.
- Items are now parsed in the order they appear in source files. This
may result in
    auto-generated `_bindgen_*` names having a different index.
- Use default visibility for padding fields: Previously, padding fields
were
always public. Now, they follow the default visibility for the type they
are
    in.
- Compute visibility of bitfield unit based on actual field visibility:
A
bitfield unit field and its related functions now have their visibility
determined based on the most private between the default visibility and
the
    actual visibility of the bitfields within the unit.

#### Removed

-   Remove redundant Cargo features, which were all implicit:
- bindgen-cli: `env_logger` and `log` removed in favor of `logging`
    -   bindgen (lib):
        -   `log` removed in favor of `logging`
        -   `which` removed in favor of `which-logging`
        -   `annotate-snippets` removed in favor of `experimental`

-   Prettyplease is available as a `Formatter` variant now.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzguNTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-28 22:12:49 -07:00
renovate[bot]
eb0b6d57e3
Update Rust crate cocoa to 0.26 (#17036)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [cocoa](https://togithub.com/servo/core-foundation-rs) | dependencies
| minor | `0.25` -> `0.26` |
| [cocoa](https://togithub.com/servo/core-foundation-rs) |
workspace.dependencies | minor | `0.25` -> `0.26` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these
updates again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzguNTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-28 21:57:26 -07:00
张小白
403fdd6018
windows: Fix autohide taskbar dosen't automatically appear when Zed is maximized (#16806)
Closes #12313

This PR introduces the following improvements:
1. Fixed the issue where the auto-hide taskbar wouldn't automatically
appear when Zed is maximized.
2. Refactored the `WM_NCCALCSIZE` code, making it more human-readable.

Release Notes:

- Fixed auto-hide taskbar would refuse to show itself when `Zed` is
maximized on
Winodws([#12313](https://github.com/zed-industries/zed/issues/12313)).

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-08-28 20:36:28 -07:00
apricotbucket28
a68a543d43
linux: Prompt library fixes (#16850)
This PR fixes two issues:
1. The prompt library window didn't set an `app_id` on Linux, which
caused it to be missing the Zed logo
2. A dangling reference to the window in the Wayland client code, which
caused the prompt library window not to close. See:
https://github.com/zed-industries/zed/pull/13201

Release Notes:

- Linux: Fixed the prompt library not closing on Wayland

---------

Co-authored-by: Junkui Zhang <364772080@qq.com>
2024-08-28 20:11:01 -07:00
张小白
9ad845b40a
windows: Implement theme changed events (#16207)
Closes [#16198](https://github.com/zed-industries/zed/issues/16198)

AFAIK, when the system's theme mode or accent color changes, there are
typically two types of broadcast messages:

1. A `WM_SETTINGCHANGE` message, where `lParam` points to the string
"ImmersiveColorSet".
2. A `WM_DWMCOLORIZATIONCOLORCHANGED` message.

I use `WM_DWMCOLORIZATIONCOLORCHANGED` here for simplicity.


https://github.com/user-attachments/assets/422f8e4e-c698-4e7c-8d2d-01f453b9a7b3


Release Notes:

- N/A
2024-08-28 20:05:19 -07:00
Fernando Tagawa
8e8927db4b
linux: Fix IME panel position while enumerating input methods (#12495)
Release Notes:

- N/A

This updates the IME position every time the selection changes, this is
probably only useful when you enumerate languages with your IME.

TODO:
- ~There is a rare chance that the ime panel is not updated because the
window input handler is None.~
- ~Update IME panel in vim mode.~
- ~Update IME panel when leaving Buffer search input.~

---------

Co-authored-by: Mikayla Maki <mikayla@zed.dev>
2024-08-28 19:58:40 -07:00
张小白
aec8fb7e37
windows: Refactor prompt_for_paths and prompt_for_new_path (#15774)
Refactored `prompt_for_paths` and `prompt_for_new_path`, now errors can
propagate properly.

Release Notes:

- N/A
2024-08-28 19:51:39 -07:00
张小白
e8dfc30314
windows: Fix IME window position on Win10 (#15471)
On Windows, different input methods use different APIs to set their
window positions:
- The Japanese input method on Windows 11 uses `ImmSetCandidateWindow`.
- The Chinese input method on Windows 10 uses `ImmSetCompositionWindow`.
- The Chinese input method on Windows 11 can use either.

Therefore, this PR calls both functions to cover the various scenarios.

Additionally, introduced a helper function `with_input_handler` to
improve code readability.

Release Notes:

- N/A
2024-08-28 19:29:53 -07:00
Marshall Bowers
b374c7d912
Fix casing of "macOS" (#17040)
This PR fixes a number of spots in English contexts (docs, comments,
etc.) where we were using "MacOS" instead of "macOS".

Release Notes:

- N/A
2024-08-28 19:10:49 -04:00
renovate[bot]
0b6dc3e6c2
Update Rust crate cbindgen to 0.27.0 (#17033)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [cbindgen](https://togithub.com/mozilla/cbindgen) | build-dependencies
| minor | `0.26.0` -> `0.27.0` |

---

### Release Notes

<details>
<summary>mozilla/cbindgen (cbindgen)</summary>

###
[`v0.27.0`](https://togithub.com/mozilla/cbindgen/blob/HEAD/CHANGES#0270)

[Compare
Source](https://togithub.com/mozilla/cbindgen/compare/0.26.0...v0.27.0)

-   Revert: The `Config` struct now has a private member.
\* Allow users to specify a crate version for bindings generation
([#&#8203;901](https://togithub.com/mozilla/cbindgen/issues/901)).
\* Update MSRV to 1.74
([#&#8203;912](https://togithub.com/mozilla/cbindgen/issues/912),
[#&#8203;987](https://togithub.com/mozilla/cbindgen/issues/987)).
\* Support #\[deprecated] on enum variants
([#&#8203;933](https://togithub.com/mozilla/cbindgen/issues/933)).
\* Support integrating the package_version information in a header file
comment
([#&#8203;939](https://togithub.com/mozilla/cbindgen/issues/939)).
\* Add a language backend
([#&#8203;942](https://togithub.com/mozilla/cbindgen/issues/942)).
\* Support generics with defaulted args
([#&#8203;959](https://togithub.com/mozilla/cbindgen/issues/959)).
\* Add `VaList` compatibility
([#&#8203;970](https://togithub.com/mozilla/cbindgen/issues/970)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 3pm on Wednesday" in timezone
America/New_York, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

Release Notes:

- N/A

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzguNTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-08-28 18:41:04 -04:00
Piotr Osiewicz
4ec1f29df0
chore: Make some of the deps of gpui optional (#16986)
Minor bookkeeping, that takes down dep count of gpui from 454 to 430 for
me.

Release Notes:

- N/A
2024-08-28 10:05:50 +02:00
张小白
60af9dd4b1
Add .SystemUIFont to font list (#15340)
As discussed in #15326, this font name should be included in the font
list since `settings.json` indicates that one can set the font to
`.SystemUIFont`.

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-27 09:23:24 -04:00
Peter Tripp
d3d0c043f5
Support extended keys on Mac (insert, f13-f19) (#16921)
- Improved support for extended keyboards on Mac (F13-F19, Insert)
2024-08-27 09:09:57 -04:00
Piotr Osiewicz
226ec9d404
gpui: Fix performance of app menu opening with large # of windows (#16939)
This is officially my weirdest performance fix to date; With large # of
windows opening app menu could take a lot of time (we're talking few
seconds with 9 windows, a minute with 10 windows). The fix is to make
one method pub(crate).. What?

<img width="981" alt="image"
src="https://github.com/user-attachments/assets/83b26154-0acd-43ef-84b3-4b85cde36120">

We were spending most of the time on clear_pending_keystrokes, which -
funnily enough - called itself recursively. It turned out we have two
methods; `AppContext::clear_pending_keystrokes` and
WindowContext::clear_pending_keystrokes. The former calls the latter,
but - due to the fact that `WindowContext::clear_pending_keystrokes` is
private and `WindowContext` derefs to `AppContext` - `AppContext` one
ended up actually calling itself! The fix is plain and simple - marking
WindowContext one as pub(crate), so that it gets picked up as a method
to call over `AppContext::clear_pending_keystrokes`.

Closes #16895



Release Notes:

- Fixed app menu performance slowdowns when there are multiple windows
open.
2024-08-27 12:23:00 +02:00
apricotbucket28
29745ae229
blade: Align rasterized path bounds to whole pixels (#16784)
Related: https://github.com/zed-industries/zed/pull/15822

| Before | After |
| --- | --- |
|
![image](https://github.com/user-attachments/assets/4c4ed1e7-b639-44ce-b318-8cdaaee809ee)|
![image](https://github.com/user-attachments/assets/c2757528-eef3-4d21-9522-39b2597a96b7)
|
|
![image](https://github.com/user-attachments/assets/b70ee108-bea6-4e5e-9583-392d1163d236)
|
![image](https://github.com/user-attachments/assets/aefc1f0c-7bba-4287-a3f9-bbb9befb6a4c)
|

Release Notes:

- N/A
2024-08-27 01:26:59 +03:00
Kirill Bulatov
55dda0e6af
A set of small fixes (#16849)
* Linux Clippy lints fixed
* Zed local tasks are now simpler to rerun
* Zed's `release-fast` build profile keeps the debug info so it's
possible to properly debug things without altering the sources

Release Notes:

- N/A
2024-08-26 02:24:08 +03:00
Walter de Jong
14f8d3a33a
gpui: Send correct kill signal on Linux (#16797)
should be kill -0 (zero) instead

Related to #14291 and #14310

Release Notes:

- N/A
2024-08-24 22:11:06 +03:00
Jason Lee
938d93a64c
gpui: Add truncate and text_ellipsis to TextStyle (#14850)
Release Notes:

- N/A

Ref issue #4996

## Demo

```
cargo run -p gpui --example text_wrapper 
```



https://github.com/user-attachments/assets/a7fcebf7-f287-4517-960d-76b12722a2d7

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-23 14:02:51 -04:00
张小白
69e76a3bb9
Refactor all_font_names (#15345)
In the current code implementation, it seems that the only difference
between `all_font_names` and `all_font_families` is whether dynamically
loaded font resources are included. Specifically, `all_font_families`
returns the names of all system fonts, while `all_font_names` includes
both the system font names and the dynamically loaded font names. In
other words, `all_font_families` is a strict subset of `all_font_names`.
This is what I observed in my tests on macOS.

<img width="682" alt="截屏2024-07-28 00 49 29"
src="https://github.com/user-attachments/assets/47317c28-0074-49d2-bcfa-052cab13e335">

Related codes:
```rust
let x: HashSet<_> = self.all_font_names().into_iter().collect();
let y: HashSet<_> = self.all_font_families().into_iter().collect();
let only_in_x = x.difference(&y).collect::<Vec<_>>();
let only_in_y = y.difference(&x).collect::<Vec<_>>();
println!("=====================================");
println!("1 -> {:?}", only_in_x);
println!("-------------------------------------");
println!("2 -> {:?}", only_in_y);
```

Release Notes:

- N/A
2024-08-23 00:11:01 +02:00
Kyle Kelley
80c25960dd
repl: Set up a way to copy output from the REPL (#16649)
Closes #15494

Simple copy button to copy an individual output since selection is a bit
more work.

<img width="790" alt="image"
src="https://github.com/user-attachments/assets/4a7d8b69-70cc-428e-8fe3-b95386d341ee">


Release Notes:

- repl: Copy output from the REPL using a button

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-22 15:03:42 -07:00
apricotbucket28
b19356ac69
linux: Ignore benign error when cancelling file picker (#15553)
Fixes https://github.com/zed-industries/zed/issues/15485

This should be clearer on the `ashpd` side, but `ResponseError` comes
from the portal
[Response](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Request.html#org-freedesktop-portal-request-response),
which means the request itself didn't fail. Ignoring the `Other` variant
here should be safe.

Release Notes:

- Linux: Fixed benign error being shown when cancelling file picker
([#15485](https://github.com/zed-industries/zed/issues/15485))
2024-08-22 14:43:02 -07:00
apricotbucket28
7523a7a437
wayland: Do not reset clipboard data offer on keyboard leave (#16126)
Closes #14415 
(also removed an unused serial while I was at it)

Release Notes:

- Linux: Fixed cross-window copy/paste not working in some Wayland
configurations.
2024-08-22 14:42:32 -07:00
apricotbucket28
e7c8dba54f
cosmic_text: Handle subpixel variants (#16238)
Closes https://github.com/zed-industries/zed/issues/14169, closes
https://github.com/zed-industries/zed/issues/14387


| Before  | After |
| --- | ---|
|
![image](https://github.com/user-attachments/assets/e7acbcbf-6384-49f8-bfe4-96d70d957df2)
|
![image](https://github.com/user-attachments/assets/704fac78-3946-4c5f-a02d-346653b77c5a)
|
|
![image](https://github.com/user-attachments/assets/50c40a23-47a8-4bc4-9a8c-df763df38f18)
|
![image](https://github.com/user-attachments/assets/37e5b1a6-0e16-4564-a47e-94f4e6d82c10)
|

Release Notes:

- Linux: Improved text rendering by handling subpixel positioning.
2024-08-22 15:17:56 -06:00
Cherry
feab1261c8
Fix some typos (#16623)
This PR fixes some typos I found in the source code.

Release Notes:

- N/A
2024-08-21 17:33:19 -04:00
Michael Angerman
406d3b413d
gpui: Remove extra "which" in comment (#16620)
Fix a typo in the comment...

Release Notes:

- N/A
2024-08-21 17:24:38 -04:00
Ikko Eltociear Ashimine
9f0438b540
gpui: Remove extra "the" in comment (#16608)
Release Notes:

- N/A
2024-08-21 14:07:51 -04:00
Sinan Gençoğlu
ff7017c308
Replace lazy_static with std::sync::LazyLock (#16066)
Closes #15860 

Since rust std now supports LazyLock replacing lazy_static with it
reduce the external dependency.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-20 14:27:33 -04:00
Marshall Bowers
8381b06d2d
gpui: Fix "cursor" typos (#16536)
This PR fixes some typos of the word "cursor" in `gpui`.

Release Notes:

- N/A
2024-08-20 13:49:15 -04:00
Nathan Sobo
11753914d7
Add a setting to show time to first window draw and frames per second in status bar (#16422)
I want to showcase Zed's performance via videos, and this seemed like a
good way to demonstrate it.


https://github.com/user-attachments/assets/f4a5fabc-efe7-4b48-9ba5-719882fdc856

Release Notes:

- On macOS, you can now set assign `performance.show_in_status_bar:
true` in your settings to show the time to the first window draw on
startup and then current FPS of the containing window's renderer.

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: David Soria Parra <167242713+dsp-ant@users.noreply.github.com>
Co-authored-by: Danny Hua <danny.hua@hey.com>
2024-08-18 15:22:19 -06:00
Max Brunsfeld
4c390b82fb
Make LanguageModel::use_any_tool return a stream of chunks (#16262)
This PR is a refactor to pave the way for allowing the user to view and
edit workflow step resolutions. I've made tool calls work more like
normal streaming completions for all providers. The `use_any_tool`
method returns a stream of strings (which contain chunks of JSON). I've
also done some minor cleanup of language model providers in general,
removing the duplication around handling streaming responses.

Release Notes:

- N/A
2024-08-14 18:02:46 -07:00
Richard Feldman
b1a581e81b
Copy/paste images into editors (Mac only) (#15782)
For future reference: WIP branch of copy/pasting a mixture of images and
text: https://github.com/zed-industries/zed/tree/copy-paste-images -
we'll come back to that one after landing this one.

Release Notes:

- You can now paste images into the Assistant Panel to include them as
context. Currently works only on Mac, and with Anthropic models. Future
support is planned for more models, operating systems, and image
clipboard operations.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Kyle <kylek@zed.dev>
2024-08-13 13:18:25 -04:00
张小白
ac6bff12b9
windows: Remove unused dependencies (#15857)
I have removed some unused dependencies, reducing the total number of
packages during the build from 1141 to 1112. This should slightly
decrease the build time.

![Screenshot 2024-08-06
230726](https://github.com/user-attachments/assets/58a49fd4-4a0a-4026-b6b7-79b95529ec74)


Release Notes:

- N/A
2024-08-13 13:31:02 +03:00
Thorsten Ball
af36d4934c
assistant panel: Animate assistant label if message is pending (#16152)
This adds a pulsating effect to the assistant header in case the message
is pending.

The pulsating effect is capped between 0.2 and 1.0 and I tried (with the
help of Claude) to give it a "breathing" effect, since I found the
normal bounce a bit too much.

Also opted for setting the `alpha` on the `LabelLike` things, vs.
overwriting the color, since I think that's cleaner instead of exposing
the color and mutating that.


https://github.com/user-attachments/assets/4a94a1c5-8dc7-4c40-b30f-d92d112db7b5


Release Notes:

- N/A
2024-08-13 11:41:44 +02:00
Piotr Osiewicz
68ae347077
chore: Remove a bunch of unused structs (#16139)
Found by beta clippy.

Release Notes:

- N/A
2024-08-13 01:43:19 +02:00
Son
bab4da78b7
Fix corner radius when doing rounded_full (#15663)
Release Notes:

- Fixed issue when doing `rounded_full`, it should render a pill-shape
rect instead of current eye-shape.

For example with this code
`div().h_4().w_16().bg(rgb(0xffffff)).rounded_full()`

Current:

<img width="144" alt="image"
src="https://github.com/user-attachments/assets/f8b20c7c-d91f-4c20-9f38-d435f59e72b7">

Fixed:

<img width="172" alt="image"
src="https://github.com/user-attachments/assets/ff8bbe26-2b31-4ef1-a2fb-25b458386ffb">
2024-08-12 15:24:32 +02:00
Peter Tripp
eb3c4b0e46
Docs Party 2024 (#15876)
Co-authored-by: Raunak Raj <nkray21111983@gmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Jason Mancuso <7891333+jvmncs@users.noreply.github.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-08-09 13:37:54 -04:00
Son
f24f601e05
Adjust erf estimation function (#15423)
Release Notes:

- Fixed a (potential) small error in erf estimation. Technically, the
error is negligible.

I am not sure where the current calculation for erf come from and if it
is intended or a simple mistake. However it looks slightly different
from the official calculation, notably
[this](https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions)
from Wikipedia.

I will add a comment if it is intended.
2024-08-07 14:12:26 +02:00
Joseph T. Lyons
a64906779b
Use vanity Discord link (#15880)
Release Notes:

- N/A
2024-08-06 16:55:51 -04:00
Jaakko Sirén
fb1cd7cae2
blade: Update to pick up Intel memory coherency fix & fix calling blade params (#15829)
Builds on @kvark's PR https://github.com/zed-industries/zed/pull/15781
by fixing call to Blades `create_texture_view` the arguments of which
had changed.


Picks up https://github.com/kvark/blade/pull/153

Release Notes:

- Fixed Zed flickering on Linux when using Intel graphics.
([#14101](https://github.com/zed-industries/zed/issues/14101)).

---------

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-06 11:33:18 +02:00
apricotbucket28
ab1fabef68
gpui: Align SVG sprites to whole pixels (#15822)
Related to https://github.com/zed-industries/zed/issues/12352 (and old
issue https://github.com/zed-industries/zed/issues/643)

This fixes visual glitches that could happen when rendering icons on
Linux and Windows (and in the Blade backend)


![image](https://github.com/user-attachments/assets/02646d1d-d35b-48be-89c9-189416510cf2)

![image](https://github.com/user-attachments/assets/ccf99867-25d2-40fb-8735-c540f8cf793a)

![image](https://github.com/user-attachments/assets/8d1124a3-669e-4be5-8b46-5dc2df14a28a)


Release Notes:

- Linux: Fixed visual glitches when rendering icons.
2024-08-05 12:43:23 -07:00
Antonio Scandurra
5b1ea7eda0
Clean up inline assist editor rendering (#15536)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Max <max@zed.dev>
2024-07-31 17:43:08 +02:00
apricotbucket28
8e6af73784
x11: Do not check hover state on properties change (#15518)
This fixes an issue where the window's hovered state would be incorrect,
causing the cursor not to update because it would think the window
wasn't hovered ([relevant
check](a03beeeb5b/crates/gpui/src/window.rs (L3016-L3017))).

The code here doesn't really seem to make sense, since there's already
the `XinputEnter` and `XinputLeave` events that indicate mouse focus
state on the window. The properties change event wouldn't necessarily
indicate when mouse focus changes.

Thanks @Emc2356 for reporting this on the Discord and helping figure out
the issue!
 
Release Notes:

- Linux: Fixed the cursor sometimes not changing on X11
2024-07-30 19:02:48 -07:00
Jason Lee
1982a5aed1
gpui: Improve img element to support load from Assets (#15482)
Release Notes:

- N/A


Currently, the `img` element provided by GPUI only supports FilePath or
URL, but in actual applications we need to let `img` load an image
embedded in Assets.

The `svg` element can currently support this, but `img` cannot.

For example:

We have such an Assets directory:

```
assets
|- icons
|- images
|--- foo.png
```

```rs
// If give a path, considered an Asset
img("images/foo.png");
// If give a URI, considered a Remote image
img("https://foo.bar/images/foo.png");
// If give a PathBuf, considered a Local file
img(PathBuf::from("path/to/foo.png"));
```


## Example test

```
cargo run -p gpui --example image 
```

<img width="827" alt="image"
src="https://github.com/user-attachments/assets/e45dcf7f-4626-4fb0-aca9-9b6e1045a952">

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-30 10:55:48 -04:00
Antonio Scandurra
fa19bc98ac
Provide user agent when performing HTTP requests (#15470)
Release Notes:

- N/A

---------

Co-authored-by: Nathan <nathan@zed.dev>
2024-07-30 11:12:37 +02:00
Thorsten Ball
f58ef9b82b
zed: Persist window stack order across restarts (#15419)
This changes the workspace/session serialization to also persist the
order of windows across restarts.

Release Notes:

- Improved restoring of windows across restarts: the order of the
windows is now also restored. That means windows that were in the
foreground when Zed was quit will be in the foreground after restart.
(Right now only supported on Linux/X11, not on Linux/Wayland.)

Demo:



https://github.com/user-attachments/assets/0b8162f8-f06d-43df-88d3-c45d8460fb68
2024-07-29 17:05:56 +02:00
apricotbucket28
04e25525bf
x11: Fix window menu not showing (#15328)
Fixes
https://github.com/zed-industries/zed/issues/15245#issuecomment-2252790889

Release Notes:

- Linux: Fixed window menu not showing on X11
2024-07-27 12:29:48 -07:00