Commit Graph

2082 Commits

Author SHA1 Message Date
agamcsama
25c8cf0c5c
windows: Fix Zed/GPUI misinterpreting keycodes + Refactor (#12814)
Release Notes:

- Fixed Zed/GPUI misinterpreting keycodes on non-US keyboards
([#12811](https://github.com/zed-industries/zed/issues/12811)).

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2024-06-20 11:39:20 -07:00
Mikayla Maki
4e2a08edb7
Fix missing IME keys when no input handler is set (#13325)
This fixes a bug introduced by
https://github.com/zed-industries/zed/pull/12702, where GPUI would only
generate the correct key events if you had an input handler set.

Release Notes:

- N/A
2024-06-20 10:39:10 -07:00
Thorsten Ball
8524e87319
linux/x11: Do panic when unmapping/destroying of X11 window fails (#13262)
We saw this panic come up:

```
called `Result::unwrap()` on an `Err` value: IoError(Custom { kind: Other, error: UnknownError })
core::panicking::panic_fmt
core::result::unwrap_failed
<gpui::platform::linux::x11:🪟:X11Window as core::ops::drop::Drop>::drop
core::ptr::drop_in_place<gpui::platform::linux::x11:🪟:X11Window>
core::ptr::drop_in_place<gpui:🪟:Window>
gpui::app::AppContext::shutdown
gpui::app::AppContext:🆕:{{closure}}
gpui::platform::linux::platform::<impl gpui::platform::Platform for P>::run
gpui::app::App::run
zed::main
std::sys_common::backtrace::__rust_begin_short_backtrace
std::rt::lang_start::{{closure}}
std::rt::lang_start_internal
main
__libc_start_call_main
__libc_start_main_impl
_start
```

I'm not sure where exactly that error comes from, except from the X11
stuff. So let's be defensive and log error and only then tear down
everything.

I _think_ that if the error is repeatable that means we won't close the
window but instead just log errors, but I do think that's better than
panicking right now.

Release Notes:

- N/A
2024-06-19 14:36:57 +02:00
Mikayla Maki
d4891a62bb
Conform to wayland spec on resize (#13243)
Fixes https://github.com/zed-industries/zed/issues/10976

Release Notes:

- N/A

Co-authored-by: conrad <conrad@zed.dev>
2024-06-18 21:01:15 -07:00
Mikayla Maki
17bc0d1b17
Dynamically link libwayland (#13241)
Fixes a bug in current nightly.

Release Notes:

- N/A
2024-06-18 15:07:45 -07:00
Conrad Irwin
490a75aee6
Fix bug where window contents could appear outside of window bounds on X11 (#13181)
Release Notes:

- N/A
2024-06-18 13:49:01 -06:00
Mikayla Maki
6b9ddbfef2
Add more menus to Zed (#12940)
### TODO

- [x] Make sure keybinding shows up in pane + menu
- [x] Selection tool in the editor toolbar
- [x] Application Menu
- [x] Add more options to pane + menu
   - Go to File...
  - Go to Symbol in Project... 
- [x] Add go items to the selection tool in the editor:
   - Go to Symbol in Editor...
   - Go to Line/Column...
   - Next Problem
   - Previous Problem
- [x] Fix a bug where modals opened from a context menu aren't focused
correclty
- [x] Determine if or what needs to be done with project actions:
- Difficulty is that these are exposed in the UI via clicking the
project name in the titlebar or by right clicking the root entry in the
project panel. But they require reading and are two clicks away. Is that
sufficient?
    - Add Folder to Project
    - Open a new project
    - Open recent
 - [x] Get a style pass 
 - [x] Implement style pass
   - [x] Fix the wrong actions in the selection menu
   - [x] Show selection tool toggle in the 'editor settings' thing
- [x] Put preferences section from the app menu onto the right hand user
menu
- [x] Add Project menu into app menu to replace 'preferences' section,
and put the rest of the actions there
- [ ] ~~Adopt `...` convention for opening a surface~~ uncertain what
this convention is.
   - [x] Adopt link styling  for webview actions
   - [x] Set lucide hamburger for menu icon
   - [x] Gate application menu to only show on Linux and Windows




Release Notes:

- Added a 'selection and movement' tool to the Editor's toolbar, as well
as controls to toggle it and a setting to remove it (`"toolbar":
{"selections_menu": true/false }`)
- Changed the behavior of the `+` menu in the tab bar to use standard
actions and keybindings. Replaced 'New Center Terminal' with 'New
Terminal', and 'New Search', with the usual 'Deploy Search'. Also added
item-creating actions to this menu.
- Added an 'application' menu to the titlebar to Linux and Windows
builds of Zed
2024-06-18 12:16:54 -07:00
apricotbucket28
f6fa6600bc
wayland: Refactor clipboard implementation (#12405)
Fixes https://github.com/zed-industries/zed/issues/12054

Replaces the `copypasta`/`smithay-clipboard` implementation with a new,
custom one

TODO list:

- [x] Cleanup code
- [x] Remove `smithay-clipboard`
- [x] Add more mime types to the supported list

Release Notes:

- Fixed drag and drop on Gnome
- Fixed clipboard paste on Hyprland
2024-06-18 10:04:19 -07:00
Thorsten Ball
64d815a176
linux/x11: Fix closing of GPUI windows not working (#13201)
This fixes everything but the main Zed window (GPUI examples, prompt
library, etc.) not being closable by clicking on the X in X11.

We had a dangling reference before: we would remove the window from the
X11 state, but GPUI itself would still have the window in its
references.

In order to fix this we have to call `window.close()`, which ends up
calling `cx.remove_window()`, which removes the reference.

That in turn then causes the reference to be dropped, which cleans up
the X11 state for the window.

Release Notes:

- N/A
2024-06-18 15:22:26 +02:00
Thorsten Ball
195a270e18
vim: Display pending keys in Vim mode indicator (#13195)
This changes the mode indicator to now show pending keys and not just
pending operators.


Release Notes:

- Added pending keys to the mode indicator in Vim mode.

Demo:



https://github.com/zed-industries/zed/assets/1185253/4fc4ffd9-2ba7-4e2c-b2c3-cd19b40cb640
2024-06-18 13:30:18 +02:00
Conrad Irwin
51404d4ea0
Fix ci" on a brazillian keyboard (#13185)
Fixes: #12523

Release Notes:

- vim: Fix ci" on keyboards where typing a " requires the IME (#12523)
2024-06-17 22:38:36 -06:00
Max Brunsfeld
7003b0f211
Allow canceling in-progress language server work (e.g. cargo check) (#13173)
Release Notes:

- Added a more detailed message in place of the generic `checking...`
messages when Rust-analyzer is running.
- Added a rate limit for language server status messages, to reduce
noisiness of those updates.
- Added a `cancel language server work` action which will cancel
long-running language server tasks.

---------

Co-authored-by: Richard <richard@zed.dev>
2024-06-17 17:58:47 -07:00
张小白
e19627d92f
windows: Fix regression introduced by a prev PR (#13090)
Fix regression introduced by #12991 

### Before

The re-position and re-size of a window is broken.


https://github.com/zed-industries/zed/assets/14981363/d4fb9dce-707e-4ab1-9ff5-f355b7fdd8a8

### After



https://github.com/zed-industries/zed/assets/14981363/7fd232e6-ff6c-4b7f-ad32-c284acd4f6db




Release Notes:

- N/A
2024-06-17 13:01:35 -06:00
Conrad Irwin
eecbf203dc
Fix 100s freeze on boot on X11 (#13156)
Release Notes:

- Fixed switching between dark and light mode with no windows open.
2024-06-17 12:44:32 -06:00
Kyle Kelley
221edfc267
Bring Jupyter to Zed Editing (#12062)
Run any Jupyter kernel in Zed on any buffer (editor):

<img width="1074" alt="image"
src="https://github.com/zed-industries/zed/assets/836375/eac8ed69-d02b-4d46-b379-6186d8f59470">

## TODO

### Lifecycle

* [x] Launch kernels on demand
* [x] Wait for kernel to be started
* [x] Request Kernel info on start
* [x] Show in progress indicator
* [ ] Allow picking kernel (it defaults to first matching language name)
* [ ] Menu for interrupting and shutting down the kernel
* [ ] Drop running kernels once editor is dropped

### Media Outputs

* [x] Render text and tracebacks with ANSI color handling
* [x] Render markdown as text
* [x] Render PNG and JPEG images using an explicit height based on
line-height
* ~~Render SVG~~ -- not happening for this PR due to lack of text in SVG
support
* [ ] Process `update_display_data` message and related `display_id`
* [x] Process `page` data from payloads as outputs
* [ ] Render markdown as, well, rendered markdown -- Note: unsure if we
can get line heights here

### Document

* [x] Select code and run
* [x] Run current line
* [x] Clear previous overlapping runs
* [ ] Support running markdown code blocks
* [ ] Action to export session as notebook or output files
* [ ] Action to clear all outputs
* [ ] Delete outputs when lines are deleted

## Other missing features

The following is a list of missing functionality or expectations that
are out of scope for this PR.

### Python Environments

Detecting python environments should probably be done in a separate PR
in tandem with how they're used with LSP. Users likely want to pick an
environment for their project, whether a virtualenv, conda env, pyenv,
poetry backed virtualenv, or the system. Related issues:

* https://github.com/zed-industries/zed/issues/7646
* https://github.com/zed-industries/zed/issues/7808
* https://github.com/zed-industries/zed/issues/7296

### LSP Integration

* Submit `complete_request` messages for completions to interleave
interactive variables with LSP
* LSP for IPython semantics (`%%timeit`, `!ls`, `get_ipython`, etc.)

## Future release notes

- Run code in any editor, whether it's a script or a markdown document

Release Notes:

- N/A
2024-06-17 10:02:31 -07:00
Richard Feldman
4855da53df
Don't hide inline assist when editor loses focus (#12990)
Release Notes:

- Now when an editor loses focus (e.g. from switching tabs) and then
gains focus again, it doesn't close the inline assist. Instead, it only
closes when you move the cursor outside of it, e.g. by clicking
somewhere else in its parent editor.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2024-06-17 09:43:52 +02:00
apricotbucket28
38cb95f427
linux: Update cosmic_text (#13095)
Bumps cosmic_text, removes some stale `todo`s and stores a ShapeBuffer
to prevent reallocations

Improvements:

- Performance should be a lot better (haven't actually tested it)
- Fixed display of `\t` in the terminal

![image](https://github.com/zed-industries/zed/assets/71973804/ca994912-851d-48ef-8dc7-b244c9eb484d)

![image](https://github.com/zed-industries/zed/assets/71973804/42fa9acf-ec10-4247-a5e3-2d4fe664ded6)


Release Notes:

- N/A
2024-06-15 15:23:00 -07:00
Conrad Irwin
411ee7a47c
Move keyboard focus when foregrounding windows on X11 (#13071)
Release Notes:

- N/A
2024-06-14 16:16:03 -06:00
张小白
4cb45e63f4
windows: Update windows-rs crate and better error handling in DirectWrite (#12818)
- Update `windows-rs` from `0.56` to `0.57`
- Use the newly introduced `Owned` struct in `0.57` to handle the RAII
stuff of `HANDLE`
- Better error handling in `DirectWrite`

Release Notes:

- N/A
2024-06-14 10:12:20 -07:00
Angelo.Mateus
64bb79b71d
Allow held key events if key is modifier (#13000)
Release Notes:

- (Fixed) Allows held down key events for modifier keys.
([#12566](https://github.com/zed-industries/zed/issues/12566))

---------

Co-authored-by: Angelo <>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-13 20:54:59 -06:00
Mikayla Maki
10d3ad4e33
Enable linux tests (#12493)
Note:
- We have disabled all tests that rely on Postgres in the Linux CI. We
only really need to test these once, and as macOS is our team's primary
platform, we'll only enable them on macOS for local reproduction.
- We have disabled all tests that rely on the font metrics. We
standardized on Zed Mono in many fonts, but our CoreText Text System and
Cosmic Text System proved to be very different in effect. We should
revisit if we decide to standardize our text system across platforms
(e.g. using Harfbuzz everywhere)
- Extended the condition timeout significantly. Our CI machines are slow
enough that this is causing spurious errors in random tests.

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-13 16:38:53 -07:00
Conrad Irwin
2e758dcb64
X11: Fix black flashes on boot and while resizing (#13002)
Release Notes:

- N/A
2024-06-13 13:35:38 -06:00
张小白
599102573a
windows: Implement window_appearance() and should_auto_hide_scrollbars() (#12527)
Release Notes:

- N/A
2024-06-13 10:52:53 -07:00
Max Brunsfeld
da281d6d8f
Fix issues where screen and window sizes contained Pixels, but were declared as DevicePixels (#12991)
On most platforms, things were working correctly, but had the wrong
type. On X11, there were some problems with window and display size
calculations.

Release Notes:

- Fixed issues with window positioning on X11

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-06-13 10:48:37 -07:00
张小白
22dc88ed3d
windows: Fix scrolling bug (#12431)
Closes #12369 



https://github.com/zed-industries/zed/assets/14981363/14df820e-9be3-4b89-882b-a083ea42d59e



Release Notes:

- N/A
2024-06-13 10:48:20 -07:00
Antonio Scandurra
e1f4dfc068
Refine inline transformation UX (#12939)
https://github.com/zed-industries/zed/assets/482957/1790e32e-1f59-4831-8a4c-722cf441e7e9



Release Notes:

- N/A

---------

Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
2024-06-13 08:35:22 +02:00
Max Brunsfeld
76b0120665
Reveal the selected item when cycling a picker's selection (#12950)
Release Notes:

- Fixed a bug where the selected tab was not always shown when cycling
between tabs with `ctrl-tab`.
2024-06-12 17:40:53 -07:00
Kirill Bulatov
8451dba6a7
Introduce an outline panel (#12637)
Adds a new panel: `OutlinePanel` which looks very close to project
panel:

<img width="256" alt="Screenshot 2024-06-10 at 23 19 05"
src="https://github.com/zed-industries/zed/assets/2690773/c66e6e78-44ec-4de8-8d60-43238bb09ae9">

has similar settings and keymap (actions work in the `OutlinePanel`
context and are under `outline_panel::` namespace), with two notable
differences:
* no "edit" actions such as cut/copy/paste/delete/etc.
* directory auto folding is enabled by default

Empty view: 
<img width="841" alt="Screenshot 2024-06-10 at 23 19 11"
src="https://github.com/zed-industries/zed/assets/2690773/dc8bf37c-5a70-4fd5-9b57-76271eb7a40c">


When editor gets active, the panel displays all related files in a tree
(similar to what the project panel does) and all related excerpts'
outlines under each file.
Same as in the project panel, directories can be expanded or collapsed,
unfolded or folded; clicking file entries or outlines scrolls the buffer
to the corresponding excerpt; changing editor's selection reveals the
corresponding outline in the panel.

The panel is applicable to any singleton buffer:
<img width="1215" alt="Screenshot 2024-06-10 at 23 19 35"
src="https://github.com/zed-industries/zed/assets/2690773/a087631f-5c2d-4d4d-ae25-30ab9731d528">

<img width="1728" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/e4f8082c-d12d-4473-8500-e8fd1051285b">

or any multi buffer:

(search multi buffer)

<img width="1728" alt="Screenshot 2024-06-10 at 23 19 41"
src="https://github.com/zed-industries/zed/assets/2690773/60f768a3-6716-4520-9b13-42da8fd15f50">

(diagnostics multi buffer)
<img width="1728" alt="image"
src="https://github.com/zed-industries/zed/assets/2690773/64e285bd-9530-4bf2-8f1f-10ee5596067c">

Release Notes:
- Added an outline panel to show a "map" of the active editor
2024-06-12 23:22:52 +03:00
Paul Eguisier
001f17c011
vim: Implement named registers (#12895)
Release Notes:

- vim: Add support for register selection `"a`-`"z`, `"0`-`"9`, `"-`.
`"_` and `"%`
([#11511](https://github.com/zed-industries/zed/issues/11511))

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-12 10:40:27 -06:00
Conrad Irwin
1b28f93c64
Make notification windows not have titles on X11 (#12935)
Co-Authored-By: Max <max@zed.dev>

Release Notes:

- N/A

Co-authored-by: Max <max@zed.dev>
2024-06-12 10:27:40 -06:00
Mikayla Maki
ab41eddd8b
Fix cursors on some GNOME installations (#12914)
This PR adds support for `org.gnome.desktop.interface`'s `cursor-theme`
setting on Wayland. This should fix cursors not showing up on some GNOME
installs. This PR also adds the wiring to watch the current cursor theme
value.

Thanks to @apricotbucket28 for helping debug the issue.

Release Notes:

- N/A
2024-06-11 17:39:25 -07:00
Mikayla Maki
c30f6a1582
Fix alt key getting stuck when tabbing on linux (#12912)
Release Notes:

- N/A
2024-06-11 15:14:01 -07:00
Mikayla Maki
80c14c9198
Pull app / OS info out of GPUI, add Linux information, make fallible window initialization (#12869)
TODO:
- [x] Finish GPUI changes on other operating systems 

This is a largely internal change to how we report data to our
diagnostics and telemetry. This PR also includes an update to our blade
backend which allows us to report errors in a more useful way when
failing to initialize blade.


Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-06-11 11:43:12 -07:00
Thorsten Ball
ec9e700e70
linux/x11: Mark windows as destroyed after destroy request (#12892)
Turns out we still get FocusOut and UnmapNotify events after the window
has been destroyed, which resulted in error messages popping up because
we can't find the window anymore that we want to mark as unfocused.



Release Notes:

- N/A
2024-06-11 17:23:48 +02:00
Thorsten Ball
3722275cfa
linux/x11: Only create ModifiersChanged event if they changed (#12879)
I noticed that when I use my mouse wheel, we get a ton of the
`XkbStateNotify` events, but the modifiers don't change, so we add a ton
of useless input events for the window.

Release Notes:

- N/A
2024-06-11 11:00:26 +02:00
Thorsten Ball
05b6581147
linux/x11: handle XIM events sync to reduce lag (#12840)
This helps with the problem of keyboard input feeling laggy when the
event loop is under load.

What would previously happen is:

- N events from X11 arrive
- N events get forwarded to XIM
- N events are handled in N iterations of the event loop (sadly, yes: we
only seem to be getting back one `ClientMessage` per poll from XCB
connection)
- Each event is pushed into the channel
- N event loop iterations are needed to get the events off the channel
and handle them

With this change, we get rid of the last 2 steps: instead of pushing the
event onto a channel, we store it on the XIM handler itself, and then
work it off synchronously.

Usually one shouldn't block the event loop, but I think in this case -
user input! - it's better to handle the events directly instead of
re-enqueuing them again in a channel, where they can accumulate and need
multiple iterations of the loop to be worked off.

This does *not* fix the problem of input feeling choppy/slower when the
system is under load, but it makes the behavior now feel exactly the
same as when XIM is disabled.

I also think the code is easier to understand since it's more
straightforward.

Release Notes:

- N/A
2024-06-10 14:08:16 +02:00
Thorsten Ball
43d1a8040d
linux: run runnables only when event loop is idle (#12839)
This change ensures that the event loop prioritizes enqueueing another
render or handling user input over executing runnables.

It's a subtle change as a result of a week of digging into performance
on X11. It's also not perfect: ideally we'd get rid of the intermediate
channel here and had more control over when and how we run runnables vs.
X11 events, but I think short of rewriting how we use an event loop,
this is good cost/benefit change.

To illustrate:

Before this change, it was possible to block the app from rendering for
a long time by just creating a ton of futures that were executed on the
"main" thread (we don't have a "main" thread on Linux, but we have a
single thread in which we run the event loop).

That was relatively easy to reproduce by opening the `zed` repository
and starting `rust-analyzer`: at some point `rust-analyzer` sends us so
many notifications, that are all handled in futures, that the event loop
is busy just working off the runnables, never getting to the events that
X11 sends us or our own timer to re-enqueue another render.

When you put print statements into the code to show when which event was
handled, you'd see something like this **before this change**:

```
[ ... hundreds of runnable.run() ... ]
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
new render tick timer. lag: 56.942049ms
X11 event
new render tick timer. lag: 9.668µs
X11 event
new render tick timer. lag: 9.955µs
X11 event
runnable.run()
runnable.run()
runnable.run()
runnable.run()
new render tick timer. lag: 12.462µs
X11 event
new render tick timer. lag: 14.868µs
X11 event
new render tick timer. lag: 11.234µs
X11 event
new render tick timer. lag: 11.681µs
X11 event
new render tick timer. lag: 13.926µs
X11 event
```

Note the `lag: 56ms`: that's the difference between when we wanted to
execute the callback that enqueues another render and when it ran.

Longer lags are possible, this is just the first one I grabbed from the
logs.

Now, compare this with the logs **after this change**:

```
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
new render tick timer. lag: 36.051µs
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
X11 event
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
runnable.run()
```

In-between many `runnable.run()` we'll always handle events.

So, in essence, what this change does is to introduce 2 priorities into
the X11 event queue:

- high: X11 events (user events, render events, ...), render tick, XIM
events, ...
- low: all async rust code

I've tested this with a debug build and release build and I think the
app now feels more responsive. It doesn't feel perfect still, especially
in the slow debug builds, but I couldn't observe 10s lockups anymore.

Since it's a pretty small change, I think we should go for it and see
how it behaves.

Thanks to @maan2003 this now also includes the same change to Wayland.

Release Notes:

- N/A

---------

Co-authored-by: maan2003 <manmeetmann2003@gmail.com>
2024-06-10 14:04:41 +02:00
Conrad Irwin
75f8be6a0f
vim: add guu gUU g~~ g/ (#12789)
Release Notes:

- vim: Add `g/` for project search
2024-06-07 16:45:38 -06:00
Piotr Osiewicz
377e24b798
chore: Fix clippy for upcoming 1.79 Rust release (#12727)
1.79 is due for release in a week.
Release Notes:

- N/A
2024-06-06 12:46:53 +02:00
Mikayla Maki
d3d0d01571
Adjust IME action buffering to only apply to insert actions (#12702)
Follow up to https://github.com/zed-industries/zed/pull/12678
fixes https://github.com/zed-industries/zed/issues/11829

In this solution, we only buffer Insert Text actions from the macOS IME.
The marked text and unmark actions are eagerly processed, so that the
IME state is synchronized with the editor state during multi step
pre-edit composition.

Release Notes:

- Fixed an issue where the IME pre-edit could desynchronize from the
editor on macOS
([#11829](https://github.com/zed-industries/zed/pull/12651)).

Co-authored-by: Conrad <conrad@zed.dev>
2024-06-05 16:13:03 -07:00
Conrad Irwin
428c143fbb
Add ability to scroll popovers with vim (#12650)
Co-Authored-By: ahmadraheel@gmail.com



Release Notes:

- vim: allow scrolling the currently open information overlay using
`ctrl-{u,d,e,y}`etc. (#11883)
2024-06-05 13:39:17 -06:00
Antonio Scandurra
a96782cc6b
Allow using the inline assistant in prompt library (#12680)
Release Notes:

- N/A
2024-06-05 14:46:33 +02:00
Kirill Bulatov
63a8095879
Revert "Fix a bug where the IME pre-edit would desync from Zed (#12651)" (#12678)
This reverts commit 1a0708f28c since after
that, default task-related keybindings (alt-t and alt-shift-t) started
to leave `†` and `ˇ` symbols in the text editors before triggering
actions.


Release Notes:

- N/A
2024-06-05 13:54:06 +03:00
Paul Eguisier
8a659b0c60
Implement Indent & Outdent as operators (#12430)
Release Notes:

- Fixes [#9697](https://github.com/zed-industries/zed/issues/9697).

Implements `>` and `<` with motions and text objects.
Works with repeat action `.`
2024-06-04 15:17:01 -06:00
Mikayla Maki
1a0708f28c
Fix a bug where the IME pre-edit would desync from Zed (#12651)
fixes #11829 

In https://github.com/zed-industries/zed/pull/7494, we introduced IME
event buffering, so that we could preempt the IME with a keystroke event
in some cases. However, this caused a desynchronization bug in long
multi-step IME composition, such as the pre-edit used in the Japanese
Romaji keyboard (and other languages). We found that this was due to the
IME issuing actions, and then immediately querying the editor's state
before we had applied those actions. Therefore, this PR removes IME
action buffering.

We have tested all of the cases in the `handle_key_event` documentation
and added a few of our own.

Release Notes:

- Fixed an issue where the IME pre-edit could desynchronize from the
editor on macOS
([#11829](https://github.com/zed-industries/zed/pull/12651))

---------

Co-authored-by: Jan Solanti <jhs@psonet.com>
2024-06-04 12:17:44 -07:00
Antonio Scandurra
c5b22eee2d
Polish prompt library UX (#12647)
This could still use some improvement UI-wise but the user experience
should be a lot better.

- [x] Show in "Window" application menu
- [x] Load prompt as it's selected in the picker
- [x] Refocus picker on `esc`
- [x] When creating a new prompt, if a new prompt already exists and is
unedited, activate it instead
- [x] Add `/default` command
- [x] Evaluate /commands on prompt insertion
- [x] Autocomplete /commands (but don't evaluate) during prompt editing
- [x] Show token count using the settings model, right-aligned in the
editor
- [x] Picker 
- [x] Sorted alpha
- [x] 2 sublists
    - Default
        - Empty state: Star a prompt to add it to your default prompt
        - Otherwise show prompts with star on hover
    - All
        - Move prompts with star on hover

Release Notes:

- N/A
2024-06-04 18:36:54 +02:00
Kirill Bulatov
47122a3115
Fix excluded file creation (#12620)
Fixes https://github.com/zed-industries/zed/issues/10890

* removes `unwrap()` that caused panics for text elements with no text,
remaining after edit state is cleared but project entries are not
updated, having the fake, "new entry"
* improves discoverability of the FS errors during file/directory
creation: now those are shown as workspace notifications
* stops printing anyhow backtraces in workspace notifications, printing
the more readable chain of contexts instead
* better indicates when new entries are created as excluded ones


Release Notes:

- Improve excluded entry creation workflow in the project panel
([10890](https://github.com/zed-industries/zed/issues/10890))
2024-06-04 10:31:43 +03:00
Sean Billig
be2df79d5c
gpui: Handle null string pointer in window::insert_text (#12446)
`[NSString UTF8String]` sometimes returns null (it's documented as
such), and when it does, zed crashes in `window::insert_text`. I'm
running into this sometimes when using alt-d to delete forward. It
usually only happens with multiple cursors, but sometimes with a single
cursor. It *might* only happen when using the "Unicode Hex Input"
keyboard 'Input Source' (which I started using to avoid entering weird
characters in zed when using emacs meta keybindings that I haven't
defined in zed).

When using the US English input source, alt-d always results in a call
to `insert_text`. When using the Unicode Hex Input source it usually
doesn't, but when it does `text.UTF8String()` returns null. `text` isn't
null. `[text length]` returns 1. `[text characterAtIndex: 0]` seems to
always return `56797` (an undefined utf-16 codepoint).

Release Notes:

- Fixed crash on mac when deleting with alt-d
2024-06-03 09:36:38 -07:00
apricotbucket28
344e5e1cf2
wayland: Fix window bounds restoration (#12581)
Fixes multiple issues that prevented window bounds restoration to not
work on Wayland.

Note: Since the display uuid depends on the `wl_output.name` field, this
only works properly on KDE 5.26+ or Gnome 44+ ([kwin
commit](330a02d862),
[mutter](7e838b1115)).

Release Notes:

- N/A
2024-06-03 09:27:01 -07:00
apricotbucket28
ed86b86dc7
cosmic_text: Handle variation selectors; fix emoji colors (#12587)
Basically, we detect if a glyph is a variation selector if its `id` is 3
(i.e. a whitespace character) and if it comes from an emoji font (since
variation selectors are only used for emoji glyphs).

- Fixes https://github.com/zed-industries/zed/issues/11703 and
https://github.com/zed-industries/zed/issues/12022

Release Notes:

- N/A
2024-06-03 09:25:44 -07:00