From 5c355468c1c0ef6561348591bb755ff67b561c30 Mon Sep 17 00:00:00 2001 From: mo8it Date: Mon, 26 Aug 2024 00:49:56 +0200 Subject: [PATCH] File link in the list? No problem :D --- src/list/state.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/list/state.rs b/src/list/state.rs index eeda110..c1c75d7 100644 --- a/src/list/state.rs +++ b/src/list/state.rs @@ -10,7 +10,12 @@ use std::{ io::{self, StdoutLock, Write}, }; -use crate::{app_state::AppState, exercise::Exercise, term::progress_bar, MAX_EXERCISE_NAME_LEN}; +use crate::{ + app_state::AppState, + exercise::Exercise, + term::{progress_bar, terminal_file_link}, + MAX_EXERCISE_NAME_LEN, +}; const MAX_SCROLL_PADDING: usize = 5; // +1 for column padding. @@ -190,7 +195,7 @@ impl<'a> ListState<'a> { stdout.write_all(exercise.name.as_bytes())?; stdout.write_all(&SPACE[..self.name_col_width + 2 - exercise.name.len()])?; - stdout.write_all(exercise.path.as_bytes())?; + terminal_file_link(stdout, exercise.path, Color::Blue)?; next_ln_overwrite(stdout)?; stdout.queue(ResetColor)?;