diff options
author | pommicket <pommicket@gmail.com> | 2023-09-07 22:14:59 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2023-09-07 22:50:12 -0400 |
commit | 5100257c186d52ffb61fe26e302ec7205f291599 (patch) | |
tree | 9baa768319798c30fd7639061bab303def06d413 | |
parent | b8be8dd9239f1b08cb578539e634de73751fbad8 (diff) |
fix issue where selector detail is cut off
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | node.c | 2 | ||||
-rw-r--r-- | ted.cfg | 2 | ||||
-rw-r--r-- | text.c | 18 | ||||
-rw-r--r-- | ui.c | 6 |
5 files changed, 14 insertions, 15 deletions
@@ -1,6 +1,5 @@ /* TODO: -- LSP diagnostics - gdscript syntax highlighting FUTURE FEATURES: - autodetect indentation (tabs vs spaces) @@ -404,7 +404,7 @@ void node_frame(Ted *ted, Node *node, Rect r) { float title_xpos = tab_rect.pos.x; if (title_width > tab_rect.size.x) { // full tab title doesn't fit in tab -- only show the right end of it - title_xpos = tab_rect.pos.x + tab_rect.size.x - title_width; + title_xpos = floorf(tab_rect.pos.x + tab_rect.size.x - title_width); } text_state.min_x = rect_x1(tab_rect); text_state.max_x = rect_x2(tab_rect); @@ -81,6 +81,8 @@ highlight-enabled = yes highlight-key = F2 # don't require F2 key for highlighting highlight-auto = no +# whether or not to show LSP diagnostics (warnings and errors) +show-diagnostics = yes # maximum editable file size. # ted will set the buffer to view-only if a file larger than this is loaded. # NOTE: ted is not really meant for absolutely massive files. @@ -436,20 +436,20 @@ top:; s0 = (min_x-x0) / (x1-x0) * (s1-s0) + s0; x0 = min_x; } - if (x1 >= max_x) { + if (x1 > max_x) { // right side of character is clipped - s1 = (max_x-1-x0) / (x1-x0) * (s1-s0) + s0; - x1 = max_x-1; + s1 = (max_x-x0) / (x1-x0) * (s1-s0) + s0; + x1 = max_x; } if (y0 < min_y) { // top side of character is clipped t0 = (min_y-y0) / (y1-y0) * (t1-t0) + t0; y0 = min_y; } - if (y1 >= max_y) { + if (y1 > max_y) { // bottom side of character is clipped - t1 = (max_y-1-y0) / (y1-y0) * (t1-t0) + t0; - y1 = max_y-1; + t1 = (max_y-y0) / (y1-y0) * (t1-t0) + t0; + y1 = max_y; } if (state->render) { float r = state->color[0], g = state->color[1], b = state->color[2], a = state->color[3]; @@ -463,10 +463,8 @@ top:; arr_add(font->textures[info.texture].triangles, triangle2); } ret: - if (state->x > state->x_largest) - state->x_largest = state->x; - if (state->y > state->y_largest) - state->y_largest = state->y; + state->x_largest = maxd(state->x, state->x_largest); + state->y_largest = maxd(state->y, state->y_largest); state->prev_glyph = info.glyph_index; } @@ -310,7 +310,6 @@ void selector_render(Ted *ted, Selector *s) { text_state.max_x = x2; text_state.min_y = selector_entries_start_y(ted, s); text_state.max_y = y2; - text_state.render = true; // render entries themselves u32 i_display = 0; @@ -336,11 +335,12 @@ void selector_render(Ted *ted, Selector *s) { if (entry->detail) { // draw detail - float detail_size = text_get_size_vec2(font, entry->detail).x; + const float detail_size = text_get_size_vec2(font, entry->detail).x; TextRenderState detail_state = text_state; - detail_state.x = maxd(text_state.x + 2 * padding, x2 - detail_size); + detail_state.x = floor(maxd(text_state.x + 2 * padding, detail_state.max_x - detail_size)); settings_color_floats(settings, COLOR_COMMENT, detail_state.color); + text_state_break_kerning(&detail_state); text_utf8_with_state(font, &detail_state, entry->detail); } } |