style: remove redundant code narration

This commit is contained in:
objz committed 2026-10-01 13:53:12 +02:00
1 parent 495f31778b
commit 783fb76f06
115 files changed
+19 -746

No files matched your search

@@ -1,9 +1,6 @@
// SPDX-FileCopyrightText: 2026 Constantin Bauer
// SPDX-License-Identifier: GPL-3.0-only
// rendering for the new instance wizard. each step gets its own render fn
// and the popup resizes itself based on which step is active.
use super::super::LoadState;
use super::state::{
WIZARD_STATE, WizardState, WizardStep, clamp_loader_version_index, clamp_version_index,
@@ -33,7 +30,6 @@ pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
clamp_version_index(&mut state);
}
// vanilla has no loader version, so skip straight to confirm
if state.step == WizardStep::LoaderVersion {
if state.selected_loader() == ModLoader::Vanilla {
state.step = WizardStep::Confirm;
@@ -141,7 +137,6 @@ fn step_keybinds(state: &WizardState) -> ratatui::text::Line<'static> {
fn render_name_step(state: &WizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
let theme = THEME.as_ref();
let value = state.name_state.value();
// \u{2588} is the full block char used as a fake blinking cursor
let line = if value.is_empty() {
Line::from(vec![
Span::styled("Instance name...", Style::default().fg(theme.text_dim())),
+3 -14
View File
@@ -1,10 +1,6 @@
// SPDX-FileCopyrightText: 2026 Constantin Bauer
// SPDX-License-Identifier: GPL-3.0-only
// state machine and input handling for the new instance wizard.
// flow: Name -> Loader -> Version -> LoaderVersion -> Confirm
// version lists are fetched lazily from the network when you reach that step.
use crate::instance::{loader::GameVersion, models::ModLoader};
use crate::tui::widgets::instances;
use crossterm::event::{KeyCode, KeyEvent};
@@ -16,7 +12,6 @@ use super::super::LoadState;
pub(crate) static WIZARD_STATE: LazyLock<Arc<Mutex<WizardState>>> =
LazyLock::new(|| Arc::new(Mutex::new(WizardState::default())));
// populated on confirm, consumed by the main event loop to actually create the instance
pub(crate) static WIZARD_RESULT: LazyLock<Arc<Mutex<Option<WizardParams>>>> =
LazyLock::new(|| Arc::new(Mutex::new(None)));
@@ -163,7 +158,6 @@ fn handle_version_key(
key_event: &KeyEvent,
instances_state: &mut instances::State,
) {
// Search mode: route char input to search query
if state.version_search.active {
match key_event.code {
KeyCode::Esc => {
@@ -176,12 +170,8 @@ fn handle_version_key(
clamp_version_index(state);
return;
}
KeyCode::Char('j') | KeyCode::Down => {
// fall through to navigation below
}
KeyCode::Char('k') | KeyCode::Up => {
// fall through to navigation below
}
KeyCode::Char('j') | KeyCode::Down => {}
KeyCode::Char('k') | KeyCode::Up => {}
KeyCode::Char(c) => {
state.version_search.push(c);
state.version_idx = 0; // reset to top of filtered list
@@ -384,8 +374,7 @@ pub(crate) fn clamp_loader_version_index(state: &mut WizardState) {
}
}
// only fires on the Idle -> Loading transition to avoid spamming requests.
// the spawned task writes results back into WIZARD_STATE when done.
// Spawn only on Idle -> Loading to avoid repeating network requests per frame.
pub(crate) fn ensure_versions_loaded(state: &mut WizardState) {
if !matches!(state.versions, LoadState::Idle) {
return;