diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-28 21:46:18 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-28 21:46:18 -0500 |
commit | 9d9993607c9093bd59a02138f5e51f1c678e17e9 (patch) | |
tree | b26210dc32e96409e029488ad62309699919a5bf | |
parent | d00c3247691c2f30214bcfeffb1830d725a173b9 (diff) |
fix find highlighting when cursor is on same line
-rw-r--r-- | buffer.c | 2 | ||||
-rw-r--r-- | find.c | 5 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | ted.cfg | 4 |
4 files changed, 8 insertions, 9 deletions
@@ -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]); @@ -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; @@ -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) { @@ -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 |