X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=dd3301b121083cfaeea2383d7912e31634f2b860;hp=497885b0b48c03fc19be0de0e558049d05168e51;hb=0392d165d07143eec29c730364006bc0613e1198;hpb=51466e019a67e9319e6c5a7fa4205842ca860b71 diff --git a/st.c b/st.c index 497885b..dd3301b 100644 --- a/st.c +++ b/st.c @@ -662,7 +662,10 @@ y2row(int y) { static int tlinelen(int y) { int i = term.col; - while (i > 0 && term.line[y][i - 1].c[0] == ' ') + if(term.line[y][i - 1].mode & ATTR_WRAP) + return i; + + while(i > 0 && term.line[y][i - 1].c[0] == ' ') --i; return i; @@ -959,7 +962,7 @@ getsel(void) { * st. * FIXME: Fix the computer world. */ - if(sel.ne.y > y || lastx >= linelen) + if((y < sel.ne.y || lastx >= linelen) && !(last->mode & ATTR_WRAP)) *ptr++ = '\n'; } *ptr = 0; @@ -3456,39 +3459,40 @@ xdrawcursor(void) { xdraws(term.line[oldy][oldx].c, term.line[oldy][oldx], oldx, oldy, width, sl); + if(IS_SET(MODE_HIDE)) + return; + /* draw the new one */ - if(!(IS_SET(MODE_HIDE))) { - if(xw.state & WIN_FOCUSED) { - if(IS_SET(MODE_REVERSE)) { - g.mode |= ATTR_REVERSE; - g.fg = defaultcs; - g.bg = defaultfg; - } + if(xw.state & WIN_FOCUSED) { + if(IS_SET(MODE_REVERSE)) { + g.mode |= ATTR_REVERSE; + g.fg = defaultcs; + g.bg = defaultfg; + } - sl = utf8len(g.c); - width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ - ? 2 : 1; - xdraws(g.c, g, term.c.x, term.c.y, width, sl); - } else { - XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + curx * xw.cw, - borderpx + term.c.y * xw.ch, - xw.cw - 1, 1); - XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + curx * xw.cw, - borderpx + term.c.y * xw.ch, - 1, xw.ch - 1); - XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + (curx + 1) * xw.cw - 1, - borderpx + term.c.y * xw.ch, - 1, xw.ch - 1); - XftDrawRect(xw.draw, &dc.col[defaultcs], - borderpx + curx * xw.cw, - borderpx + (term.c.y + 1) * xw.ch - 1, - xw.cw, 1); - } - oldx = curx, oldy = term.c.y; - } + sl = utf8len(g.c); + width = (term.line[term.c.y][curx].mode & ATTR_WIDE)\ + ? 2 : 1; + xdraws(g.c, g, term.c.x, term.c.y, width, sl); + } else { + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + xw.cw - 1, 1); + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + term.c.y * xw.ch, + 1, xw.ch - 1); + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + (curx + 1) * xw.cw - 1, + borderpx + term.c.y * xw.ch, + 1, xw.ch - 1); + XftDrawRect(xw.draw, &dc.col[defaultcs], + borderpx + curx * xw.cw, + borderpx + (term.c.y + 1) * xw.ch - 1, + xw.cw, 1); + } + oldx = curx, oldy = term.c.y; }