Function should_render_column

Source
pub fn should_render_column(bindings: &[&Binding]) -> bool
Expand description

Determines if a column of key bindings should be rendered.

A column should be rendered if it contains at least one enabled binding. This helper function matches the behavior of the Go implementation’s shouldRenderColumn function.

§Arguments

  • bindings - A slice of key binding references to check

§Returns

true if any binding in the group is enabled, false otherwise.

§Examples

use bubbletea_widgets::help::should_render_column;
use bubbletea_widgets::key::Binding;
use crossterm::event::KeyCode;

let enabled_binding = Binding::new(vec![KeyCode::Enter]);
let disabled_binding = Binding::new(vec![KeyCode::F(1)]).with_disabled();

let column = vec![&enabled_binding, &disabled_binding];
assert!(should_render_column(&column));

let empty_column = vec![&disabled_binding];
assert!(!should_render_column(&empty_column));