aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/by-name/lf/lf-make-map/src/mapping/interactive.rs20
1 files changed, 9 insertions, 11 deletions
diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/interactive.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/interactive.rs
index 31324e1d..b8ac27d2 100644
--- a/pkgs/by-name/lf/lf-make-map/src/mapping/interactive.rs
+++ b/pkgs/by-name/lf/lf-make-map/src/mapping/interactive.rs
@@ -8,7 +8,7 @@
// 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::stdout, path::PathBuf};
+use std::{io::stderr, path::PathBuf};
use anyhow::Result;
use crossterm::{
@@ -35,7 +35,7 @@ impl MappingsTrie {
pub fn interactive_start(&self, home_path: PathBuf) -> Result<()> {
terminal::enable_raw_mode()?;
execute!(
- stdout(),
+ stderr(),
EnterAlternateScreen,
PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES),
MoveToRow(0)
@@ -43,7 +43,7 @@ impl MappingsTrie {
let output = self.interactive_start_inner(home_path);
- execute!(stdout(), LeaveAlternateScreen, PopKeyboardEnhancementFlags)?;
+ execute!(stderr(), LeaveAlternateScreen, PopKeyboardEnhancementFlags)?;
terminal::disable_raw_mode()?;
match output? {
@@ -59,18 +59,16 @@ impl MappingsTrie {
fn interactive_start_inner(&self, home_path: PathBuf) -> Result<Status> {
macro_rules! done {
($state:ident, $last_length:ident) => {{
- let value = self
- .0
- .get(&$state)
- .expect("Is some")
- .value()
- .expect("is some");
+ let value = match self.0.get(&$state).expect("Is some").value() {
+ Some(value) => value,
+ None => return Ok(Status::Stop),
+ };
let path = home_path.join(&value.path);
terminal::disable_raw_mode()?;
execute!(
- stdout(),
+ stderr(),
MoveUp($last_length as u16),
Clear(ClearType::FromCursorDown),
Print(format!("{}\n", path.display()))
@@ -101,7 +99,7 @@ impl MappingsTrie {
terminal::disable_raw_mode()?;
let string = trie.to_string();
execute!(
- stdout(),
+ stderr(),
MoveUp(last_length as u16),
Clear(ClearType::FromCursorDown),
Print(format!(