#include <X11/keysym.h>
#include <X11/Xutil.h>
-#define TNAME "st-256color"
-
/* Arbitrary sizes */
#define ESC_TITLE_SIZ 256
#define ESC_BUF_SIZ 256
char s[ESC_BUF_SIZ];
} Key;
-#include "config.h"
-
/* Drawing Context */
typedef struct {
unsigned long col[256];
GC gc;
} DC;
+#include "config.h"
+
static void die(const char *errstr, ...);
static void draw(int);
static void execsh(void);
static void tmoveto(int, int);
static void tnew(int, int);
static void tnewline(void);
+static void tputtab(void);
static void tputc(char);
static void tputs(char*, int);
static void treset(void);
static void ttyresize(int, int);
static void ttywrite(const char *, size_t);
+static void xbell(void);
+static void xdraws(char *, Glyph, int, int, int);
+static void xhints(void);
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);
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++;
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
}
void
-tloadcols(void) {
+xloadcols(void) {
int i, r, g, b;
XColor color;
Colormap cmap = DefaultColormap(xw.dis, xw.scr);
xw.ch = dc.font->ascent + dc.font->descent;
/* colors */
- tloadcols();
+ xloadcols();
term.c.attr.fg = DefaultFG;
term.c.attr.bg = DefaultBG;
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);