-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Limit the amount of horizontal splits you can do #4642
base: master
Are you sure you want to change the base?
Conversation
…a height of 1, and will revert the split if they find such a view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we will also need this check in split
and hsplit_new
helix/helix-term/src/commands.rs
Lines 4242 to 4265 in a19eee6
// split helper, clear it later | |
fn split(cx: &mut Context, action: Action) { | |
let (view, doc) = current!(cx.editor); | |
let id = doc.id(); | |
let selection = doc.selection(view.id).clone(); | |
let offset = view.offset; | |
cx.editor.switch(id, action); | |
// match the selection in the previous view | |
let (view, doc) = current!(cx.editor); | |
doc.set_selection(view.id, selection); | |
// match the view scroll offset (switch doesn't handle this fully | |
// since the selection is only matched after the split) | |
view.offset = offset; | |
} | |
fn hsplit(cx: &mut Context) { | |
split(cx, Action::HorizontalSplit); | |
} | |
fn hsplit_new(cx: &mut Context) { | |
cx.editor.new_file(Action::HorizontalSplit); | |
} |
<C-w><C-s>
)
I didn't include the check in |
…ld of the focused view
Hello,
this PR would address #1084 by setting a limit to the number of horizontal splits you can do.
If there exists a view with a height of 1 (only the status bar is drawn) after hsplit is run, then the newly created view is closed
and we refocus the previous view.