Compare commits

..

No commits in common. "7544d3c13dfae83ed19697265daa2ef46882f089" and "211964d56ee00a7d46e251cbc150afb79138ae37" have entirely different histories.

7 changed files with 43 additions and 177 deletions

View File

@ -7,7 +7,13 @@ include config.mk
SRC = st.c x.c
OBJ = $(SRC:.c=.o)
all: st
all: options st
options:
@echo st build options:
@echo "CFLAGS = $(STCFLAGS)"
@echo "LDFLAGS = $(STLDFLAGS)"
@echo "CC = $(CC)"
config.h:
cp config.def.h config.h
@ -48,4 +54,4 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
.PHONY: all clean dist install uninstall
.PHONY: all options clean dist install uninstall

View File

@ -96,24 +96,32 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
[0] = "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
[1] = "#cc241d", /* red */
[2] = "#98971a", /* green */
[3] = "#d79921", /* yellow */
[4] = "#458588", /* blue */
[5] = "#b16286", /* magenta */
[6] = "#689d6a", /* cyan */
[7] = "#a89984", /* white */
"black",
"red3",
"green3",
"yellow3",
"blue2",
"magenta3",
"cyan3",
"gray90",
/* 8 bright colors */
[8] = "#928374", /* black */
[9] = "#fb4934", /* red */
[10] = "#b8bb26", /* green */
[11] = "#fabd2f", /* yellow */
[12] = "#83a598", /* blue */
[13] = "#d3869b", /* magenta */
[14] = "#8ec07c", /* cyan */
[15] = "#ebdbb2", /* white */
"gray50",
"red",
"green",
"yellow",
"#5c5cff",
"magenta",
"cyan",
"white",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
"gray90", /* default foreground colour */
"black", /* default background colour */
};
@ -121,9 +129,9 @@ static const char *colorname[] = {
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 15;
unsigned int defaultbg = 0;
unsigned int defaultcs = 15;
unsigned int defaultfg = 258;
unsigned int defaultbg = 259;
unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/*

View File

@ -1,66 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 91ab8ca..a068694 100644
--- a/config.def.h
+++ b/config.def.h
@@ -96,32 +96,24 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
+ [0] = "#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
+ [1] = "#cc241d", /* red */
+ [2] = "#98971a", /* green */
+ [3] = "#d79921", /* yellow */
+ [4] = "#458588", /* blue */
+ [5] = "#b16286", /* magenta */
+ [6] = "#689d6a", /* cyan */
+ [7] = "#a89984", /* white */
/* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
-
- [255] = 0,
-
- /* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
- "gray90", /* default foreground colour */
- "black", /* default background colour */
+ [8] = "#928374", /* black */
+ [9] = "#fb4934", /* red */
+ [10] = "#b8bb26", /* green */
+ [11] = "#fabd2f", /* yellow */
+ [12] = "#83a598", /* blue */
+ [13] = "#d3869b", /* magenta */
+ [14] = "#8ec07c", /* cyan */
+ [15] = "#ebdbb2", /* white */
};
@@ -129,9 +121,9 @@ static const char *colorname[] = {
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
-unsigned int defaultfg = 258;
-unsigned int defaultbg = 259;
-unsigned int defaultcs = 256;
+unsigned int defaultfg = 15;
+unsigned int defaultbg = 0;
+unsigned int defaultcs = 15;
static unsigned int defaultrcs = 257;
/*

View File

@ -1,67 +0,0 @@
diff --git a/config.def.h b/config.def.h
index 91ab8ca..0be90e8 100644
--- a/config.def.h
+++ b/config.def.h
@@ -96,42 +96,34 @@ unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
- "black",
- "red3",
- "green3",
- "yellow3",
- "blue2",
- "magenta3",
- "cyan3",
- "gray90",
+ [0] = "#fbf1c7", /* hard contrast: #f9f5d7 / soft contrast: #f2e5bc */
+ [1] = "#cc241d", /* red */
+ [2] = "#98971a", /* green */
+ [3] = "#d79921", /* yellow */
+ [4] = "#458588", /* blue */
+ [5] = "#b16286", /* magenta */
+ [6] = "#689d6a", /* cyan */
+ [7] = "#7c6f64", /* white */
/* 8 bright colors */
- "gray50",
- "red",
- "green",
- "yellow",
- "#5c5cff",
- "magenta",
- "cyan",
- "white",
-
- [255] = 0,
-
- /* more colors can be added after 255 to use with DefaultXX */
- "#cccccc",
- "#555555",
- "gray90", /* default foreground colour */
- "black", /* default background colour */
+ [8] = "#928374", /* black */
+ [9] = "#9d0006", /* red */
+ [10] = "#79740e", /* green */
+ [11] = "#b57614", /* yellow */
+ [12] = "#076678", /* blue */
+ [13] = "#8f3f71", /* magenta */
+ [14] = "#427b58", /* cyan */
+ [15] = "#3c3836", /* white */
};
/*
* Default colors (colorname index)
- * foreground, background, cursor, reverse cursor
+ * foreground, background, cursor
*/
-unsigned int defaultfg = 258;
-unsigned int defaultbg = 259;
-unsigned int defaultcs = 256;
+unsigned int defaultfg = 15;
+unsigned int defaultbg = 0;
+unsigned int defaultcs = 15;
static unsigned int defaultrcs = 257;
/*

21
st.c
View File

@ -86,8 +86,8 @@ enum escape_state {
typedef struct {
Glyph attr; /* current char attributes */
int x; /* terminal column */
int y; /* terminal row */
int x;
int y;
char state;
} TCursor;
@ -1097,7 +1097,7 @@ tscrollup(int orig, int n)
void
selscroll(int orig, int n)
{
if (sel.ob.x == -1 || sel.alt != IS_SET(MODE_ALTSCREEN))
if (sel.ob.x == -1)
return;
if (BETWEEN(sel.nb.y, orig, term.bot) != BETWEEN(sel.ne.y, orig, term.bot)) {
@ -1728,7 +1728,6 @@ csihandle(void)
}
break;
case 'S': /* SU -- Scroll <n> line up */
if (csiescseq.priv) break;
DEFAULT(csiescseq.arg[0], 1);
tscrollup(term.top, csiescseq.arg[0]);
break;
@ -2175,16 +2174,12 @@ tstrsequence(uchar c)
void
tcontrolcode(uchar ascii)
{
size_t i;
switch (ascii) {
case '\t': /* HT */
tputtab(1);
return;
case '\b': /* BS */
for (i = 1; term.c.x && term.line[term.c.y][term.c.x - i].u == 0; ++i)
;
tmoveto(term.c.x - i, term.c.y);
tmoveto(term.c.x-1, term.c.y);
return;
case '\r': /* CR */
tmoveto(0, term.c.y);
@ -2335,7 +2330,6 @@ eschandle(uchar ascii)
treset();
resettitle();
xloadcols();
xsetmode(0, MODE_HIDE);
break;
case '=': /* DECPAM -- Application keypad */
xsetmode(1, MODE_APPKEYPAD);
@ -2477,16 +2471,11 @@ check_control_code:
gp = &term.line[term.c.y][term.c.x];
}
if (IS_SET(MODE_INSERT) && term.c.x+width < term.col) {
if (IS_SET(MODE_INSERT) && term.c.x+width < term.col)
memmove(gp+width, gp, (term.col - term.c.x - width) * sizeof(Glyph));
gp->mode &= ~ATTR_WIDE;
}
if (term.c.x+width > term.col) {
if (IS_SET(MODE_WRAP))
tnewline(1);
else
tmoveto(term.col - width, term.c.y);
gp = &term.line[term.c.y][term.c.x];
}

View File

@ -184,10 +184,6 @@ st-mono| simpleterm monocolor,
# XTerm extensions
rmxx=\E[29m,
smxx=\E[9m,
BE=\E[?2004h,
BD=\E[?2004l,
PS=\E[200~,
PE=\E[201~,
# disabled rep for now: causes some issues with older ncurses versions.
# rep=%p1%c\E[%p2%{1}%-%db,
# tmux extensions, see TERMINFO EXTENSIONS in tmux(1)

4
x.c
View File

@ -818,7 +818,7 @@ xloadcols(void)
int
xgetcolor(int x, unsigned char *r, unsigned char *g, unsigned char *b)
{
if (!BETWEEN(x, 0, dc.collen - 1))
if (!BETWEEN(x, 0, dc.collen))
return 1;
*r = dc.col[x].color.red >> 8;
@ -833,7 +833,7 @@ xsetcolorname(int x, const char *name)
{
Color ncolor;
if (!BETWEEN(x, 0, dc.collen - 1))
if (!BETWEEN(x, 0, dc.collen))
return 1;
if (!xloadcolor(x, name, &ncolor))