Skip to content
Myr

render: don't render placeholder text as password characters

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent a4659d7 · Browse files · 1 file+8 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−7 removed

  • other:+8 added−7 removed

1 file+8 added−7 removed

modified:render.c+8 added-7 removed
344 unmodified lines
345 size_t prompt_len = c32len(pprompt);346347 const char32_t *ptext = prompt_text(prompt);348 size_t text_len = c32len(ptext);349 bool use_placholder = text_len == 0;349 bool use_placeholder = text_len == 0;350351 if (use_placholder) {351 if (use_placeholder) {352 ptext = prompt_placeholder(prompt);353 text_len = c32len(ptext);354 }355
47 unmodified lines
403404 for (size_t i = 0; i < prompt_len + text_len; i++) {405 if (i >= prompt_len &&406 conf->password_mode.enabled &&407 conf->password_mode.character == U'\0')407 conf->password_mode.character == U'\0' &&408 !use_placeholder)409 {410 continue;411 }412413 char32_t wc = i < prompt_len414 ? pprompt[i]414 : (conf->password_mode.enabled415 ? conf->password_mode.character416 : ptext[i - prompt_len]);415 : (conf->password_mode.enabled && !use_placeholder416 ? conf->password_mode.character417 : ptext[i - prompt_len]);418419 const struct fcft_glyph *glyph = fcft_rasterize_char_utf32(420 font, wc, subpixel);421
11 unmodified lines
433 return;434435 render_glyph(436 buf->pix[0], glyph, x, y,436 use_placholder437 use_placeholder438 ? &render->pix_placeholder_color439 : &render->pix_input_color);440 x += glyph->advance.x;441 if (i >= prompt_len)
850 unmodified lines