Skip to content

Commit

Permalink
Tweak IME selection background left bound
Browse files Browse the repository at this point in the history
Just extending the selection background left by one pixel so there's
not one pixel of black background to the left of a selection that
starts at the beginning of the text, and so some characters being
selected show up better (particularly where there's a long vertical bar
at the first pixel). We shouldn't be overlapping any part of the
previous character, since every character normally has a pixel of
spacing on the right.
  • Loading branch information
Daaaav authored and InfoTeddy committed Aug 7, 2024
1 parent 9ec8d8b commit 149f5fb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion desktop_version/src/IMERender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ void ime_render(void)
SDL_memcpy(in_sel, sel_start_ptr, in_sel_nbytes);
in_sel[in_sel_nbytes] = '\0';

int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel);
int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel) - 1;
int in_sel_pixels = font::len(PR_FONT_LEVEL, in_sel);
if (in_sel_pixels > 0)
{
in_sel_pixels += 1;
}

SDL_Rect selrect = imebox;
selrect.x += before_sel_pixels + 1;
Expand Down

0 comments on commit 149f5fb

Please sign in to comment.