Compare commits

...

10 Commits

Author SHA1 Message Date
Peter Hofmann 9846a56bd7 Add terminfo entries for bracketed paste mode
8 months ago
Peter Hofmann 559fdc2786 Unhide cursor on RIS (\033c)
8 months ago
Peter Hofmann 8abe4bcb41 Fix wide glyphs breaking "nowrap" mode
8 months ago
Peter Hofmann 2fc7e532b2 Don't scroll selection on the other screen
8 months ago
Peter Hofmann a6bbc0c96b Fix bounds checks of dc.col
8 months ago
Hiltjo Posthuma eb3b894f40 Makefile: remove the options target
8 months ago
Shi Tian 3a6d6d7401 Fix for wide character being incorrectly cleared on MODE_INSERT
11 months ago
Hiltjo Posthuma 211964d56e ignore C1 control characters in UTF-8 mode
1 year ago
Adam Price f17abd25b3 Add support for DSR response "OK" escape sequence
1 year ago
Hiltjo Posthuma 7e8050cc62 Fixed OSC color reset without parameter->resets all colors
1 year ago

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

32
st.c

@ -1097,7 +1097,7 @@ tscrollup(int orig, int n)
void
selscroll(int orig, int n)
{
if (sel.ob.x == -1)
if (sel.ob.x == -1 || sel.alt != IS_SET(MODE_ALTSCREEN))
return;
if (BETWEEN(sel.nb.y, orig, term.bot) != BETWEEN(sel.ne.y, orig, term.bot)) {
@ -1769,11 +1769,18 @@ csihandle(void)
case 'm': /* SGR -- Terminal attribute (color) */
tsetattr(csiescseq.arg, csiescseq.narg);
break;
case 'n': /* DSR Device Status Report (cursor position) */
if (csiescseq.arg[0] == 6) {
case 'n': /* DSR -- Device Status Report */
switch (csiescseq.arg[0]) {
case 5: /* Status Report "OK" `0n` */
ttywrite("\033[0n", sizeof("\033[0n") - 1, 0);
break;
case 6: /* Report Cursor Position (CPR) "<row>;<column>R" */
len = snprintf(buf, sizeof(buf), "\033[%i;%iR",
term.c.y+1, term.c.x+1);
term.c.y+1, term.c.x+1);
ttywrite(buf, len, 0);
break;
default:
goto unknown;
}
break;
case 'r': /* DECSTBM -- Set Scrolling Region */
@ -1932,8 +1939,10 @@ strhandle(void)
if (p && !strcmp(p, "?")) {
osc_color_response(j, 0, 1);
} else if (xsetcolorname(j, p)) {
if (par == 104 && narg <= 1)
if (par == 104 && narg <= 1) {
xloadcols();
return; /* color reset without parameter */
}
fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
j, p ? p : "(null)");
} else {
@ -2321,6 +2330,7 @@ eschandle(uchar ascii)
treset();
resettitle();
xloadcols();
xsetmode(0, MODE_HIDE);
break;
case '=': /* DECPAM -- Application keypad */
xsetmode(1, MODE_APPKEYPAD);
@ -2413,6 +2423,9 @@ check_control_code:
* they must not cause conflicts with sequences.
*/
if (control) {
/* in UTF-8 mode ignore handling C1 control characters */
if (IS_SET(MODE_UTF8) && ISCONTROLC1(u))
return;
tcontrolcode(u);
/*
* control codes are not shown ever
@ -2459,11 +2472,16 @@ 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) {
tnewline(1);
if (IS_SET(MODE_WRAP))
tnewline(1);
else
tmoveto(term.col - width, term.c.y);
gp = &term.line[term.c.y][term.c.x];
}

@ -184,6 +184,10 @@ 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

@ -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))
if (!BETWEEN(x, 0, dc.collen - 1))
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))
if (!BETWEEN(x, 0, dc.collen - 1))
return 1;
if (!xloadcolor(x, name, &ncolor))

Loading…
Cancel
Save