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.
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.
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.