Fix vim toggle on welcome

This commit is contained in:
Conrad Irwin 2023-12-12 19:03:54 -07:00
parent a9349267ec
commit 1a86e4ff96
3 changed files with 14 additions and 15 deletions

1
Cargo.lock generated
View File

@ -11423,6 +11423,7 @@ dependencies = [
"theme_selector2",
"ui2",
"util",
"vim2",
"workspace2",
]

View File

@ -26,7 +26,7 @@ theme_selector = { package = "theme_selector2", path = "../theme_selector2" }
util = { path = "../util" }
picker = { package = "picker2", path = "../picker2" }
workspace = { package = "workspace2", path = "../workspace2" }
# vim = { package = "vim2", path = "../vim2" }
vim = { package = "vim2", path = "../vim2" }
anyhow.workspace = true
log.workspace = true

View File

@ -11,6 +11,7 @@ use gpui::{
use settings::{Settings, SettingsStore};
use std::sync::Arc;
use ui::{prelude::*, Checkbox};
use vim::VimModeSetting;
use workspace::{
dock::DockPosition,
item::{Item, ItemEvent},
@ -128,29 +129,26 @@ impl Render for WelcomePage {
.border_color(cx.theme().colors().border)
.rounded_md()
.child(
// todo!("vim setting")
h_stack()
.gap_2()
.child(
Checkbox::new(
"enable-vim",
if false
/* VimSettings::get_global(cx).enabled */
{
if VimModeSetting::get_global(cx).0 {
ui::Selection::Selected
} else {
ui::Selection::Unselected
},
),
// .on_click(cx.listener(
// move |this, selection, cx| {
// this.update_settings::<VimSettings>(
// selection,
// cx,
// |settings, value| settings.enabled = value,
// );
// },
// )),
)
.on_click(cx.listener(
move |this, selection, cx| {
this.update_settings::<VimModeSetting>(
selection,
cx,
|setting, value| *setting = Some(value),
);
},
)),
)
.child(Label::new("Enable vim mode")),
)