AMythicDev / minus

An asynchronous, runtime data feedable terminal paging library for Rust
https://crates.io/crates/minus/
Apache License 2.0
317 stars 23 forks source link

Flashing when mouse moving #120

Closed EiEddie closed 9 months ago

EiEddie commented 9 months ago

Describe the bug when I move my mouse on the terminal, pager is flashing.

To Reproduce code as follows:

use std::fmt::Write;
use minus::{self, Pager};

fn main() -> Result<(), minus::MinusError> {
    let mut out = Pager::new();

    write!(out, "{}\n", "hello world ".repeat(1000))?;

    minus::page_all(out)?;

    Ok(())
}

and config on Cargo.toml is:

minus = { version = "5.5.1", default-features = false, features = [
    "static_output",
] }

run cargo run and move the mouse on terminal.

Expected behavior it should not be flashing

Screenshots minus

Desktop:

Something else I feel like I'm going blind...

AMythicDev commented 9 months ago

Can you reproduce it on the latest main because I can't reproduce it on it. EDIT: I also can't reproduce it on version 5.5.1. I am using Fedora 39 with Alacritty terminal.

EiEddie commented 9 months ago

YES!

first, I do:

cargo new test-minus
cd test-minus
cargo add minus --features static_output

and this is my test:

// src/main.rs
use std::fmt::Write;
use minus::{self, Pager};

fn main() -> Result<(), minus::MinusError> {
        let mut out = Pager::new();

        write!(out, "{}\n", "hello world ".repeat(1000))?;

        minus::page_all(out)?;

        Ok(())
}
# Cargo.toml

[package]
name = "test-minus"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
minus = { version = "5.5.1", features = ["static_output"] }

and result have the same wrong, the pager is flushing.

then, I do

git clone https://github.com/arijit79/minus.git
cd minus
cargo r --example static --features="static_output"

and unluckily, same wrong minus

AMythicDev commented 9 months ago

I guess you have to help me out a bit here cuz I don't have a Windows PC at hand. I am making a PR and you have to pull it and test it with some testing code. I hope it's not much of an inconvenience.

EiEddie commented 9 months ago

I'm glad to help✌️