about summary refs log tree commit diff stats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/yt/src/select/cmds/mod.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/crates/yt/src/select/cmds/mod.rs b/crates/yt/src/select/cmds/mod.rs
index 332010a..1713233 100644
--- a/crates/yt/src/select/cmds/mod.rs
+++ b/crates/yt/src/select/cmds/mod.rs
@@ -9,7 +9,10 @@
 // You should have received a copy of the License along with this program.
 // If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
 
+use std::io::{Write, stderr};
+
 use crate::{
+    ansi_escape_codes,
     app::App,
     cli::{SelectCommand, SharedSelectionCommandArgs},
     storage::db::{
@@ -20,11 +23,12 @@ use crate::{
 
 use anyhow::{Context, Result, bail};
 
-mod add;
+pub(crate) mod add;
 
 pub(crate) async fn handle_select_cmd(
     app: &App,
     cmd: SelectCommand,
+    video: &mut Video,
     line_number: Option<i64>,
     ops: &mut Operations<Operation>,
 ) -> Result<()> {
@@ -87,6 +91,7 @@ async fn handle_status_change(
     shared: SharedSelectionCommandArgs,
     line_number: Option<i64>,
     new_status: VideoStatus,
+    is_single: bool,
     ops: &mut Operations<Operation>,
 ) -> Result<()> {
     let priority = compute_priority(line_number, shared.priority);
@@ -103,6 +108,18 @@ async fn handle_status_change(
         video.set_playback_speed(playback_speed, ops);
     }
 
+    if !is_single {
+        ansi_escape_codes::clear_whole_line();
+        ansi_escape_codes::move_to_col(1);
+    }
+
+    eprint!("{}", &video.to_line_display(app, None).await?);
+
+    if is_single {
+        eprintln!();
+    } else {
+        stderr().flush()?;
+    }
 
     Ok(())
 }