10 Commits

Author SHA1 Message Date
Fabian Schmidt
044680c9cf Changed primary font size 2020-05-26 18:24:53 +02:00
Fabian Schmidt
4afa49363c Added custom colorscheme 2020-05-23 14:41:53 +02:00
Fabian Schmidt
0048ea34ad Changed font to SauceCodePro Mono 2020-05-23 14:25:00 +02:00
Fabian Schmidt
9c4a7d9b1f Changed word delimiters 2020-05-23 13:02:40 +02:00
Fabian Schmidt
5ec07dcba3 Changed tabspace to 4 2020-05-23 13:01:59 +02:00
Hiltjo Posthuma
475a0a36cb Revert "support REP (repeat) escape sequence"
This reverts commit e8392b282c.

There is currently a bug in older ncurses versions (like on OpenBSD) where a
fix for a bug with REP is not backported yet. Most likely in tty/tty_update.c:

Noticed while using lynx (which uses ncurses/curses).
To reproduce using lynx: echo "Z0000000" | lynx -stdin

or using the program:

int
main(void)
{
	WINDOW *win;
	win = initscr();

	printw("Z0000000");

	refresh();

	sleep(5);

	return 0;
}

This prints "ZZZZZZZ" (incorrectly).
2020-05-16 21:06:13 +02:00
Avi Halachmi (:avih)
e8392b282c support REP (repeat) escape sequence
The sequence \e[Nb prints the last printed char N (more) times if it's
printable, and it's ignored after newline or other control chars.

This is Ecma-048/ANSI-X3.6 sequence and not DEC VT. It's supported by
xterm, and ncurses uses it when possible, e.g. when TERM is xterm* (and
with this commit also st*).

xterm supports only codepoints<=255, possibly due to internal limits.
We support any value/codepoint which was placed in a cell.

To test:
- tput rep 65 4 -> prints 'AAAA'
- printf "\342\225\246\033[4b" -> prints U+2566 1+4 times.
2020-05-16 14:08:10 +02:00
Roberto E. Vargas
f8afebdfa0 Add rin terminfo capability
Tianlin Qu discovered that st is missing rin (scroll back #1 lines).
2020-05-16 14:07:31 +02:00
k0ga
bda9c9ffa6 Make shift+wheel behaves as shift+Prev/Next
St uses a very good hack where mouse wheel genereates ^Y and ^E,
that are the same keys that less and vi uses for backward and
fordward scrolling. Scroll, as many terminal emulators, use
shift+Prev/Next for scrolling, but it is also using ^E and ^Y
for scroling, characters that are reserved in the POSIX shell
in emacs mode for end of line and yanking, making scroll unsable
in st.

This patch adds a new hack, making shift+wheel returning the
same sequences than shift+Prev/Next, meaning that scroll or
any other similar program will not be able to differentiate
between them.
2020-05-16 12:37:14 +02:00
Jakub Leszczak
045a0fab4f Fix selection: selscroll 2020-05-12 15:38:17 +02:00
3 changed files with 31 additions and 38 deletions

View File

@@ -5,7 +5,7 @@
* *
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/ */
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; static char *font = "SauceCodePro Nerd Font Mono:pixelsize=15:antialias=true:autohint=true";
static int borderpx = 2; static int borderpx = 2;
/* /*
@@ -34,7 +34,7 @@ static float chscale = 1.0;
* *
* More advanced example: L" `'\"()[]{}" * More advanced example: L" `'\"()[]{}"
*/ */
wchar_t *worddelimiters = L" "; wchar_t *worddelimiters = L" `'\"()[]{}";
/* selection timeouts (in milliseconds) */ /* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300; static unsigned int doubleclicktimeout = 300;
@@ -87,29 +87,29 @@ char *termname = "st-256color";
* *
* stty tabs * stty tabs
*/ */
unsigned int tabspaces = 8; unsigned int tabspaces = 4;
/* Terminal colors (16 first used in escape sequence) */ /* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = { static const char *colorname[] = {
/* 8 normal colors */ /* 8 normal colors */
"black", "#0c0d0e",
"red3", "#e31a1c",
"green3", "#31a354",
"yellow3", "#dca060",
"blue2", "#3182db",
"magenta3", "#756bb1",
"cyan3", "#80b1d3",
"gray90", "#b7b8b9",
/* 8 bright colors */ /* 8 bright colors */
"gray50", "#737475",
"red", "#e31a1c",
"green", "#31a354",
"yellow", "#dca060",
"#5c5cff", "#3182db",
"magenta", "#756bb1",
"cyan", "#80b1d3",
"white", "#fcfdfe",
[255] = 0, [255] = 0,
@@ -171,7 +171,9 @@ static uint forcemousemod = ShiftMask;
static MouseShortcut mshortcuts[] = { static MouseShortcut mshortcuts[] = {
/* mask button function argument release */ /* mask button function argument release */
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
}; };

26
st.c
View File

@@ -1106,27 +1106,17 @@ selscroll(int orig, int n)
if (sel.ob.x == -1) if (sel.ob.x == -1)
return; return;
if (BETWEEN(sel.ob.y, orig, term.bot) || BETWEEN(sel.oe.y, orig, term.bot)) { if (BETWEEN(sel.nb.y, orig, term.bot) != BETWEEN(sel.ne.y, orig, term.bot)) {
if ((sel.ob.y += n) > term.bot || (sel.oe.y += n) < term.top) { selclear();
} else if (BETWEEN(sel.nb.y, orig, term.bot)) {
sel.ob.y += n;
sel.oe.y += n;
if (sel.ob.y < term.top || sel.ob.y > term.bot ||
sel.oe.y < term.top || sel.oe.y > term.bot) {
selclear(); selclear();
return;
}
if (sel.type == SEL_RECTANGULAR) {
if (sel.ob.y < term.top)
sel.ob.y = term.top;
if (sel.oe.y > term.bot)
sel.oe.y = term.bot;
} else { } else {
if (sel.ob.y < term.top) { selnormalize();
sel.ob.y = term.top;
sel.ob.x = 0;
}
if (sel.oe.y > term.bot) {
sel.oe.y = term.bot;
sel.oe.x = term.col;
}
} }
selnormalize();
} }
} }

View File

@@ -47,7 +47,7 @@ st-mono| simpleterm monocolor,
indn=\E[%p1%dS, indn=\E[%p1%dS,
invis=\E[8m, invis=\E[8m,
is2=\E[4l\E>\E[?1034l, is2=\E[4l\E>\E[?1034l,
it#8, it#4,
kel=\E[1;2F, kel=\E[1;2F,
ked=\E[1;5F, ked=\E[1;5F,
ka1=\E[1~, ka1=\E[1~,
@@ -158,6 +158,7 @@ st-mono| simpleterm monocolor,
rc=\E8, rc=\E8,
rev=\E[7m, rev=\E[7m,
ri=\EM, ri=\EM,
rin=\E[%p1%dT,
ritm=\E[23m, ritm=\E[23m,
rmacs=\E(B, rmacs=\E(B,
rmcup=\E[?1049l, rmcup=\E[?1049l,