Compare commits
5 Commits
83b71de2c8
...
3efab6534a
Author | SHA1 | Date |
---|---|---|
Steve Ward | 3efab6534a | |
David Holland | c79471a826 | |
David Holland | 411d5031dc | |
David Holland | c1b7d57d10 | |
David Holland | 3e559c74f8 |
|
@ -18,8 +18,9 @@
|
|||
!/x.c
|
||||
|
||||
!/st-anysize-0.8.1.diff
|
||||
!/st-blinking_cursor-20200531-a2a7044.diff
|
||||
!/st-clipboard-0.8.3.diff
|
||||
!/st-dracula-0.8.2.diff
|
||||
!/st-hidecursor-0.8.3.diff
|
||||
!/st-scrollback-20200419-72e3f6c.diff
|
||||
!/st-universcroll-0.8.4.diff
|
||||
!/st-scrollback-mouse-20191024-a2c479c.diff
|
||||
|
|
38
config.def.h
38
config.def.h
|
@ -5,7 +5,7 @@
|
|||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
*/
|
||||
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||
static char *font = "Hack:size=10:antialias=true:autohint=true";
|
||||
static int borderpx = 2;
|
||||
|
||||
/*
|
||||
|
@ -119,6 +119,8 @@ static const char *colorname[] = {
|
|||
/* special colors */
|
||||
[256] = "#282a36", /* background */
|
||||
[257] = "#f8f8f2", /* foreground */
|
||||
[258] = "#f8f8f2", /* foreground */
|
||||
[259] = "#282a36", /* background */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -127,8 +129,8 @@ static const char *colorname[] = {
|
|||
*/
|
||||
unsigned int defaultfg = 257;
|
||||
unsigned int defaultbg = 256;
|
||||
static unsigned int defaultcs = 257;
|
||||
static unsigned int defaultrcs = 257;
|
||||
static unsigned int defaultcs = 258;
|
||||
static unsigned int defaultrcs = 259;
|
||||
|
||||
/*
|
||||
* Colors used, when the specific fg == defaultfg. So in reverse mode this
|
||||
|
@ -137,14 +139,22 @@ static unsigned int defaultrcs = 257;
|
|||
*/
|
||||
unsigned int defaultitalic = 7;
|
||||
unsigned int defaultunderline = 7;
|
||||
|
||||
/*
|
||||
* Default shape of cursor
|
||||
* 2: Block ("█")
|
||||
* 4: Underline ("_")
|
||||
* 6: Bar ("|")
|
||||
* 7: Snowman ("☃")
|
||||
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81
|
||||
* Default style of cursor
|
||||
* 0: Blinking block
|
||||
* 1: Blinking block (default)
|
||||
* 2: Steady block ("█")
|
||||
* 3: Blinking underline
|
||||
* 4: Steady underline ("_")
|
||||
* 5: Blinking bar
|
||||
* 6: Steady bar ("|")
|
||||
* 7: Blinking st cursor
|
||||
* 8: Steady st cursor
|
||||
*/
|
||||
static unsigned int cursorshape = 2;
|
||||
static unsigned int cursorstyle = 5;
|
||||
static Rune stcursor = 0x2603; /* snowman (U+2603) */
|
||||
|
||||
/*
|
||||
* Default columns and rows numbers
|
||||
|
@ -178,11 +188,13 @@ static uint forcemousemod = ShiftMask;
|
|||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release alt */
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 },
|
||||
/* mask button function argument release */
|
||||
{ ShiftMask, Button4, kscrollup, {.i = 1} },
|
||||
{ ShiftMask, Button5, kscrolldown, {.i = 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, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 },
|
||||
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
From bff176133618854676bbdc74c0099f184d3da365 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Ward <planet36@gmail.com>
|
||||
Date: Sun, 31 May 2020 22:48:25 -0400
|
||||
Subject: [PATCH] Allow blinking cursor
|
||||
|
||||
---
|
||||
config.def.h | 19 +++++++++++++------
|
||||
x.c | 42 ++++++++++++++++++++++++++++++++----------
|
||||
2 files changed, 45 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 6f05dce..3dbe915 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -133,13 +133,20 @@ static unsigned int defaultcs = 256;
|
||||
static unsigned int defaultrcs = 257;
|
||||
|
||||
/*
|
||||
- * Default shape of cursor
|
||||
- * 2: Block ("█")
|
||||
- * 4: Underline ("_")
|
||||
- * 6: Bar ("|")
|
||||
- * 7: Snowman ("☃")
|
||||
+ * https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81
|
||||
+ * Default style of cursor
|
||||
+ * 0: Blinking block
|
||||
+ * 1: Blinking block (default)
|
||||
+ * 2: Steady block ("█")
|
||||
+ * 3: Blinking underline
|
||||
+ * 4: Steady underline ("_")
|
||||
+ * 5: Blinking bar
|
||||
+ * 6: Steady bar ("|")
|
||||
+ * 7: Blinking st cursor
|
||||
+ * 8: Steady st cursor
|
||||
*/
|
||||
-static unsigned int cursorshape = 2;
|
||||
+static unsigned int cursorstyle = 1;
|
||||
+static Rune stcursor = 0x2603; /* snowman (U+2603) */
|
||||
|
||||
/*
|
||||
* Default columns and rows numbers
|
||||
diff --git a/x.c b/x.c
|
||||
index 210f184..bd80a5e 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -253,6 +253,7 @@ static char *opt_name = NULL;
|
||||
static char *opt_title = NULL;
|
||||
|
||||
static int oldbutton = 3; /* button event on startup: 3 = release */
|
||||
+static int cursorblinks = 0;
|
||||
|
||||
void
|
||||
clipcopy(const Arg *dummy)
|
||||
@@ -1526,16 +1527,19 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||
/* draw the new one */
|
||||
if (IS_SET(MODE_FOCUSED)) {
|
||||
switch (win.cursor) {
|
||||
- case 7: /* st extension */
|
||||
- g.u = 0x2603; /* snowman (U+2603) */
|
||||
+ case 0: /* Blinking block */
|
||||
+ case 1: /* Blinking block (default) */
|
||||
+ if (IS_SET(MODE_BLINK))
|
||||
+ break;
|
||||
/* FALLTHROUGH */
|
||||
- case 0: /* Blinking Block */
|
||||
- case 1: /* Blinking Block (Default) */
|
||||
- case 2: /* Steady Block */
|
||||
+ case 2: /* Steady block */
|
||||
xdrawglyph(g, cx, cy);
|
||||
break;
|
||||
- case 3: /* Blinking Underline */
|
||||
- case 4: /* Steady Underline */
|
||||
+ case 3: /* Blinking underline */
|
||||
+ if (IS_SET(MODE_BLINK))
|
||||
+ break;
|
||||
+ /* FALLTHROUGH */
|
||||
+ case 4: /* Steady underline */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + (cy + 1) * win.ch - \
|
||||
@@ -1543,12 +1547,23 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||
win.cw, cursorthickness);
|
||||
break;
|
||||
case 5: /* Blinking bar */
|
||||
+ if (IS_SET(MODE_BLINK))
|
||||
+ break;
|
||||
+ /* FALLTHROUGH */
|
||||
case 6: /* Steady bar */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
borderpx + cx * win.cw,
|
||||
borderpx + cy * win.ch,
|
||||
cursorthickness, win.ch);
|
||||
break;
|
||||
+ case 7: /* Blinking st cursor */
|
||||
+ if (IS_SET(MODE_BLINK))
|
||||
+ break;
|
||||
+ /* FALLTHROUGH */
|
||||
+ case 8: /* Steady st cursor */
|
||||
+ g.u = stcursor;
|
||||
+ xdrawglyph(g, cx, cy);
|
||||
+ break;
|
||||
}
|
||||
} else {
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
@@ -1690,9 +1705,12 @@ xsetmode(int set, unsigned int flags)
|
||||
int
|
||||
xsetcursor(int cursor)
|
||||
{
|
||||
- if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
|
||||
+ if (!BETWEEN(cursor, 0, 8)) /* 7-8: st extensions */
|
||||
return 1;
|
||||
win.cursor = cursor;
|
||||
+ cursorblinks = win.cursor == 0 || win.cursor == 1 ||
|
||||
+ win.cursor == 3 || win.cursor == 5 ||
|
||||
+ win.cursor == 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1936,6 +1954,10 @@ run(void)
|
||||
if (FD_ISSET(ttyfd, &rfd) || xev) {
|
||||
if (!drawing) {
|
||||
trigger = now;
|
||||
+ if (IS_SET(MODE_BLINK)) {
|
||||
+ win.mode ^= MODE_BLINK;
|
||||
+ }
|
||||
+ lastblink = now;
|
||||
drawing = 1;
|
||||
}
|
||||
timeout = (maxlatency - TIMEDIFF(now, trigger)) \
|
||||
@@ -1946,7 +1968,7 @@ run(void)
|
||||
|
||||
/* idle detected or maxlatency exhausted -> draw */
|
||||
timeout = -1;
|
||||
- if (blinktimeout && tattrset(ATTR_BLINK)) {
|
||||
+ if (blinktimeout && (cursorblinks || tattrset(ATTR_BLINK))) {
|
||||
timeout = blinktimeout - TIMEDIFF(now, lastblink);
|
||||
if (timeout <= 0) {
|
||||
if (-timeout > blinktimeout) /* start visible */
|
||||
@@ -1982,7 +2004,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
xw.l = xw.t = 0;
|
||||
xw.isfixed = False;
|
||||
- xsetcursor(cursorshape);
|
||||
+ xsetcursor(cursorstyle);
|
||||
|
||||
ARGBEGIN {
|
||||
case 'a':
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index ec1b576..4b3bf15 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -163,6 +163,8 @@ static uint forcemousemod = ShiftMask;
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
/* mask button function argument release */
|
||||
+ { ShiftMask, Button4, kscrollup, {.i = 1} },
|
||||
+ { ShiftMask, Button5, kscrolldown, {.i = 1} },
|
||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
|
@ -1,90 +0,0 @@
|
|||
From 9726b1e58352126252412e101432e64d46fc51ca Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Lee <dennis@dennislee.xyz>
|
||||
Date: Sun, 28 Jun 2020 23:01:03 -0700
|
||||
Subject: [PATCH] universcroll: mouse wheel only scroll in all modes
|
||||
|
||||
Scroll normally via scroll(1), without Shift, when outside of
|
||||
`MODE_ALTSCREEN`. Inside an alt screen, continue to scroll normally
|
||||
without Shift; in this mode, your scrolling is automatically translated
|
||||
into ^Y and ^E. It just werks!
|
||||
|
||||
Based on the existing mouse-altscreen patch
|
||||
https://st.suckless.org/patches/scrollback/
|
||||
adapted for st(1) 0.8.4 and scroll(1).
|
||||
---
|
||||
config.def.h | 10 +++++-----
|
||||
st.c | 5 +++++
|
||||
st.h | 1 +
|
||||
x.c | 2 ++
|
||||
4 files changed, 13 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 6f05dce..62e87da 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -173,11 +173,11 @@ static uint forcemousemod = ShiftMask;
|
||||
* Beware that overloading Button1 will disable the selection.
|
||||
*/
|
||||
static MouseShortcut mshortcuts[] = {
|
||||
- /* mask button function argument release */
|
||||
- { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
- { ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||
+ /* mask button function argument release alt */
|
||||
+ { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||
+ { XK_ANY_MOD, Button4, ttysend, {.s = "\033[5;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||
- { ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
|
||||
+ { XK_ANY_MOD, Button5, ttysend, {.s = "\033[6;2~"}, 0, -1 },
|
||||
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
|
||||
};
|
||||
|
||||
diff --git a/st.c b/st.c
|
||||
index 76b7e0d..1f65453 100644
|
||||
--- a/st.c
|
||||
+++ b/st.c
|
||||
@@ -1047,6 +1047,11 @@ tnew(int col, int row)
|
||||
treset();
|
||||
}
|
||||
|
||||
+int tisaltscr(void)
|
||||
+{
|
||||
+ return IS_SET(MODE_ALTSCREEN);
|
||||
+}
|
||||
+
|
||||
void
|
||||
tswapscreen(void)
|
||||
{
|
||||
diff --git a/st.h b/st.h
|
||||
index 3d351b6..39cc054 100644
|
||||
--- a/st.h
|
||||
+++ b/st.h
|
||||
@@ -87,6 +87,7 @@ void sendbreak(const Arg *);
|
||||
void toggleprinter(const Arg *);
|
||||
|
||||
int tattrset(int);
|
||||
+int tisaltscr(void);
|
||||
void tnew(int, int);
|
||||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
diff --git a/x.c b/x.c
|
||||
index 210f184..210dde9 100644
|
||||
--- a/x.c
|
||||
+++ b/x.c
|
||||
@@ -34,6 +34,7 @@ typedef struct {
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
uint release;
|
||||
+ int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
|
||||
} MouseShortcut;
|
||||
|
||||
typedef struct {
|
||||
@@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release)
|
||||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
+ (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
|
||||
(match(ms->mod, state) || /* exact or forced */
|
||||
match(ms->mod, state & ~forcemousemod))) {
|
||||
ms->func(&(ms->arg));
|
||||
--
|
||||
2.27.0
|
5
st.c
5
st.c
|
@ -1057,11 +1057,6 @@ tnew(int col, int row)
|
|||
treset();
|
||||
}
|
||||
|
||||
int tisaltscr(void)
|
||||
{
|
||||
return IS_SET(MODE_ALTSCREEN);
|
||||
}
|
||||
|
||||
void
|
||||
tswapscreen(void)
|
||||
{
|
||||
|
|
1
st.h
1
st.h
|
@ -89,7 +89,6 @@ void sendbreak(const Arg *);
|
|||
void toggleprinter(const Arg *);
|
||||
|
||||
int tattrset(int);
|
||||
int tisaltscr(void);
|
||||
void tnew(int, int);
|
||||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
|
|
44
x.c
44
x.c
|
@ -34,7 +34,6 @@ typedef struct {
|
|||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
uint release;
|
||||
int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */
|
||||
} MouseShortcut;
|
||||
|
||||
typedef struct {
|
||||
|
@ -260,6 +259,7 @@ static char *opt_name = NULL;
|
|||
static char *opt_title = NULL;
|
||||
|
||||
static int oldbutton = 3; /* button event on startup: 3 = release */
|
||||
static int cursorblinks = 0;
|
||||
|
||||
void
|
||||
clipcopy(const Arg *dummy)
|
||||
|
@ -453,7 +453,6 @@ mouseaction(XEvent *e, uint release)
|
|||
for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) {
|
||||
if (ms->release == release &&
|
||||
ms->button == e->xbutton.button &&
|
||||
(!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) &&
|
||||
(match(ms->mod, state) || /* exact or forced */
|
||||
match(ms->mod, state & ~forcemousemod))) {
|
||||
ms->func(&(ms->arg));
|
||||
|
@ -1549,16 +1548,19 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
|||
/* draw the new one */
|
||||
if (IS_SET(MODE_FOCUSED)) {
|
||||
switch (win.cursor) {
|
||||
case 7: /* st extension */
|
||||
g.u = 0x2603; /* snowman (U+2603) */
|
||||
case 0: /* Blinking block */
|
||||
case 1: /* Blinking block (default) */
|
||||
if (IS_SET(MODE_BLINK))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case 0: /* Blinking Block */
|
||||
case 1: /* Blinking Block (Default) */
|
||||
case 2: /* Steady Block */
|
||||
case 2: /* Steady block */
|
||||
xdrawglyph(g, cx, cy);
|
||||
break;
|
||||
case 3: /* Blinking Underline */
|
||||
case 4: /* Steady Underline */
|
||||
case 3: /* Blinking underline */
|
||||
if (IS_SET(MODE_BLINK))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case 4: /* Steady underline */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + (cy + 1) * win.ch - \
|
||||
|
@ -1566,12 +1568,23 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
|||
win.cw, cursorthickness);
|
||||
break;
|
||||
case 5: /* Blinking bar */
|
||||
if (IS_SET(MODE_BLINK))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case 6: /* Steady bar */
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
win.hborderpx + cx * win.cw,
|
||||
win.vborderpx + cy * win.ch,
|
||||
cursorthickness, win.ch);
|
||||
break;
|
||||
case 7: /* Blinking st cursor */
|
||||
if (IS_SET(MODE_BLINK))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case 8: /* Steady st cursor */
|
||||
g.u = stcursor;
|
||||
xdrawglyph(g, cx, cy);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
XftDrawRect(xw.draw, &drawcol,
|
||||
|
@ -1715,9 +1728,12 @@ xsetmode(int set, unsigned int flags)
|
|||
int
|
||||
xsetcursor(int cursor)
|
||||
{
|
||||
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
|
||||
if (!BETWEEN(cursor, 0, 8)) /* 7-8: st extensions */
|
||||
return 1;
|
||||
win.cursor = cursor;
|
||||
cursorblinks = win.cursor == 0 || win.cursor == 1 ||
|
||||
win.cursor == 3 || win.cursor == 5 ||
|
||||
win.cursor == 7;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1967,6 +1983,10 @@ run(void)
|
|||
if (FD_ISSET(ttyfd, &rfd) || xev) {
|
||||
if (!drawing) {
|
||||
trigger = now;
|
||||
if (IS_SET(MODE_BLINK)) {
|
||||
win.mode ^= MODE_BLINK;
|
||||
}
|
||||
lastblink = now;
|
||||
drawing = 1;
|
||||
}
|
||||
timeout = (maxlatency - TIMEDIFF(now, trigger)) \
|
||||
|
@ -1977,7 +1997,7 @@ run(void)
|
|||
|
||||
/* idle detected or maxlatency exhausted -> draw */
|
||||
timeout = -1;
|
||||
if (blinktimeout && tattrset(ATTR_BLINK)) {
|
||||
if (blinktimeout && (cursorblinks || tattrset(ATTR_BLINK))) {
|
||||
timeout = blinktimeout - TIMEDIFF(now, lastblink);
|
||||
if (timeout <= 0) {
|
||||
if (-timeout > blinktimeout) /* start visible */
|
||||
|
@ -2013,7 +2033,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
xw.l = xw.t = 0;
|
||||
xw.isfixed = False;
|
||||
xsetcursor(cursorshape);
|
||||
xsetcursor(cursorstyle);
|
||||
|
||||
ARGBEGIN {
|
||||
case 'a':
|
||||
|
|
Loading…
Reference in New Issue