From 9d9993607c9093bd59a02138f5e51f1c678e17e9 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sun, 28 Feb 2021 21:46:18 -0500 Subject: fix find highlighting when cursor is on same line --- buffer.c | 2 +- find.c | 5 +++-- main.c | 6 ++---- ted.cfg | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/buffer.c b/buffer.c index 54931ce..a3d9c51 100644 --- a/buffer.c +++ b/buffer.c @@ -2167,7 +2167,7 @@ void buffer_render(TextBuffer *buffer, Rect r) { // the rectangle that the cursor is rendered as Rect cursor_rect = rect(cursor_display_pos, V2(settings->cursor_width, char_height)); - { // highlight line cursor is on + if (!buffer->is_line_buffer) { // highlight line cursor is on Rect hl_rect = rect(V2(x1, cursor_display_pos.y), V2(x2-x1-1, char_height)); buffer_clip_rect(buffer, &hl_rect); gl_geometry_rect(hl_rect, colors[COLOR_CURSOR_LINE_BG]); diff --git a/find.c b/find.c index 7694a15..58bff8c 100644 --- a/find.c +++ b/find.c @@ -309,7 +309,7 @@ static void find_replace_all(Ted *ted) { } } -static void find_menu_frame(Ted *ted, float x1, float y1, float x2, float y2) { +static void find_menu_frame(Ted *ted, Rect menu_bounds) { Font *font = ted->font, *font_bold = ted->font_bold; float const char_height = text_font_char_height(font), char_height_bold = text_font_char_height(font_bold); @@ -326,7 +326,8 @@ static void find_menu_frame(Ted *ted, float x1, float y1, float x2, float y2) { u32 last_rendered_line = buffer_last_rendered_line(buffer); - Rect menu_bounds = rect4(x1, y1, x2, y2); + float x1, y1, x2, y2; + rect_coords(menu_bounds, &x1, &y1, &x2, &y2); x1 += padding; y1 += padding; diff --git a/main.c b/main.c index d954128..1f70602 100644 --- a/main.c +++ b/main.c @@ -1,8 +1,6 @@ // @TODO: -// - refresh find results by pressing Enter in find/replace buffer - -// - Windows installation // - on crash, output backtrace to log +// - Windows installation // - restore previously opened files (setting: restore-session) // - completion @@ -649,7 +647,7 @@ int main(int argc, char **argv) { if (ted->find) { float y2 = y; y -= find_menu_height(ted); - find_menu_frame(ted, x1, y, x2, y2); + find_menu_frame(ted, rect4(x1, y, x2, y2)); y -= padding; } if (ted->build_shown) { diff --git a/ted.cfg b/ted.cfg index 070a419..aed1794 100644 --- a/ted.cfg +++ b/ted.cfg @@ -134,7 +134,7 @@ border = #a77 active-tab-hl = #a77a # this color is used for tabs which are selected, but not active (because you are on the other side of a split, perhaps) selected-tab-hl = #7777 -cursor-line-bg = #222 +cursor-line-bg = #fff2 cursor = #3ff # color to highlight matching brackets with matching-bracket-hl = #fda8 @@ -161,7 +161,7 @@ error-border = #f00 error-bg = #800 error-text = #fdd # color to highlight search results with -find-hl = #fff3 +find-hl = #fff4 yes = #afa no = #faa cancel = #ffa -- cgit v1.2.3