diff --git a/kernel/src/Api/BuildNo.hpp b/kernel/src/Api/BuildNo.hpp index 58062e8..7c8d3b1 100644 --- a/kernel/src/Api/BuildNo.hpp +++ b/kernel/src/Api/BuildNo.hpp @@ -12,4 +12,4 @@ #pragma once -#define MONTAUK_BUILD_NUMBER 116 +#define MONTAUK_BUILD_NUMBER 119 diff --git a/programs/src/dialogs/filedialog.cpp b/programs/src/dialogs/filedialog.cpp index 82ae14b..7e489c8 100644 --- a/programs/src/dialogs/filedialog.cpp +++ b/programs/src/dialogs/filedialog.cpp @@ -248,6 +248,33 @@ void fit_text_end(const char* src, char* out, int out_len, int max_px) { safe_copy(out, out_len, src); } +void fit_text_start(const char* src, char* out, int out_len, int max_px) { + if (!src || !src[0] || out_len <= 0) { + if (out_len > 0) out[0] = '\0'; + return; + } + if (text_width(src) <= max_px) { + safe_copy(out, out_len, src); + return; + } + + // Grid labels must fit their cell in pixels. Character-count truncation is + // insufficient for the proportional system font and lets wide names paint + // over the adjacent label. + int keep = montauk::slen(src); + if (keep > out_len - 3) keep = out_len - 3; + while (keep > 0) { + for (int i = 0; i < keep; i++) out[i] = src[i]; + out[keep] = '.'; + out[keep + 1] = '.'; + out[keep + 2] = '\0'; + if (text_width(out) <= max_px) return; + keep--; + } + + safe_copy(out, out_len, ".."); +} + // Path bar: the original plain white/square input look, but rendering the MTK // text-input state so selection highlighting (and the right-click menu, drawn // separately) keep working. @@ -864,18 +891,10 @@ void draw_grid_entries(Canvas& c, FileDialogState* st, const FileDialogLayout& l else if (st->is_dir[i] && st->icons.icon_folder_lg.pixels) icon = &st->icons.icon_folder_lg; if (icon->pixels) c.icon(icon_x, icon_y, *icon); - char label[16]; - int nlen = montauk::slen(st->entry_names[i]); - if (nlen > 11) { - for (int k = 0; k < 9; k++) label[k] = st->entry_names[i][k]; - label[9] = '.'; - label[10] = '.'; - label[11] = '\0'; - } else { - safe_copy(label, sizeof(label), st->entry_names[i]); - } + char label[64]; + fit_text_start(st->entry_names[i], label, sizeof(label), GRID_CELL_W - 4); int tx = cell_x + (GRID_CELL_W - text_width(label)) / 2; - if (tx < cell_x) tx = cell_x; + if (tx < cell_x + 2) tx = cell_x + 2; int ty = icon_y + GRID_ICON + 2; if (ty >= lo.content_rect.y && ty + system_font_height() <= lo.content_rect.y + lo.content_rect.h) c.text(tx, ty, label, colors::TEXT_COLOR); diff --git a/programs/src/keyboard/main.cpp b/programs/src/keyboard/main.cpp index d96440b..98c5128 100644 --- a/programs/src/keyboard/main.cpp +++ b/programs/src/keyboard/main.cpp @@ -145,9 +145,6 @@ static void draw_layouts_tab(Canvas& c, const mtk::Theme& theme) { g_win.width - PAD * 2, theme); c.text(PAD, list_header_y(), "AVAILABLE LAYOUTS", theme.text_muted); - const char* hint = "Click a layout to make it active"; - c.text(g_win.width - PAD - text_width(hint), list_header_y(), - hint, theme.text_muted); for (int i = 0; i < g_state.registry.count; i++) { Rect row = row_rect(i);