Launcher: instances in the sidebar, and a dialog to make and edit them

The sidebar lists the instances by group with their icons (a texture from the
player's prepared files, drawn as pixels, or a colour); clicking one selects it
for Play. + makes one, empty or a copy of the selected one (copied in the
background); Home's Instance row edits its name, group and icon, copies it, and
opens its folder. The dialog's name and group are the launcher's shared text
fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-27 01:21:56 +01:00
parent 1d0d827f3a
commit a76456b036
5 changed files with 621 additions and 71 deletions
+3 -1
View File
@@ -76,7 +76,9 @@ The opening, then Play ([clip](docs/opening.webm)):
sign-in sessions, logs or data collection state). Names, icons (a block or item texture from the
player's prepared files, or a colour) and groups are kept in `instances.json` in the launcher's
data folder, so renaming moves nothing. Every instance follows the launcher's data collection
answer and No AI.
answer and No AI. In the window, **+** beside Instances makes one, the sidebar lists them by
group (click one to play it), and Home's Instance row has Edit (name, group, icon), Copy and
Open folder.
- **Patch notes**: each release's notes, newest first, with a link to GitHub Sponsors. Quiet "Discord" and "Website" links sit in the footer.
Data lives in the platform's data directory (`~/.local/share/horizon-launcher` on Linux,
+583
View File
@@ -0,0 +1,583 @@
//! Instances in the window (`horizon_launcher::instances`): the sidebar's list, by group, and the
//! dialog that makes one (empty, or a copy of the selected one) or changes its name, group and
//! icon.
use super::*;
use gpui::RenderImage;
use horizon_launcher::instances::{self, Icon, Instance, Kind as InstanceKind};
use servers_page::Field;
use std::collections::HashMap;
use std::sync::Arc;
/// Textures offered as icons, when the player's prepared files hold them: block faces and items
/// that read well at sidebar size.
const TEXTURES: [&str; 24] = [
"grass_block_side",
"oak_planks",
"oak_log",
"cobblestone",
"bricks",
"bookshelf",
"crafting_table_front",
"tnt_side",
"sand",
"snow",
"ice",
"obsidian",
"netherrack",
"end_stone",
"glowstone",
"diamond_ore",
"diamond",
"emerald",
"apple",
"ender_pearl",
"iron_pickaxe",
"diamond_sword",
"bow",
"book",
];
/// Colours offered as icons: Horizon's accent and a few that sit beside it in both themes.
const COLOURS: [&str; 8] = [
"#5b3fd6", "#3f7fd6", "#2f9e8f", "#4f9e2f", "#c9a227", "#d9732f", "#c4405a", "#7d7591",
];
/// The dialog: a new instance (`editing` None) or one being changed. Its name and group are the
/// text fields `Field::InstanceName` and `Field::InstanceGroup`.
pub(super) struct InstanceDialog {
editing: Option<String>,
/// A new instance copies the selected one's worlds, options and packs.
copy: bool,
icon: Option<Icon>,
error: Option<String>,
busy: bool,
}
/// The instances and their icons as images, kept between frames.
#[derive(Default)]
pub(super) struct Instances {
pub(super) list: Vec<Instance>,
pub(super) dialog: Option<InstanceDialog>,
icons: HashMap<(String, u32), Option<Arc<RenderImage>>>,
}
impl Launcher {
pub(super) fn reload_instances(&mut self) {
self.instances.list = instances::list();
}
/// The instance Play starts.
pub(super) fn selected_instance(&self) -> Option<&Instance> {
let id = self
.settings
.instance
.as_deref()
.unwrap_or(instances::DEFAULT);
let list = &self.instances.list;
list.iter().find(|i| i.id == id).or(list.first())
}
fn select_instance(&mut self, instance: &Instance) {
self.settings.instance =
(instance.kind != InstanceKind::Default).then(|| instance.id.clone());
self.settings.save();
}
/// A texture from the selected version's prepared files, its first frame, drawn as pixels.
fn texture_image(&mut self, name: &str, size: f32) -> Option<Arc<RenderImage>> {
let tag = self.selected().filter(|t| backend::is_prepared(t))?.clone();
let scale = self.scale;
self.instances
.icons
.entry((name.to_string(), (size * scale) as u32))
.or_insert_with(|| {
let path = Icon::Texture(name.into()).texture(&backend::resources(&tag))?;
let png = image::open(path).ok()?.to_rgba8();
let w = png.width() as usize;
// An animated texture is its frames one under another: the first is square.
let texels: Vec<[u8; 4]> = png.pixels().take(w * w).map(|p| p.0).collect();
Some(art::bake(&texels, w, w, size / w as f32, scale))
})
.clone()
}
/// An instance's icon, `size` points square.
pub(super) fn instance_icon(&mut self, instance: &Instance, size: f32) -> AnyElement {
let t = self.theme;
let framed = |d: Div| {
d.flex()
.flex_none()
.items_center()
.justify_center()
.size(px(size))
.border_2()
.border_color(t.outline)
};
match &instance.icon {
Some(Icon::Colour(hex)) => {
let rgb = u32::from_str_radix(&hex[1..], 16).unwrap_or(0);
return framed(div().bg(gpui::rgb(rgb)))
.child(
blocks::pixel((size * 0.42).round(), FontWeight::BOLD)
.text_color(gpui::white())
.child(initial(&instance.name)),
)
.into_any_element();
}
Some(Icon::Texture(name)) => {
if let Some(image) = self.texture_image(name, size - 8.) {
return framed(div().bg(t.well))
.child(gpui::img(image).size(px(size - 8.)))
.into_any_element();
}
}
None if instance.kind == InstanceKind::Default => {
if let Some(grass) = self.vanilla_icon() {
return div()
.flex()
.items_center()
.justify_center()
.size(px(size))
.child(gpui::img(grass).size(px(size - 4.)))
.into_any_element();
}
}
None => {}
}
blocks::slot(None, &instance.name, size, &t).into_any_element()
}
/// The sidebar's instances: those without a group, then each group under its name.
pub(super) fn instance_items(
&mut self,
heading: impl Fn(String) -> Div,
cx: &mut Context<Self>,
) -> Vec<AnyElement> {
let t = self.theme;
let tag = self.selected().cloned();
let prepared = tag.as_deref().is_some_and(backend::is_prepared);
let status = if tag.is_none() {
"No version installed"
} else if prepared {
"Ready"
} else {
"Needs preparing"
};
let selected = self.selected_instance().map(|i| i.id.clone());
let on_packs = self.page == Page::Mods && self.mods.on_modpacks();
let mut out = Vec::new();
let mut group = None;
for i in self.instances.list.clone() {
if i.group != group {
group = i.group.clone();
if let Some(g) = &group {
out.push(heading(g.to_uppercase()).into_any_element());
}
}
let (open, sub) = match i.kind {
InstanceKind::Default | InstanceKind::Own => (
self.page == Page::Play && selected.as_ref() == Some(&i.id),
status.to_string(),
),
InstanceKind::Port => {
let slug = &i.id["port:".len()..];
let summary = self.packs.iter().find(|p| p.slug == slug);
(
on_packs && self.pack_open.as_deref() == Some(slug),
summary.map_or_else(|| "Modpack".into(), |p| p.summary()),
)
}
InstanceKind::Pack => (false, "From Horizon's registry".into()),
};
let dot = matches!(i.kind, InstanceKind::Default | InstanceKind::Own).then(|| {
div()
.absolute()
.left(px(42.))
.top(px(42.))
.size(px(10.))
.bg(if prepared { t.success } else { t.warn })
.border_2()
.border_color(t.side)
});
let icon = self.instance_icon(&i, 44.);
let clicked = i.clone();
out.push(
blocks::side_item(format!("side-instance-{}", i.id).into(), open, &t)
.child(icon)
.children(dot)
.child(
div()
.flex()
.flex_col()
.min_w_0()
.child(
blocks::pixel(15., FontWeight::MEDIUM)
.text_color(t.ink)
.truncate()
.child(i.name.clone()),
)
.child(
text(theme::CAPTION)
.text_color(t.muted)
.truncate()
.child(sub),
),
)
.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
match clicked.kind {
InstanceKind::Default | InstanceKind::Own => {
this.select_instance(&clicked);
this.go(Page::Play);
}
InstanceKind::Port => {
this.show_modpack(Some(clicked.id["port:".len()..].into()))
}
InstanceKind::Pack => this.show_modpack(None),
}
cx.notify();
}))
.into_any_element(),
);
}
out
}
/// Opens the dialog for a new instance, or for changing `editing`.
pub(super) fn open_instance_dialog(&mut self, editing: Option<Instance>) {
let (name, group) = editing
.as_ref()
.map(|i| (i.name.clone(), i.group.clone().unwrap_or_default()))
.unwrap_or_default();
*self.servers.text(Field::InstanceName) = name;
*self.servers.text(Field::InstanceGroup) = group;
self.servers.focus_soon = Some(Field::InstanceName);
self.instances.dialog = Some(InstanceDialog {
icon: editing.as_ref().and_then(|i| i.icon.clone()),
editing: editing.map(|i| i.id),
copy: false,
error: None,
busy: false,
});
}
/// Escape closes the dialog. Whether it did.
pub(super) fn instance_escape(&mut self) -> bool {
if self.instances.dialog.as_ref().is_some_and(|d| !d.busy) {
self.instances.dialog = None;
return true;
}
false
}
/// Creates or changes the instance as the dialog says. A copy can be gigabytes of worlds, so
/// the work runs in the background.
pub(super) fn save_instance(&mut self, cx: &mut Context<Self>) {
let selected = self.selected_instance().map(|i| i.id.clone());
let name = self.servers.value(Field::InstanceName).trim().to_string();
let group = Some(self.servers.value(Field::InstanceGroup).to_string());
let Some(d) = self.instances.dialog.as_mut().filter(|d| !d.busy) else {
return;
};
let icon = d.icon.clone();
let editing = d.editing.clone();
let copy = selected.filter(|_| d.copy);
d.busy = true;
d.error = None;
let task = cx.background_executor().spawn(async move {
let id = match editing {
Some(id) => id,
None => instances::create(&name, copy.as_deref())?.id,
};
instances::edit(&id, |m| {
m.name = Some(name);
m.group = group;
m.icon = icon;
})
});
cx.spawn(async move |this, cx| {
let result = task.await;
let _ = this.update(cx, |this, cx| {
match result {
Ok(instance) => {
this.instances.dialog = None;
this.select_instance(&instance);
this.reload_instances();
if matches!(instance.kind, InstanceKind::Default | InstanceKind::Own) {
this.go(Page::Play);
}
}
Err(e) => {
if let Some(d) = &mut this.instances.dialog {
d.busy = false;
d.error = Some(e);
}
}
}
cx.notify();
});
})
.detach();
}
pub(super) fn instance_dialog(&mut self, cx: &mut Context<Self>) -> Option<Stateful<Div>> {
let t = self.theme;
let d = self.instances.dialog.as_ref()?;
let (editing, copy, icon, error, busy) = (
d.editing.is_some(),
d.copy,
d.icon.clone(),
d.error.clone(),
d.busy,
);
let from = self
.selected_instance()
.map_or_else(|| "Horizon".into(), |i| i.name.clone());
let row = |label: &'static str, control: AnyElement| {
div()
.flex()
.flex_col()
.gap(px(8.))
.child(caps(label).text_color(t.muted))
.child(control)
};
let mut body = div()
.flex()
.flex_col()
.gap(px(20.))
.p(px(24.))
.child(
blocks::pixel(22., FontWeight::MEDIUM)
.text_color(t.ink)
.child(if editing {
"Edit instance"
} else {
"New instance"
}),
)
.child(row(
"Name",
self.field(Field::InstanceName, "My instance", 400., cx)
.into_any_element(),
));
if !editing {
let weak = cx.entity().downgrade();
body = body.child(row(
"Start from",
segments(
"instance-from",
&[(false, "Empty"), (true, "A copy of the selected one")],
copy,
&t,
move |copy, _, cx| {
let _ = weak.update(cx, |this, cx| {
if let Some(d) = &mut this.instances.dialog {
d.copy = copy;
}
cx.notify();
});
},
)
.into_any_element(),
));
body = body.child(text(theme::CAPTION).text_color(t.muted).child(if copy {
format!("{from}'s worlds, options and packs are copied; {from} stays as it is.")
} else {
"Its own worlds and packs; your options and player name come along.".to_string()
}));
}
body = body.child(row(
"Group",
self.field(Field::InstanceGroup, "No group", 400., cx)
.into_any_element(),
));
let mut tiles = div().flex().flex_wrap().gap(px(6.));
let tile = |id: String, chosen: bool| {
div()
.id(SharedString::from(id))
.flex()
.items_center()
.justify_center()
.size(px(40.))
.border_2()
.border_color(if chosen { t.accent } else { t.rule })
.cursor_pointer()
.hover(move |s| s.border_color(t.outline))
};
let none = icon.is_none();
tiles = tiles.child(
tile("instance-icon-none".into(), none)
.child(text(theme::MICRO).text_color(t.muted).child("NONE"))
.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
if let Some(d) = &mut this.instances.dialog {
d.icon = None;
}
cx.notify();
})),
);
for name in TEXTURES {
let Some(image) = self.texture_image(name, 28.) else {
continue;
};
let chosen = icon == Some(Icon::Texture(name.into()));
tiles = tiles.child(
tile(format!("instance-icon-{name}"), chosen)
.bg(t.well)
.child(gpui::img(image).size(px(28.)))
.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
if let Some(d) = &mut this.instances.dialog {
d.icon = Some(Icon::Texture(name.into()));
}
cx.notify();
})),
);
}
for hex in COLOURS {
let chosen = icon == Some(Icon::Colour(hex.into()));
let rgb = u32::from_str_radix(&hex[1..], 16).unwrap_or(0);
tiles = tiles.child(
tile(format!("instance-icon-{hex}"), chosen)
.child(div().size(px(28.)).bg(gpui::rgb(rgb)))
.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
if let Some(d) = &mut this.instances.dialog {
d.icon = Some(Icon::Colour(hex.into()));
}
cx.notify();
})),
);
}
body = body.child(row("Icon", tiles.into_any_element()));
if self.selected().is_none_or(|t| !backend::is_prepared(t)) {
body = body.child(
text(theme::CAPTION)
.text_color(t.muted)
.child("Block and item icons come from your prepared game files: prepare a version to see them."),
);
}
if let Some(e) = error {
body = body.child(text(theme::CAPTION).text_color(t.danger).child(e));
}
let cancel = button("instance-cancel", "Cancel", Kind::Secondary, &t);
let label = match (editing, busy, copy) {
(_, true, true) => "Copying…",
(true, false, _) => "Save",
_ => "Create",
};
let save = button("instance-save", label, Kind::Primary, &t);
// A modpack becomes an instance by being imported, on the Mods page.
let import = (!editing && !busy).then(|| {
button("instance-import", "Import a modpack…", Kind::Ghost, &t)
.mr_auto()
.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
this.instances.dialog = None;
this.show_modpack(None);
cx.notify();
}))
});
let foot = div()
.flex()
.justify_end()
.gap(px(8.))
.px(px(24.))
.py(px(16.))
.border_t_1()
.border_color(t.rule)
.children(import);
let foot = if busy {
foot.child(disabled(cancel)).child(disabled(save))
} else {
foot.child(cancel.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
this.instances.dialog = None;
cx.notify();
})))
.child(save.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
this.save_instance(cx);
cx.notify();
})))
};
let card = plate(&t)
.flex()
.flex_col()
.w_full()
.max_w(px(560.))
.bg(t.page)
.border_1()
.border_color(t.rule)
.child(body)
.child(foot);
Some(
div()
.id("instance-dialog")
.absolute()
.top_0()
.left_0()
.size_full()
.flex()
.flex_col()
.items_center()
.px(px(32.))
.py(px(24.))
.bg(t.page.opacity(0.92))
.on_scroll_wheel(|_, _, cx| cx.stop_propagation())
.occlude()
.child(card),
)
}
/// The Play page's row for the selected instance: its folder, and changing or copying it.
pub(super) fn instance_row(&mut self, n: usize, cx: &mut Context<Self>) -> Option<Div> {
let t = self.theme;
let instance = self.selected_instance()?.clone();
let (home, edit, name) = (
instance.home.clone(),
instance.clone(),
instance.name.clone(),
);
let actions = div()
.flex()
.gap(px(8.))
.child(
button("instance-edit", "Edit…", Kind::Ghost, &t).on_click(cx.listener(
move |this, _: &ClickEvent, _, cx| {
this.open_instance_dialog(Some(edit.clone()));
cx.notify();
},
)),
)
.child(
button("instance-copy", "Copy…", Kind::Ghost, &t).on_click(cx.listener(
move |this, _: &ClickEvent, _, cx| {
this.open_instance_dialog(None);
*this.servers.text(Field::InstanceName) = format!("{name} copy");
if let Some(d) = &mut this.instances.dialog {
d.copy = true;
}
cx.notify();
},
)),
)
.child(
button("instance-folder", "Open folder", Kind::Ghost, &t).on_click(
move |_, _, cx| {
let _ = std::fs::create_dir_all(&home);
cx.open_with_system(&home);
},
),
);
Some(index_row(
n,
"Instance",
Some(div().child(instance.name.clone()).into_any_element()),
Some(actions.into_any_element()),
&t,
))
}
}
/// The first letter or digit of a name, for an icon without a picture.
fn initial(name: &str) -> String {
name.chars()
.find(|c| c.is_alphanumeric())
.unwrap_or('?')
.to_uppercase()
.to_string()
}
+22 -68
View File
@@ -12,6 +12,7 @@ mod collection;
mod console;
mod cull;
mod game_tools;
mod instances_page;
mod internet;
mod markdown;
mod mcp;
@@ -223,6 +224,8 @@ struct Launcher {
starting_pack: Option<std::path::PathBuf>,
/// The Mods page: the browser's search, installs and updates (`mods_page.rs`).
mods: mods_page::Mods,
/// The instances, for the sidebar and Play, and their dialog (`instances_page.rs`).
instances: instances_page::Instances,
/// The name the game made up for an offline player (`horizon-player.txt`), for the top bar.
offline_name: Option<String>,
/// The player's servers, for the sidebar until the Servers page has read them.
@@ -379,11 +382,13 @@ impl Launcher {
pack_error: None,
starting_pack: None,
mods: mods_page::Mods::new(cx),
instances: instances_page::Instances::default(),
offline_name: offline_name(),
side_servers: horizon_launcher::servers::list(),
art: art::Art::default(),
scale: window.scale_factor(),
};
this.reload_instances();
if this.bench.is_some() {
this.perf.keep_local_log(false);
}
@@ -1575,7 +1580,7 @@ impl Launcher {
fn sidebar(&mut self, cx: &mut Context<Self>) -> Stateful<Div> {
let t = self.theme;
self.load_packs();
let heading = |label: &'static str| {
let heading = |label: String| {
div()
.flex()
.items_center()
@@ -1606,7 +1611,7 @@ impl Launcher {
.border_2()
.border_color(t.side)
};
let add = keyboard(div().id("add-pack"), &t)
let add = keyboard(div().id("add-instance"), &t)
.flex()
.items_center()
.justify_center()
@@ -1618,79 +1623,23 @@ impl Launcher {
.hover(move |s| s.bg(t.raised))
.child(blocks::icon("plus", 14., t.ink_soft))
.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
this.show_modpack(None);
this.open_instance_dialog(None);
cx.notify();
}));
let mut list = div()
let list = div()
.flex()
.flex_col()
.gap(px(4.))
.child(heading("INSTANCES").child(add));
// Horizon itself, with a grass block from the player's own prepared files.
let tag = self.selected().cloned();
let prepared = tag.as_deref().is_some_and(backend::is_prepared);
let grass = self.vanilla_icon();
let on_play = self.page == Page::Play;
list = list.child(
blocks::side_item("side-horizon".into(), on_play, &t)
.child(match grass {
Some(g) => div()
.flex()
.items_center()
.justify_center()
.size(px(44.))
.child(gpui::img(g).size(px(40.))),
None => blocks::slot(None, "Horizon", 44., &t),
})
.child(dot(if prepared { t.success } else { t.warn }))
.child(
div()
.flex()
.flex_col()
.min_w_0()
.child(title("Horizon".into()))
.child(sub(if tag.is_none() {
"No version installed"
} else if prepared {
"Vanilla · ready"
} else {
"Needs preparing"
}
.into())),
)
.on_click(cx.listener(|this, _: &ClickEvent, _, cx| {
this.go(Page::Play);
cx.notify();
})),
);
let on_packs = self.page == Page::Mods && self.mods.on_modpacks();
for p in &self.packs {
let slug = p.slug.clone();
let open = on_packs && self.pack_open.as_ref() == Some(&p.slug);
list = list.child(
blocks::side_item(format!("side-pack-{slug}").into(), open, &t)
.child(blocks::slot(None, p.title(), 44., &t))
.child(
div()
.flex()
.flex_col()
.min_w_0()
.child(title(p.title().to_string()))
.child(sub(p.summary())),
)
.on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
this.show_modpack(Some(slug.clone()));
cx.notify();
})),
);
}
.child(heading("INSTANCES".into()).child(add))
.children(self.instance_items(heading, cx));
let servers: Vec<_> = self
.servers
.sidebar_list()
.map(<[_]>::to_vec)
.unwrap_or_else(|| self.side_servers.clone());
let mut list = list;
if !servers.is_empty() {
list = list.child(heading("SERVERS"));
list = list.child(heading("SERVERS".into()));
}
for e in servers {
let up = self.servers.is_up(&e.dir);
@@ -2074,15 +2023,16 @@ impl Launcher {
.flex()
.flex_col()
.child(section_title("Ready to play", "check", &t).mb(px(12.)))
.children(self.instance_row(1, cx))
.child(index_row(
1,
2,
"Resources",
Some(div().child(resources_value).into_any_element()),
Some(prepare.into_any_element()),
&t,
))
.child(index_row(
2,
3,
"Minecraft folder",
Some(minecraft),
Some(
@@ -2098,7 +2048,7 @@ impl Launcher {
// offline, in a build that can sign in.
if self.accounts.selected().is_none() && account::client_id().is_some() {
rows = rows.child(index_row(
4,
5,
"Playing offline",
Some(
div()
@@ -3064,7 +3014,7 @@ impl Launcher {
join = disabled(join);
}
index_row(
3,
4,
"Join a friend",
Some(
div()
@@ -3523,6 +3473,7 @@ impl Render for Launcher {
}
}
"escape" if this.servers_escape() => {}
"escape" if this.instance_escape() => {}
_ => return,
}
cx.stop_propagation();
@@ -3583,6 +3534,9 @@ impl Render for Launcher {
root = root.child(dialog);
}
}
if let Some(dialog) = self.instance_dialog(cx) {
root = root.child(dialog);
}
if self.asking_consent() {
root = root.child(self.consent_screen(cx));
}
+1
View File
@@ -132,6 +132,7 @@ impl Launcher {
self.mods.report_list.reset();
self.packs = modpacks::list();
self.registry_packs = horizon_pack::list();
self.reload_instances();
if self.pack_open.is_none() {
self.pack_open = self.packs.first().map(|p| p.slug.clone());
}
+12 -2
View File
@@ -32,10 +32,13 @@ pub(super) enum Field {
Port,
Token,
Email,
/// The instance dialog's (`instances_page.rs`).
InstanceName,
InstanceGroup,
}
impl Field {
const ALL: [Field; 9] = [
const ALL: [Field; 11] = [
Field::Name,
Field::Seed,
Field::Players,
@@ -45,6 +48,8 @@ impl Field {
Field::Port,
Field::Token,
Field::Email,
Field::InstanceName,
Field::InstanceGroup,
];
}
@@ -163,7 +168,7 @@ pub(super) struct Servers {
focus: HashMap<Field, FocusHandle>,
focused: Option<Field>,
/// The field to put the keyboard in on the next frame.
focus_soon: Option<Field>,
pub(super) focus_soon: Option<Field>,
/// A suggested value shown selected: the first key typed replaces it.
selected: Option<Field>,
/// A field whose value was refused, and why: shown under it until it's edited.
@@ -961,11 +966,15 @@ impl Launcher {
command,
);
match typed {
Key::Enter if matches!(f, Field::InstanceName | Field::InstanceGroup) => {
this.save_instance(cx)
}
Key::Enter => this.field_enter(f),
Key::Escape => {
if this.servers.create.is_some() && !this.servers.creating {
this.servers.create = None;
}
this.instance_escape();
window.blur();
}
Key::Paste => {
@@ -1017,6 +1026,7 @@ impl Launcher {
Field::Port => self.save_port(),
Field::Token => self.save_token(),
Field::Email => self.invite_friend(),
Field::InstanceName | Field::InstanceGroup => {}
}
}