aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-05-27 15:00:51 +0000
committerBlaž Hrastnik2021-05-27 15:00:51 +0000
commit094203c74e19d49b3bfc74cf2ab4f853a773c195 (patch)
tree707927ed1734a504131450a84bdf71d76baf7585 /helix-term/src
parentb114cfa119bc94396f1ed38109a51183035574ed (diff)
Update deps, introduce the new tree-sitter lifetimes
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs4
-rw-r--r--helix-term/src/ui/completion.rs5
-rw-r--r--helix-term/src/ui/editor.rs7
-rw-r--r--helix-term/src/ui/markdown.rs7
-rw-r--r--helix-term/src/ui/prompt.rs2
5 files changed, 19 insertions, 6 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index e5b57263..674f6d23 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -674,6 +674,7 @@ pub fn search(cx: &mut Context) {
cx.push_layer(Box::new(prompt));
}
+// can't search next for ""compose"" for some reason
pub fn _search_next(cx: &mut Context, extend: bool) {
if let Some(query) = register::get('\\') {
@@ -1670,6 +1671,9 @@ pub mod insert {
let head = pos + offs + text.len();
+ // TODO: range replace or extend
+ // range.replace(|range| range.is_empty(), head); -> fn extend if cond true, new head pos
+ // can be used with cx.mode to do replace or extend on most changes
ranges.push(Range::new(
if range.is_empty() {
head
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,
))
}