Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions for event handling.

Functionsยง

byte_index_for_char
What: Convert a character index to a byte index for slicing.
char_count
What: Return the number of Unicode scalar values (characters) in the input.
compute_updates_filtered_indices
What: Compute visible updates indices for a slash-filter query.
compute_updates_modal_scroll_for_selection
What: Compute updates-modal scroll offset that keeps the selected entry visible.
find_in_install
What: Advance selection in the Install pane to the next/previous item matching the pane-find pattern.
find_in_recent
What: Advance selection in the Recent pane to the next/previous match of the pane-find pattern.
matches_any
What: Check if a key event matches any chord in a list, handling Shift+char edge cases.
maybe_request_news_content
Request news content fetch if not cached or loading. Implements 0.5 second debounce - only requests after user stays on item for 0.5 seconds.
move_news_selection
Move news selection by delta, keeping it in view.
move_sel_cached_with_vote_state
What: Move selection and queue live AUR vote-state check for selected package.
queue_selected_aur_vote_state_check
What: Queue a live AUR vote-state check for the currently selected result.
refresh_downgrade_details
What: Ensure details reflect the selected item in the Downgrade pane.
refresh_install_details
What: Ensure details reflect the selected item in the Install pane.
refresh_remove_details
What: Ensure details reflect the selected item in the Remove pane.
refresh_selected_details
What: Ensure details reflect the currently selected result.
update_news_url
Synchronize details URL and content with currently selected news item. Also triggers content fetching if channel is provided and content is not cached.