X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=2e0ef70bfd9083e10dee726783e52d558b6e6421;hb=b09401b96b640a796d11774664c49031cee3245a;hp=5715f0fc0d675c4a234f01792bc22476b5f1518d;hpb=10e49a0505a250fc78c41842d93eb2a0abaf4c93;p=st.git diff --git a/st.c b/st.c index 5715f0f..2e0ef70 100644 --- a/st.c +++ b/st.c @@ -20,8 +20,6 @@ #include #include -#define TNAME "st-256color" - /* Arbitrary sizes */ #define ESC_TITLE_SIZ 256 #define ESC_BUF_SIZ 256 @@ -107,8 +105,6 @@ typedef struct { char s[ESC_BUF_SIZ]; } Key; -#include "config.h" - /* Drawing Context */ typedef struct { unsigned long col[256]; @@ -117,6 +113,8 @@ typedef struct { GC gc; } DC; +#include "config.h" + static void die(const char *errstr, ...); static void draw(int); static void execsh(void); @@ -157,6 +155,7 @@ static void ttywrite(const char *, size_t); static void xclear(int, int, int, int); static void xcursor(int); static void xinit(void); +static void xloadcols(void); static void expose(XEvent *); static char* kmap(KeySym); @@ -444,11 +443,6 @@ tmovecursor(int dir) { break; case CURSOR_LEFT: xf--; - if(term.mode & MODE_WRAP && xf < 0) { - xf = term.col-1, yf--; - if(yf < term.top) - yf = term.top, xf = 0; - } break; case CURSOR_RIGHT: xf++; @@ -498,21 +492,21 @@ tdeletechar(int n) { return; } memmove(&term.line[term.c.y][dst], &term.line[term.c.y][src], size * sizeof(Glyph)); - tclearregion(term.col-size, term.c.y, term.col-1, term.c.y); + tclearregion(term.col-n, term.c.y, term.col-1, term.c.y); } void tinsertblank(int n) { int src = term.c.x; int dst = src + n; - int size = term.col - n - src; + int size = term.col - dst; if(dst >= term.col) { tclearregion(term.c.x, term.c.y, term.col-1, term.c.y); return; } memmove(&term.line[term.c.y][dst], &term.line[term.c.y][src], size * sizeof(Glyph)); - tclearregion(src, term.c.y, dst, term.c.y); + tclearregion(src, term.c.y, dst - 1, term.c.y); } void @@ -1035,7 +1029,7 @@ tresize(int col, int row) { } void -tloadcols(void) { +xloadcols(void) { int i, r, g, b; XColor color; Colormap cmap = DefaultColormap(xw.dis, xw.scr); @@ -1115,7 +1109,7 @@ xinit(void) { xw.ch = dc.font->ascent + dc.font->descent; /* colors */ - tloadcols(); + xloadcols(); term.c.attr.fg = DefaultFG; term.c.attr.bg = DefaultBG; @@ -1174,7 +1168,7 @@ xcursor(int mode) { if(term.line[term.c.y][term.c.x].state & GLYPH_SET) g.c = term.line[term.c.y][term.c.x].c; - + /* remove the old cursor */ if(term.line[oldy][oldx].state & GLYPH_SET) xdraws(&term.line[oldy][oldx].c, term.line[oldy][oldx], oldx, oldy, 1);