Feat: WIP terse code documentation

This commit is contained in:
2026-02-26 01:08:16 +01:00
parent 71bd09d5ea
commit e1cf57918e
47 changed files with 499 additions and 24 deletions

View File

@@ -1,3 +1,5 @@
//! Script editor widget with completion, search, and sample finder popups.
use std::cell::Cell;
use crate::theme;
@@ -10,8 +12,10 @@ use ratatui::{
};
use tui_textarea::TextArea;
/// Callback that syntax-highlights a single line, returning styled spans (bool = annotation).
pub type Highlighter<'a> = &'a dyn Fn(usize, &str) -> Vec<(Style, String, bool)>;
/// Metadata for a single autocomplete entry.
#[derive(Clone)]
pub struct CompletionCandidate {
pub name: String,
@@ -78,6 +82,7 @@ impl SearchState {
}
}
/// Multi-line text editor backed by tui_textarea.
pub struct Editor {
text: TextArea<'static>,
completion: CompletionState,
@@ -702,6 +707,7 @@ impl Editor {
}
}
/// Score a fuzzy match of `query` against `target`. Lower is better; `None` if no match.
pub fn fuzzy_match(query: &str, target: &str) -> Option<usize> {
let target_lower: Vec<char> = target.to_lowercase().chars().collect();
let query_lower: Vec<char> = query.to_lowercase().chars().collect();