diff options
| -rw-r--r-- | st.c | 44 |
1 files changed, 31 insertions, 13 deletions
| @@ -1811,7 +1811,6 @@ tmoveto(int x, int y) | |||
| 1811 | { | 1811 | { |
| 1812 | int miny, maxy; | 1812 | int miny, maxy; |
| 1813 | 1813 | ||
| 1814 | selclear(NULL); | ||
| 1815 | if (term.c.state & CURSOR_ORIGIN) { | 1814 | if (term.c.state & CURSOR_ORIGIN) { |
| 1816 | miny = term.top; | 1815 | miny = term.top; |
| 1817 | maxy = term.bot; | 1816 | maxy = term.bot; |
| @@ -3819,6 +3818,7 @@ xdrawglyph(Glyph g, int x, int y) | |||
| 3819 | { | 3818 | { |
| 3820 | int numspecs; | 3819 | int numspecs; |
| 3821 | XftGlyphFontSpec spec; | 3820 | XftGlyphFontSpec spec; |
| 3821 | |||
| 3822 | numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); | 3822 | numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); |
| 3823 | xdrawglyphfontspecs(&spec, g, numspecs, x, y); | 3823 | xdrawglyphfontspecs(&spec, g, numspecs, x, y); |
| 3824 | } | 3824 | } |
| @@ -3828,8 +3828,10 @@ xdrawcursor(void) | |||
| 3828 | { | 3828 | { |
| 3829 | static int oldx = 0, oldy = 0; | 3829 | static int oldx = 0, oldy = 0; |
| 3830 | int curx; | 3830 | int curx; |
| 3831 | Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs}; | 3831 | Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs}, og; |
| 3832 | int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); | 3832 | int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); |
| 3833 | Color drawcol; | ||
| 3834 | XRenderColor dccol; | ||
| 3833 | 3835 | ||
| 3834 | LIMIT(oldx, 0, term.col-1); | 3836 | LIMIT(oldx, 0, term.col-1); |
| 3835 | LIMIT(oldy, 0, term.row-1); | 3837 | LIMIT(oldy, 0, term.row-1); |
| @@ -3842,12 +3844,28 @@ xdrawcursor(void) | |||
| 3842 | if (term.line[term.c.y][curx].mode & ATTR_WDUMMY) | 3844 | if (term.line[term.c.y][curx].mode & ATTR_WDUMMY) |
| 3843 | curx--; | 3845 | curx--; |
| 3844 | 3846 | ||
| 3847 | /* remove the old cursor */ | ||
| 3848 | og = term.line[oldy][oldx]; | ||
| 3849 | if (ena_sel && selected(oldx, oldy)) | ||
| 3850 | og.mode ^= ATTR_REVERSE; | ||
| 3851 | xdrawglyph(og, oldx, oldy); | ||
| 3852 | |||
| 3845 | g.u = term.line[term.c.y][term.c.x].u; | 3853 | g.u = term.line[term.c.y][term.c.x].u; |
| 3846 | if (ena_sel && selected(term.c.x, term.c.y)) | 3854 | if (ena_sel && selected(term.c.x, term.c.y)) { |
| 3847 | g.mode ^= ATTR_REVERSE; | 3855 | /* |
| 3856 | * Allocate the drawing color which is the reverse of | ||
| 3857 | * defaultcs, if we are selected. | ||
| 3858 | */ | ||
| 3859 | dccol.red = ~dc.col[defaultcs].color.red; | ||
| 3860 | dccol.green = ~dc.col[defaultcs].color.green; | ||
| 3861 | dccol.blue = ~dc.col[defaultcs].color.blue; | ||
| 3862 | dccol.alpha = ~dc.col[defaultcs].color.alpha; | ||
| 3863 | XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &dccol, &drawcol); | ||
| 3848 | 3864 | ||
| 3849 | /* remove the old cursor */ | 3865 | g.mode ^= ATTR_REVERSE; |
| 3850 | xdrawglyph(term.line[oldy][oldx], oldx, oldy); | 3866 | } else { |
| 3867 | drawcol = dc.col[defaultcs]; | ||
| 3868 | } | ||
| 3851 | 3869 | ||
| 3852 | if (IS_SET(MODE_HIDE)) | 3870 | if (IS_SET(MODE_HIDE)) |
| 3853 | return; | 3871 | return; |
| @@ -3869,33 +3887,33 @@ xdrawcursor(void) | |||
| 3869 | break; | 3887 | break; |
| 3870 | case 3: /* Blinking Underline */ | 3888 | case 3: /* Blinking Underline */ |
| 3871 | case 4: /* Steady Underline */ | 3889 | case 4: /* Steady Underline */ |
| 3872 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3890 | XftDrawRect(xw.draw, &drawcol, |
| 3873 | borderpx + curx * xw.cw, | 3891 | borderpx + curx * xw.cw, |
| 3874 | borderpx + (term.c.y + 1) * xw.ch - cursorthickness, | 3892 | borderpx + (term.c.y + 1) * xw.ch - cursorthickness, |
| 3875 | xw.cw, cursorthickness); | 3893 | xw.cw, cursorthickness); |
| 3876 | break; | 3894 | break; |
| 3877 | case 5: /* Blinking bar */ | 3895 | case 5: /* Blinking bar */ |
| 3878 | case 6: /* Steady bar */ | 3896 | case 6: /* Steady bar */ |
| 3879 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3897 | XftDrawRect(xw.draw, &drawcol, |
| 3880 | borderpx + curx * xw.cw, | 3898 | borderpx + curx * xw.cw, |
| 3881 | borderpx + term.c.y * xw.ch, | 3899 | borderpx + term.c.y * xw.ch, |
| 3882 | cursorthickness, xw.ch); | 3900 | cursorthickness, xw.ch); |
| 3883 | break; | 3901 | break; |
| 3884 | } | 3902 | } |
| 3885 | } else { | 3903 | } else { |
| 3886 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3904 | XftDrawRect(xw.draw, &drawcol, |
| 3887 | borderpx + curx * xw.cw, | 3905 | borderpx + curx * xw.cw, |
| 3888 | borderpx + term.c.y * xw.ch, | 3906 | borderpx + term.c.y * xw.ch, |
| 3889 | xw.cw - 1, 1); | 3907 | xw.cw - 1, 1); |
| 3890 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3908 | XftDrawRect(xw.draw, &drawcol, |
| 3891 | borderpx + curx * xw.cw, | 3909 | borderpx + curx * xw.cw, |
| 3892 | borderpx + term.c.y * xw.ch, | 3910 | borderpx + term.c.y * xw.ch, |
| 3893 | 1, xw.ch - 1); | 3911 | 1, xw.ch - 1); |
| 3894 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3912 | XftDrawRect(xw.draw, &drawcol, |
| 3895 | borderpx + (curx + 1) * xw.cw - 1, | 3913 | borderpx + (curx + 1) * xw.cw - 1, |
| 3896 | borderpx + term.c.y * xw.ch, | 3914 | borderpx + term.c.y * xw.ch, |
| 3897 | 1, xw.ch - 1); | 3915 | 1, xw.ch - 1); |
| 3898 | XftDrawRect(xw.draw, &dc.col[defaultcs], | 3916 | XftDrawRect(xw.draw, &drawcol, |
| 3899 | borderpx + curx * xw.cw, | 3917 | borderpx + curx * xw.cw, |
| 3900 | borderpx + (term.c.y + 1) * xw.ch - 1, | 3918 | borderpx + (term.c.y + 1) * xw.ch - 1, |
| 3901 | xw.cw, 1); | 3919 | xw.cw, 1); |
| @@ -3945,7 +3963,7 @@ drawregion(int x1, int y1, int x2, int y2) | |||
| 3945 | { | 3963 | { |
| 3946 | int i, x, y, ox, numspecs; | 3964 | int i, x, y, ox, numspecs; |
| 3947 | Glyph base, new; | 3965 | Glyph base, new; |
| 3948 | XftGlyphFontSpec* specs; | 3966 | XftGlyphFontSpec *specs; |
| 3949 | int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); | 3967 | int ena_sel = sel.ob.x != -1 && sel.alt == IS_SET(MODE_ALTSCREEN); |
| 3950 | 3968 | ||
| 3951 | if (!(xw.state & WIN_VISIBLE)) | 3969 | if (!(xw.state & WIN_VISIBLE)) |
