From f2873edf6c00f968c5b2ed77d436506e4576400b Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 25 Jul 2019 14:43:51 +1200 Subject: [PATCH] One more go at fixing scroll textarea in windows --- src/plugins/binaryview.rs | 4 ++++ src/plugins/textview.rs | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/plugins/binaryview.rs b/src/plugins/binaryview.rs index b71a8a88a0..1a78cc03b9 100644 --- a/src/plugins/binaryview.rs +++ b/src/plugins/binaryview.rs @@ -6,6 +6,7 @@ use nu::{ Value, }; use pretty_hex::*; +use std::{thread, time::Duration}; struct BinaryView; @@ -444,6 +445,9 @@ pub fn view_contents_interactive( #[allow(unused)] let screen = RawScreen::disable_raw_mode(); + println!(""); + thread::sleep(Duration::from_millis(50)); + Ok(()) } diff --git a/src/plugins/textview.rs b/src/plugins/textview.rs index f7ee3b2a39..7b2810b2dd 100644 --- a/src/plugins/textview.rs +++ b/src/plugins/textview.rs @@ -87,6 +87,9 @@ fn scroll_view_lines(lines: Vec) { let cursor = cursor(); let _ = cursor.hide(); + let input = crossterm::input(); + let _ = input.read_async(); + let mut size = paint_textview(&lines, starting_row); loop { if rawkey.is_pressed(rawkey::KeyCode::Escape) { @@ -110,7 +113,15 @@ fn scroll_view_lines(lines: Vec) { let _ = cursor.show(); } - thread::sleep(Duration::from_millis(250)); + + let cursor = cursor(); + let _ = cursor.show(); + + #[allow(unused)] + let screen = RawScreen::disable_raw_mode(); + + println!(""); + thread::sleep(Duration::from_millis(50)); } fn scroll_view(s: &str) {