Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/iamb.5
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,11 @@ Defaults to 30.
.It Sy tabstop
Number of spaces that a <Tab> counts for.
Defaults to 4.

.It Sy set_window_title
Whether to set the title of the terminal window to
.Dq Sy iamb (<user_id>) .
Defaults to true.
.El

.Ss Example 1: Avoid showing Emojis (useful for terminals w/o support)
Expand Down
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ pub struct TunableValues {
pub user_gutter_width: usize,
pub external_edit_file_suffix: String,
pub tabstop: usize,
pub set_window_title: bool,
}

#[derive(Clone, Default, Deserialize)]
Expand Down Expand Up @@ -609,6 +610,7 @@ pub struct Tunables {
pub user_gutter_width: Option<usize>,
pub external_edit_file_suffix: Option<String>,
pub tabstop: Option<usize>,
pub set_window_title: Option<bool>,
}

impl Tunables {
Expand Down Expand Up @@ -643,6 +645,7 @@ impl Tunables {
.external_edit_file_suffix
.or(other.external_edit_file_suffix),
tabstop: self.tabstop.or(other.tabstop),
set_window_title: self.set_window_title.or(other.set_window_title),
}
}

Expand Down Expand Up @@ -673,6 +676,7 @@ impl Tunables {
.external_edit_file_suffix
.unwrap_or_else(|| ".md".to_string()),
tabstop: self.tabstop.unwrap_or(4),
set_window_title: self.set_window_title.unwrap_or(true),
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,11 @@ fn setup_tty(settings: &ApplicationSettings, enable_enhanced_keys: bool) -> std:
if settings.tunables.mouse.enabled {
crossterm::execute!(stdout(), EnableMouseCapture)?;
}
if settings.tunables.set_window_title {
crossterm::execute!(stdout(), SetTitle(title))?;
}

crossterm::execute!(stdout(), EnableBracketedPaste, EnableFocusChange, SetTitle(title))
crossterm::execute!(stdout(), EnableBracketedPaste, EnableFocusChange)
}

// Do our best to reverse what we did in setup_tty() when we exit or crash.
Expand Down
1 change: 1 addition & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ pub fn mock_tunables() -> TunableValues {
image_preview: None,
user_gutter_width: 30,
tabstop: 4,
set_window_title: true,
}
}

Expand Down
Loading