From 670ae631f52180aba7a5c38817048677ac8ca741 Mon Sep 17 00:00:00 2001 From: Patrick Cleavelin Date: Mon, 15 Jan 2024 19:40:46 -0600 Subject: [PATCH] fixed an off by one issue with the syntax highlighter --- plugins/highlighter/src/plugin.odin | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/highlighter/src/plugin.odin b/plugins/highlighter/src/plugin.odin index 71f5451..1b50204 100644 --- a/plugins/highlighter/src/plugin.odin +++ b/plugins/highlighter/src/plugin.odin @@ -334,15 +334,16 @@ color_buffer_odin :: proc "c" (plugin: Plugin, buffer: rawptr) { if is_odin_keyword(plugin, start_it, it) { plugin.buffer.color_char_at(it.buffer, start_it.cursor, it.cursor, 13); + + iterate_buffer(plugin.iter, &it); } else if character, _, cond := iterate_buffer_peek(plugin, &it); cond { if character == '(' { plugin.buffer.color_char_at(it.buffer, start_it.cursor, it.cursor, 11); + iterate_buffer(plugin.iter, &it); } } else { break; } - - iterate_buffer(plugin.iter, &it); } } } @@ -404,15 +405,16 @@ color_buffer_rust :: proc "c" (plugin: Plugin, buffer: rawptr) { if is_rust_keyword(plugin, start_it, it) { plugin.buffer.color_char_at(it.buffer, start_it.cursor, it.cursor, 13); + + iterate_buffer(plugin.iter, &it); } else if character, _, cond := iterate_buffer_peek(plugin, &it); cond { - if character == '(' || character == '<' { + if character == '(' || character == '<' || character == '!' { plugin.buffer.color_char_at(it.buffer, start_it.cursor, it.cursor, 11); + iterate_buffer(plugin.iter, &it); } } else { break; } - - iterate_buffer(plugin.iter, &it); } } }