From 0fa1ae215ac1434591968818f8f75ad5b35d52ec Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 4 Mar 2023 09:02:57 +0800 Subject: feat: support highlight reply markdown (#3) * feat: support highlight reply markdown * migrate markdown highlighter from termimad to mdcat * optimize render No need to clear screen when there is no newline in reply token * handle ctrl-c when rendering stream * update readme * fix ctrlc don't abort acquire_stream when establish connection * ensure render_stream's dtect_ctrlc is exit before next readline This will make reedline don't throw err 'The cursor position could not be read within a normal duration' --- src/config.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index c3ebf3c..cce6b6a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -24,6 +24,9 @@ pub struct Config { /// Whether to persistently save chat messages #[serde(default)] pub save: bool, + /// Whether to highlight reply message + #[serde(default)] + pub highlight: bool, /// Set proxy pub proxy: Option, /// Used only for debugging @@ -172,6 +175,14 @@ fn create_config_file(config_path: &Path) -> Result<()> { raw_config.push_str("save: true\n"); } + let ans = Confirm::new("Whether to highlight reply message?") + .with_default(true) + .prompt() + .map_err(confirm_map_err)?; + if ans { + raw_config.push_str("highlight: true\n"); + } + std::fs::write(config_path, raw_config) .map_err(|err| anyhow!("Failed to write to config file, {err}"))?; Ok(()) -- cgit v1.2.3