Add measure_widths config option
This commit is contained in:
parent
39026a217d
commit
f7f200a608
3 changed files with 16 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ Procedure when bumping the version number:
|
|||
|
||||
### Added
|
||||
- `help-config` CLI command
|
||||
- `measure_widths` config option
|
||||
|
||||
### Changed
|
||||
- Simplified flake dependencies
|
||||
|
|
|
|||
|
|
@ -90,6 +90,18 @@ pub struct Config {
|
|||
#[document(default = "`false`")]
|
||||
pub ephemeral: bool,
|
||||
|
||||
/// Whether to measure the width of characters as displayed by the terminal
|
||||
/// emulator instead of guessing the width.
|
||||
///
|
||||
/// Enabling this makes rendering a bit slower but more accurate. The screen
|
||||
/// might also flash when encountering new characters (or, more accurately,
|
||||
/// graphemes).
|
||||
///
|
||||
/// See also the `--measure-graphemes` command line option.
|
||||
#[serde(default)]
|
||||
#[document(default = "`false`")]
|
||||
pub measure_widths: bool,
|
||||
|
||||
/// Whether to start in offline mode.
|
||||
///
|
||||
/// In offline mode, cove won't automatically join rooms marked via the
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ fn update_config_with_args(config: &mut Config, args: &Args) {
|
|||
}
|
||||
|
||||
config.ephemeral |= args.ephemeral;
|
||||
config.measure_widths |= args.measure_widths;
|
||||
config.offline |= args.offline;
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +151,7 @@ async fn main() -> anyhow::Result<()> {
|
|||
let config = Box::leak(Box::new(config));
|
||||
|
||||
match args.command.unwrap_or_default() {
|
||||
Command::Run => run(logger, logger_rx, config, &dirs, args.measure_widths).await?,
|
||||
Command::Run => run(logger, logger_rx, config, &dirs).await?,
|
||||
Command::Export(args) => export(config, &dirs, args).await?,
|
||||
Command::Gc => gc(config, &dirs).await?,
|
||||
Command::ClearCookies => clear_cookies(config, &dirs).await?,
|
||||
|
|
@ -171,7 +172,6 @@ async fn run(
|
|||
logger_rx: mpsc::UnboundedReceiver<()>,
|
||||
config: &'static Config,
|
||||
dirs: &ProjectDirs,
|
||||
measure_widths: bool,
|
||||
) -> anyhow::Result<()> {
|
||||
info!(
|
||||
"Welcome to {} {}",
|
||||
|
|
@ -182,7 +182,7 @@ async fn run(
|
|||
let vault = open_vault(config, dirs)?;
|
||||
|
||||
let mut terminal = Terminal::new()?;
|
||||
terminal.set_measuring(measure_widths);
|
||||
terminal.set_measuring(config.measure_widths);
|
||||
Ui::run(config, &mut terminal, vault.clone(), logger, logger_rx).await?;
|
||||
drop(terminal);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue