Skip to content

Commit

Permalink
improve the glyph-wide-support patch
Browse files Browse the repository at this point in the history
Wide glyph truncation still occurs with the glyph-wide-support patch; see LukeSmithxyz/st#349 (comment). The code provided by LukeSmithxyz/st#349 (comment) completely fixes truncation.
  • Loading branch information
thatguynoe committed Jan 9, 2023
1 parent 3ba7478 commit 9bf9f16
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion st.c
Original file line number Diff line number Diff line change
Expand Up @@ -2837,7 +2837,8 @@ draw(void)
drawregion(0, 0, term.col, term.row);
if (term.scr == 0)
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
term.ocx, term.ocy, term.line[term.ocy][term.ocx],
term.line[term.ocy], term.col);
term.ocx = cx;
term.ocy = term.c.y;
xfinishdraw();
Expand Down
2 changes: 1 addition & 1 deletion win.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum win_mode {

void xbell(void);
void xclipcopy(void);
void xdrawcursor(int, int, Glyph, int, int, Glyph);
void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int);
void xdrawline(Line, int, int, int);
void xfinishdraw(void);
void xloadcols(void);
Expand Down
7 changes: 5 additions & 2 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1670,14 +1670,17 @@ xdrawglyph(Glyph g, int x, int y)
}

void
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
{
Color drawcol;

/* remove the old cursor */
if (selected(ox, oy))
og.mode ^= ATTR_REVERSE;
xdrawglyph(og, ox, oy);

/* Redraw the line where cursor was previously.
* It will restore wide glyphs broken by the cursor. */
xdrawline(line, 0, oy, len);

if (IS_SET(MODE_HIDE))
return;
Expand Down

0 comments on commit 9bf9f16

Please sign in to comment.