diff options
author | Blaž Hrastnik | 2021-05-27 15:00:51 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-05-27 15:00:51 +0000 |
commit | 094203c74e19d49b3bfc74cf2ab4f853a773c195 (patch) | |
tree | 707927ed1734a504131450a84bdf71d76baf7585 /helix-term/src/ui | |
parent | b114cfa119bc94396f1ed38109a51183035574ed (diff) |
Update deps, introduce the new tree-sitter lifetimes
Diffstat (limited to 'helix-term/src/ui')
-rw-r--r-- | helix-term/src/ui/completion.rs | 5 | ||||
-rw-r--r-- | helix-term/src/ui/editor.rs | 7 | ||||
-rw-r--r-- | helix-term/src/ui/markdown.rs | 7 | ||||
-rw-r--r-- | helix-term/src/ui/prompt.rs | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/helix-term/src/ui/completion.rs b/helix-term/src/ui/completion.rs index f79c2235..0af03d14 100644 --- a/helix-term/src/ui/completion.rs +++ b/helix-term/src/ui/completion.rs @@ -19,10 +19,7 @@ use lsp::CompletionItem; impl menu::Item for CompletionItem { fn filter_text(&self) -> &str { - self.filter_text - .as_ref() - .unwrap_or_else(|| &self.label) - .as_str() + self.filter_text.as_ref().unwrap_or(&self.label).as_str() } fn label(&self) -> &str { diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 6d792838..c597f840 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -148,6 +148,13 @@ impl EditorView { // TODO: scope matching: biggest union match? [string] & [html, string], [string, html] & [ string, html] // can do this by sorting our theme matches based on array len (longest first) then stopping at the // first rule that matches (rule.all(|scope| scopes.contains(scope))) + // log::info!( + // "scopes: {:?}", + // spans + // .iter() + // .map(|span| theme.scopes()[span.0].as_str()) + // .collect::<Vec<_>>() + // ); let style = match spans.first() { Some(span) => theme.get(theme.scopes()[span.0].as_str()), None => theme.get("ui.text"), diff --git a/helix-term/src/ui/markdown.rs b/helix-term/src/ui/markdown.rs index 8d14841e..daac173d 100644 --- a/helix-term/src/ui/markdown.rs +++ b/helix-term/src/ui/markdown.rs @@ -107,6 +107,8 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> { None => text_style, }; + // TODO: replace tabs with indentation + let mut slice = &text[start..end]; while let Some(end) = slice.find('\n') { // emit span up to newline @@ -153,6 +155,7 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> { } } Event::Code(text) | Event::Html(text) => { + log::warn!("code {:?}", text); let mut span = to_span(text); span.style = code_style; spans.push(span); @@ -167,7 +170,9 @@ fn parse<'a>(contents: &'a str, theme: Option<&Theme>) -> tui::text::Text<'a> { lines.push(Spans::default()); } // TaskListMarker(bool) true if checked - _ => (), + _ => { + log::warn!("unhandled markdown event {:?}", event); + } } // build up a vec of Paragraph tui widgets } diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 9bde1f57..dbbef72c 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -272,7 +272,7 @@ impl Component for Prompt { fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> { Some(Position::new( - area.height as usize, + area.y as usize, area.x as usize + self.prompt.len() + self.cursor, )) } |