Skip to content

feature: allow to close document from buffer picker#15278

Open
yo-main wants to merge 1 commit intohelix-editor:masterfrom
yo-main:feature/close-from-buffer-picker
Open

feature: allow to close document from buffer picker#15278
yo-main wants to merge 1 commit intohelix-editor:masterfrom
yo-main:feature/close-from-buffer-picker

Conversation

@yo-main
Copy link
Contributor

@yo-main yo-main commented Feb 8, 2026

here

Allow to close an opened buffer using the DEL key while inside the buffer picker.

This is something that I have been missing: it's a bit annoying to open and manually close each buffer I want to close from the buffer picker.

There's probably a better way to implement this. Happy to get some directions if that is the case.

@yo-main yo-main force-pushed the feature/close-from-buffer-picker branch 3 times, most recently from 23d9104 to 036f217 Compare February 8, 2026 20:49
Comment on lines 3246 to 3247
CloseError::BufferModified(s) => format!("Could not close modified buffer: {}", s),
_ => "Could not close buffer".to_owned(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CloseError::SaveError contains an anyhow::Error with potentially useful information that gets discarded.

Suggested change
CloseError::BufferModified(s) => format!("Could not close modified buffer: {}", s),
_ => "Could not close buffer".to_owned(),
CloseError::BufferModified(s) => format!("Could not close modified buffer: {}", s),
CloseError::SaveError(e) => format!("Could not close buffer: {}", e),
CloseError::DoesNotExist => "Buffer does not exist".to_owned(),

here.gif Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be included in the worktree, you should be able to upload to github directly on the PR itself as a file attached to a comment.

ctrl!('t') => {
self.toggle_preview();
}
key!(Delete) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On some keyboards (Mac for instance), there's typically only a Backspace key. Consider also binding something more portable, I don't really know what's the standard in the rest of the codebase (I can see ctrl!('d') in some places but not sure what's the "standard").

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set an alternative with alt('d') as ctrl!('d') is already in the picker

Copy link
Contributor

@Aaalibaba42 Aaalibaba42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add a few integration tests, I've found commands/write.rs:131-160 and splits.rs:6-70 that you could take inspiration from to make your own integration test.

The feature seems to be working well though, it's useful and I think reasonable to add to core instead of a plugin.

(I'm just a contributor trying to help review things as they come in to make it easier for maintainers when they get here, don't take my word authoritatively)

@yo-main yo-main force-pushed the feature/close-from-buffer-picker branch from 036f217 to a473e02 Compare February 11, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants