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

ensure that all pending writes are flushed on :write and :write-all #10788

Closed

Conversation

lpoirothattermann
Copy link

@lpoirothattermann lpoirothattermann commented May 18, 2024

Fix for #10765

First issue, first time with Rust.

@lpoirothattermann lpoirothattermann changed the title ensure that all pending writes are flushed on :write and :write-all (#10765) ensure that all pending writes are flushed on :write and :write-all May 18, 2024
@pascalkuthe
Copy link
Member

This is not the right way to fix this issue. This flushes all writes when :wa is used. Writes should not be flushed unless we are exiting helix (this potentially freezes the editor).

It also doesnt solve th problem for :w

As described jn that issue writes should be flush in the suspend command bound to c-z

@kirawi kirawi added C-bug Category: This is a bug A-helix-term Area: Helix term improvements S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 18, 2024
@kirawi
Copy link
Member

kirawi commented May 18, 2024

Since the non-typable commands don't use the compositor::Context, you'll need to create a compositor::Context out of the fields in commands::Context to get access to the flush method without needing to reimplement the method on the commands::context. Like so:

let mut cx = compositor::Context {
    editor: cx.editor,
    jobs: cx.jobs,
    scroll: None,
};

You need to modify

fn suspend(_cx: &mut Context) {
#[cfg(not(windows))]
signal_hook::low_level::raise(signal_hook::consts::signal::SIGTSTP).unwrap();
}

@PotatoesFall
Copy link

@kirawi I took your feedback here and made an MR of my own: #10797

@lpoirothattermann lpoirothattermann deleted the bugfix/10765 branch May 20, 2024 18:42
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-bug Category: This is a bug S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants