Cargo.lock 🔗
@@ -490,6 +490,7 @@ dependencies = [
"ui",
"util",
"uuid",
+ "vim_mode_setting",
"workspace",
"zed_actions",
]
Danilo Leal created
This PR makes the Assistant 2 submit button have a different width if
the platform is Linux or Windows, or if Vim mode is turned on. That's
because we now use written out words instead of icons for keybindings
when in those conditions.
| Before | After |
|--------|--------|
| 
| 
|
Release Notes:
- N/A
Cargo.lock | 1 +
crates/assistant2/Cargo.toml | 1 +
crates/assistant2/src/message_editor.rs | 15 +++++++++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
@@ -490,6 +490,7 @@ dependencies = [
"ui",
"util",
"uuid",
+ "vim_mode_setting",
"workspace",
"zed_actions",
]
@@ -73,6 +73,7 @@ time_format.workspace = true
ui.workspace = true
util.workspace = true
uuid.workspace = true
+vim_mode_setting.workspace = true
workspace.workspace = true
zed_actions.workspace = true
@@ -14,8 +14,10 @@ use std::time::Duration;
use text::Bias;
use theme::ThemeSettings;
use ui::{
- prelude::*, ButtonLike, KeyBinding, PopoverMenu, PopoverMenuHandle, Switch, TintColor, Tooltip,
+ prelude::*, ButtonLike, KeyBinding, PlatformStyle, PopoverMenu, PopoverMenuHandle, Switch,
+ TintColor, Tooltip,
};
+use vim_mode_setting::VimModeSetting;
use workspace::Workspace;
use crate::assistant_model_selector::AssistantModelSelector;
@@ -274,7 +276,6 @@ impl Render for MessageEditor {
let inline_context_picker = self.inline_context_picker.clone();
let bg_color = cx.theme().colors().editor_background;
let is_streaming_completion = self.thread.read(cx).is_streaming();
- let button_width = px(64.);
let is_model_selected = self.is_model_selected(cx);
let is_editor_empty = self.is_editor_empty(cx);
let submit_label_color = if is_editor_empty {
@@ -283,6 +284,16 @@ impl Render for MessageEditor {
Color::Default
};
+ let vim_mode_enabled = VimModeSetting::get_global(cx).0;
+ let platform = PlatformStyle::platform();
+ let linux = platform == PlatformStyle::Linux;
+ let windows = platform == PlatformStyle::Windows;
+ let button_width = if linux || windows || vim_mode_enabled {
+ px(92.)
+ } else {
+ px(64.)
+ };
+
v_flex()
.key_context("MessageEditor")
.on_action(cx.listener(Self::chat))