mirror of
https://github.com/starship/starship.git
synced 2026-06-24 02:01:36 +07:00
fix(fill): Add terminal-width argument to explicitly define terminal's width (#3090)
Add `terminal-width` argument to explicitly define terminal's width Update pwsh,bash,zsh,fish init scripts with `terminal-width` argument Co-authored-by: Kevin Song <chips@ksong.dev> Co-authored-by: Kevin Song <4605384+chipbuster@users.noreply.github.com>
This commit is contained in:
+7
-3
@@ -131,6 +131,12 @@ impl<'a> Context<'a> {
|
||||
|
||||
let right = arguments.is_present("right");
|
||||
|
||||
let width = arguments
|
||||
.value_of("terminal_width")
|
||||
.and_then(|w| w.parse().ok())
|
||||
.or_else(|| terminal_size().map(|(w, _)| w.0 as usize))
|
||||
.unwrap_or(80);
|
||||
|
||||
Context {
|
||||
config,
|
||||
properties,
|
||||
@@ -141,9 +147,7 @@ impl<'a> Context<'a> {
|
||||
repo: OnceCell::new(),
|
||||
shell,
|
||||
right,
|
||||
width: terminal_size()
|
||||
.map(|(w, _)| w.0 as usize)
|
||||
.unwrap_or_default(),
|
||||
width,
|
||||
#[cfg(test)]
|
||||
env: HashMap::new(),
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user