Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to refresh/reset/redraw/repaint the screen? #4350

Closed
sudormrfbin opened this issue Oct 18, 2022 Discussed in #4349 · 4 comments · Fixed by #4354
Closed

How to refresh/reset/redraw/repaint the screen? #4350

sudormrfbin opened this issue Oct 18, 2022 Discussed in #4349 · 4 comments · Fixed by #4354
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@sudormrfbin
Copy link
Member

Discussed in #4349

Originally posted by GlassGruber October 18, 2022
I'm not really sure what is the correct term, so I've listed some that came to mind regarding this minor display issue.

I'm a new user and testing things around I've faced some glitches like characters of previous lines not cleared when moving cursor while testing different color themes.
I think however that this is more related to my terminal rather than an hx direct issue.

So I thought something like using shortcut ctrl+L could "refresh" current screen and remove all displayed inconsistencies, but nothing happened and looking for commands like :redraw :clear came up to nothing (BTW the fuzzy cmd : search is very smooth and the tooltip tui pretty nice, hat to you!🎩)

I've checked the keymap docs page but haven't found anything about this.

Hope it's not a RTFM case, thank you!

@sudormrfbin sudormrfbin added C-enhancement Category: Improvements A-helix-term Area: Helix term improvements labels Oct 18, 2022
@sudormrfbin
Copy link
Member Author

There's a clear function that is defined on Compositor.terminal:

pub fn clear(&mut self) -> io::Result<()> {
self.backend.clear()?;
// Reset the back buffer to make sure the next update will redraw everything.
self.buffers[1 - self.current].reset();
Ok(())
}

It should be possible to add a redraw command/keybind that calls this method by adding a Job, something like this:

fn redraw(cx: &mut Context) {
    let callback = Box::pin(async move {
        let call: job::Callback = Box::new(|_editor, compositor| {
            // expose a wrapper `clear` method that calls
            // compositor.terminal.clear()
            compositor.clear(); 
        });
        Ok(call)
    });
    cx.jobs.callback(callback);
}

@sudormrfbin sudormrfbin added E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR E-easy Call for participation: Experience needed to fix: Easy / not much labels Oct 18, 2022
@Omnikar
Copy link
Contributor

Omnikar commented Oct 18, 2022

Doesn't previewing a theme using :theme rerender the whole screen?

@jrvidal
Copy link
Contributor

jrvidal commented Dec 17, 2022

Looking through the new architecture, it's not totally obvious to me how to approach this. What about a needs_clear flag in Compositor that we can set on a command, and that instructs Application::render to clear the terminal screen?

@gabydd
Copy link
Member

gabydd commented Oct 30, 2023

closed by #6949

@gabydd gabydd closed this as completed Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-easy Call for participation: Experience needed to fix: Easy / not much E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants