diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-13 15:47:30 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-13 15:47:30 -0500 |
commit | e9357bfd982b37672ed9c319956af32bf3db7856 (patch) | |
tree | ebc8d3d514725b9402f8316f92aafe2fe14fb22c /node.c | |
parent | cdca3cc10dceda9580b2d87c2105c0654aa084fc (diff) |
view-only mode
Diffstat (limited to 'node.c')
-rw-r--r-- | node.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -135,21 +135,28 @@ static void node_frame(Ted *ted, Node *node, Rect r) { // tab border gl_geometry_rect_border(tab_rect, border_thickness, colors[COLOR_BORDER]); - if (i == node->active_tab) { - // highlight active tab - gl_geometry_rect(tab_rect, colors[is_active ? COLOR_ACTIVE_TAB_HL : COLOR_HL]); - } // tab title { - char const *surround = buffer_unsaved_changes(buffer) ? "*" : ""; - strbuf_printf(tab_title, "%s%s%s", surround, filename, surround); + if (buffer_unsaved_changes(buffer)) + strbuf_printf(tab_title, "*%s*", filename); + else if (buffer->view_only) + strbuf_printf(tab_title, "VIEW %s", filename); + else + strbuf_printf(tab_title, "%s", filename); } text_state.max_x = rect_x2(tab_rect); rgba_u32_to_floats(colors[COLOR_TEXT], text_state.color); text_state.x = tab_rect.pos.x; text_state.y = tab_rect.pos.y; text_utf8_with_state(font, &text_state, tab_title); + + if (i == node->active_tab) { + // highlight active tab + gl_geometry_rect(tab_rect, colors[is_active ? COLOR_ACTIVE_TAB_HL : COLOR_HL]); + // set window title to active tab's title + strbuf_printf(ted->window_title, "ted %s", tab_title); + } } gl_geometry_draw(); |