Skip to content

Commit 149f5fb

Browse files
DaaaavInfoTeddy
authored andcommitted
Tweak IME selection background left bound
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.
1 parent 9ec8d8b commit 149f5fb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

desktop_version/src/IMERender.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ void ime_render(void)
6767
SDL_memcpy(in_sel, sel_start_ptr, in_sel_nbytes);
6868
in_sel[in_sel_nbytes] = '\0';
6969

70-
int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel);
70+
int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel) - 1;
7171
int in_sel_pixels = font::len(PR_FONT_LEVEL, in_sel);
72+
if (in_sel_pixels > 0)
73+
{
74+
in_sel_pixels += 1;
75+
}
7276

7377
SDL_Rect selrect = imebox;
7478
selrect.x += before_sel_pixels + 1;

0 commit comments

Comments
 (0)