feat: switch text to UTF-8; add Unicode key events, dead keys & Czech layout; fix numpad navigation; add NumLock support
This commit is contained in:
1 parent
32660ddd1a
commit
2aa6360b3d
101 files changed
+3733
-1639
No files matched your search
@@ -261,15 +261,16 @@ void fit_text_start(const char* src, char* out, int out_len, int max_px) {
|
||||
// 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;
|
||||
int slen = montauk::slen(src);
|
||||
int keep = slen;
|
||||
if (keep > out_len - 3) keep = montauk::utf8::floor_boundary(src, slen, 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--;
|
||||
keep = montauk::utf8::prev_boundary(src, keep);
|
||||
}
|
||||
|
||||
safe_copy(out, out_len, "..");
|
||||
@@ -1216,14 +1217,14 @@ void handle_file_key(const montauk::abi::KeyEvent& key) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.scancode == 0x4B || key.scancode == 0x48) {
|
||||
if (montauk::nav_scancode(key) == 0x4B || montauk::nav_scancode(key) == 0x48) {
|
||||
if (st->selected > 0) st->selected--;
|
||||
else if (st->entry_count > 0) st->selected = 0;
|
||||
file_ensure_selected_visible(st);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key.scancode == 0x4D || key.scancode == 0x50) {
|
||||
if (montauk::nav_scancode(key) == 0x4D || montauk::nav_scancode(key) == 0x50) {
|
||||
if (st->selected < st->entry_count - 1) st->selected++;
|
||||
else if (st->entry_count > 0) st->selected = st->entry_count - 1;
|
||||
file_ensure_selected_visible(st);
|
||||
|
||||
Reference in new issue
Block a user