diff --git a/src/main.rs b/src/main.rs index b1952b3..51064ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -146,6 +146,7 @@ fn send_message(msg: &KakMessage) -> Result<(), Box> { if let Some(debug_msg_str) = &msg.1 { write!(f, "echo -debug '{}';", debug_msg_str.replace('\'', "''"))?; } + f.flush()?; } Ok(()) } @@ -169,7 +170,8 @@ fn run() -> Result { pub fn kak_exec(cmd: &str) -> Result<(), KakMessage> { let mut f = open_command_fifo()?; - write!(f, "{}", cmd).map_err(Into::into) + write!(f, "{}", cmd)?; + f.flush().map_err(Into::into) } pub fn kak_response(msg: &str) -> Result, KakMessage> { diff --git a/src/math_eval.rs b/src/math_eval.rs index 7d27602..6299f0f 100644 --- a/src/math_eval.rs +++ b/src/math_eval.rs @@ -36,6 +36,7 @@ pub fn math_eval(_options: &Options) -> Result { write!(f, " '{}'", new_selection.as_deref().unwrap_or(""))?; } write!(f, " ; exec R;")?; + f.flush()?; Ok(KakMessage( format!("MathEval {} selections", selections.len()), diff --git a/src/shuf.rs b/src/shuf.rs index 181b2f6..7286546 100644 --- a/src/shuf.rs +++ b/src/shuf.rs @@ -17,6 +17,7 @@ pub fn shuf(_options: &Options) -> Result { write!(f, " '{}'", new_selection)?; } write!(f, " ; exec R;")?; + f.flush()?; Ok(KakMessage( format!("Shuf {} selections", selections.len()), diff --git a/src/sort.rs b/src/sort.rs index ebecbb6..d2db957 100644 --- a/src/sort.rs +++ b/src/sort.rs @@ -190,6 +190,7 @@ pub fn sort(options: &Options) -> Result { write!(f, " '{}'", new_selection)?; } write!(f, " ; exec R;")?; + f.flush()?; Ok(KakMessage( format!("Sorted {} selections", zipped.len()), diff --git a/src/uniq.rs b/src/uniq.rs index c77f5b6..384ad30 100644 --- a/src/uniq.rs +++ b/src/uniq.rs @@ -47,6 +47,7 @@ pub fn uniq(options: &Options) -> Result { write!(f, " '{}'", new_selection)?; } write!(f, " ; exec R;")?; + f.flush()?; Ok(KakMessage( format!("Uniq {} selections", selections.len()),