summaryrefslogtreecommitdiff
path: root/src/app/state.rs
diff options
context:
space:
mode:
authorCHIH,GODLEE <61595521+ChihGodlee@users.noreply.github.com>2026-05-18 20:27:43 +0800
committerGitHub <noreply@github.com>2026-05-18 15:27:43 +0300
commit3189ede2b9225b1b930cc43368248c6b4f3a4daf (patch)
tree24252debe6f388edfe0e621462f1bf38d5b46b20 /src/app/state.rs
parentc9eb7520e66c2a941c020e96e8242de66847f29d (diff)
feat: configure sidebar min/max width via [ui] (#135)
* feat: configure sidebar min/max width via [ui] Expose the previously hardcoded MIN_SIDEBAR_WIDTH / MAX_SIDEBAR_WIDTH clamps as [ui] sidebar_min_width / sidebar_max_width. Defaults remain 18 / 36 so existing configs are unchanged. Hot-reload is wired through the existing [ui] block; reload re-clamps the live width to the new bounds so tightening takes effect immediately. Reject inverted bounds (min > max) at every entry point so a bad config can never reach u16::clamp(min, max), which panics: App::new falls back to defaults, and apply_live_config treats the whole [ui] section as invalid and returns a partial reload report. refs #132 * test: keep sidebar reload width within bounds refs #132 --------- Co-authored-by: Ogulcan Celik <ogulcancelik@gmail.com>
Diffstat (limited to 'src/app/state.rs')
-rw-r--r--src/app/state.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/app/state.rs b/src/app/state.rs
index 72630749..c5734ec2 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -928,6 +928,8 @@ pub struct AppState {
pub prefix_mods: KeyModifiers,
pub default_sidebar_width: u16,
pub sidebar_width: u16,
+ pub sidebar_min_width: u16,
+ pub sidebar_max_width: u16,
pub sidebar_width_source: SidebarWidthSource,
pub sidebar_width_auto: bool,
pub sidebar_collapsed: bool,
@@ -1170,6 +1172,8 @@ impl AppState {
prefix_mods: KeyModifiers::CONTROL,
default_sidebar_width: 26,
sidebar_width: 26,
+ sidebar_min_width: 18,
+ sidebar_max_width: 36,
sidebar_width_source: SidebarWidthSource::ConfigDefault,
sidebar_width_auto: false,
sidebar_collapsed: false,