Compare commits
No commits in common. "master" and "63733ff8da6acb5bfaf7718cfc546d78e29f4669" have entirely different histories.
master
...
63733ff8da
|
|
@ -3,6 +3,3 @@
|
|||
st
|
||||
*.rej
|
||||
*.orig
|
||||
src/
|
||||
pkg/
|
||||
*.tar*
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
matrix:
|
||||
# PLATFORM:
|
||||
# - linux/amd64
|
||||
# - linux/arm64
|
||||
|
||||
ARCH:
|
||||
# tuur
|
||||
- tigerlake
|
||||
# cenny
|
||||
- skylake
|
||||
|
||||
branches: master
|
||||
platform: linux/amd64
|
||||
|
||||
when:
|
||||
event: push
|
||||
|
||||
pipeline:
|
||||
build:
|
||||
image: 'menci/archlinuxarm:base-devel'
|
||||
commands:
|
||||
# Add my bur repo to pacman for the libxft-bgra dependency
|
||||
- echo -e '[bur]\nServer = https://arch.r8r.be/$repo/$arch\nSigLevel = Optional' >> /etc/pacman.conf
|
||||
# Update packages
|
||||
- pacman -Syu --noconfirm
|
||||
# Create non-root user to perform build & switch to their home
|
||||
- groupadd -g 1000 builder
|
||||
- useradd -mg builder builder
|
||||
- chown -R builder:builder "$PWD"
|
||||
- "echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
|
||||
- su builder
|
||||
# Build the package
|
||||
- >
|
||||
MAKEFLAGS="-j$(nproc)"
|
||||
makepkg -s --noconfirm --needed
|
||||
CFLAGS+=" -O3 -flto -march=${ARCH} -mtune=${ARCH}"
|
||||
CARCH="x86_64_${ARCH}"
|
||||
|
||||
publish:
|
||||
image: 'curlimages/curl'
|
||||
commands:
|
||||
# Publish the package
|
||||
- 'curl --fail -s -XPOST -H "Authorization: Bearer $API_KEY" -T "$(ls *.pkg*)" https://arch2.r8r.be/jjr'
|
||||
secrets:
|
||||
- api_key
|
||||
7
FAQ
7
FAQ
|
|
@ -29,8 +29,8 @@ you can manually run `tic -sx st.info`.
|
|||
|
||||
## I would like to have utmp and/or scroll functionality by default
|
||||
|
||||
You can add the absolute path of both programs in your config.h file. You only
|
||||
have to modify the value of utmp and scroll variables.
|
||||
You can add the absolute patch of both programs in your config.h
|
||||
file. You only have to modify the value of utmp and scroll variables.
|
||||
|
||||
|
||||
## Why doesn't the Del key work in some programs?
|
||||
|
|
@ -248,6 +248,3 @@ fonts:
|
|||
|
||||
Please don't bother reporting this bug to st, but notify the upstream Xft
|
||||
developers about fixing this bug.
|
||||
|
||||
As of 2022-09-05 this now seems to be finally fixed in libXft 2.3.5:
|
||||
https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS
|
||||
|
|
|
|||
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
MIT/X Consortium License
|
||||
|
||||
© 2014-2022 Hiltjo Posthuma <hiltjo at codemadness dot org>
|
||||
© 2014-2020 Hiltjo Posthuma <hiltjo at codemadness dot org>
|
||||
© 2018 Devin J. Pohly <djpohly at gmail dot com>
|
||||
© 2014-2017 Quentin Rameau <quinq at fifth dot space>
|
||||
© 2009-2012 Aurélien APTEL <aurelien dot aptel at gmail dot com>
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -49,7 +49,7 @@ install: st
|
|||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||
# tic -sx st.info
|
||||
tic -sx st.info
|
||||
@echo Please see the README file regarding the terminfo entry of st.
|
||||
|
||||
uninstall:
|
||||
|
|
|
|||
77
PKGBUILD
77
PKGBUILD
|
|
@ -1,77 +0,0 @@
|
|||
# Maintainer: Jef Roosens
|
||||
|
||||
pkgname=jjr-st
|
||||
pkgver=0.9.2
|
||||
pkgrel=1
|
||||
pkgdesc="Chewing_Bever's personal build of the st terminal"
|
||||
|
||||
url="https://git.rustybever.be/Chewing_Bever/st"
|
||||
license=("MIT")
|
||||
arch=(
|
||||
"x86_64"
|
||||
"x86_64_tigerlake"
|
||||
"x86_64_skylake"
|
||||
"aarch64"
|
||||
)
|
||||
|
||||
depends=("glibc" "libxft-bgra")
|
||||
makedepends=("gcc")
|
||||
|
||||
provides=("st")
|
||||
conflicts=("st" "st-git")
|
||||
|
||||
source=("arg.h" "boxdraw.c" "boxdraw_data.h" "config.def.h" "config.h"
|
||||
"config.mk" "hb.c" "hb.h" "LICENSE" "Makefile" "st.1" "st.c" "st.h" "st.info"
|
||||
"win.h" "x.c" "README")
|
||||
sha256sums=('1a10fac42d03b3a1231cd6998a73fb4ab4f191694628953e7229f6de2053a985'
|
||||
'e8366b6b7840759157761b4d311028fa29b846f393b9e928a2587b3ac9bffdd1'
|
||||
'808dbefe40e81b88da173985e1bd5c0a0d88d517b7cc1c6d68753e586ffe1698'
|
||||
'49bff578b6c882123393c867689f4330d6ba7cfe85fe359ea7424b228b22970e'
|
||||
'6fa7874b83e98a30e8c66c8f7d5539d1b2ec6c2267ef2c3945620826187b6b64'
|
||||
'2ac9d7e18c87595165dffdcedc96c2355d74778667a0770e5079d740cb50ce0c'
|
||||
'f4fae0ee42168f492ea59825928d1dbaceae5cf9e6fe2f820a429a68266000c7'
|
||||
'4a133d16a818379ab849b41c30cb4b4f989a00c9b1e96907a4d130d12c36a79e'
|
||||
'5c25b701b4482ccc8d5ea0770e553ad8a8c5c87650df07543b3b3f9456726d54'
|
||||
'20459f3d01ba1750c55764c0554a7aebcfad74f8f359c6cc30848c691483c2ef'
|
||||
'5b0d65d135fcc3d51f60e4fe4d86c5bbd1331266f9b38ecfb86914668c03921c'
|
||||
'24f5497597f2704e22ba58891c6a3502e391755eed5e8cbd7dfe875fef63b43c'
|
||||
'285b883ebd0884467be95562885f4cf594cd72cf7b4925476538483fe4022f39'
|
||||
'2eb2f15957b8132a2d25129c24bb97f64657bd821447f36ef2cf0526b42846e8'
|
||||
'c1f30d9d38828194c25fa943978a4ee766fe77294e98cea0e4fffa81756bddad'
|
||||
'ad0cfcd7242682a05421788163aefe45164005f7916cc29a4dc60c4d74005805'
|
||||
'f767c242485eb537f0df13cbcc182980d29152a6e25036cf65f334fb3ae8b29e')
|
||||
sha512sums=('53846896087eee0242e3679e8f35be8330e5de63b0247876ac368cf13f62b03c564f99957d49c7f9a7b74cc5190a32b034955d7bf633cc2848da266d7a7f1786'
|
||||
'031a4bcec190b6e8dbc64e604674f5b754ecc2a79d63f0bb1d9bfe7c79bcb17ee3f36440dd55580e5b238e5e4bf808aa0f0f65cf00072f47d8c9851df06e6489'
|
||||
'19d9d5414d78d5cc59a080e7f9955e02420c1d18268299160cb4bcb156c6cb0d0cbcf16a9e20094b67cfba3b721a4bfb71223d772c37238a9390388b00eb8919'
|
||||
'0dba6f78e020f6b51acbd5b19a1e6d62ce990fcbe5a0d5f49eca065cc5f4600dad1222be282c01daf08a213d16e45dcd96497ff686b1bc5cc5e8996b5cda9864'
|
||||
'bf0d3f0cbeb07b7268c8e08331cb3a82ee438d8414a62233a0accc3966ff96cc37da932ab17fda9a8d560446e4e2c931bd62af0c1e8eb84447ccf48774ee92db'
|
||||
'c5a6dda87f542378261327ae53f8c6c8ef9cc35575f10c51291d4b36fed47ced77bec7b136fbf2c678794501d34f35911f740ee2b50b30af2e52c9baf393407f'
|
||||
'd847eb005da53e8938379854017451fc716c15228ffccd7a75b75cbccb6259371ec233ddbdd5fefdacd28e0b5aaad41d163358732bdbefb9178678b637bf050c'
|
||||
'e287b76dfd1cb6930bdc3c74a77888b6f7e2309c24bf9466c65425418dcff8e977649c71a0ca0ce8c118901d4e81c3781f60324df8394ceee12dae9c7875dc02'
|
||||
'60bda0e2668626949c4d70ce338c03ce8e2d0f98544ca7053f3061111506a3d8426357253982e56140bb005b6f3a3a383086d9b58a40d4dbd79a6bee9ec2677f'
|
||||
'81259bdec9c42cbdffd12913672af141095b5c49be4c8d19951bd2a5dc4f2c525b7923579561c3259cb9b58d9f24b04d5e846ff4308a759c92e6eda12adb7b01'
|
||||
'3e9378413277f344d46056e72c2cf19a3f68ed3175fcaa177a6a0c90d3ff6282d3cb423aa98d32fed9647d2be8cbd52b8adb6f73f87186e95d81320e90fc185d'
|
||||
'ce7d57550c1fd4731ec0adac11f2fcc6a163524bbdf72359ed544062226ce8775c5bb909e31f4bc92643442bd46be4061ade23d5dd356ad745bea9e59b8536d0'
|
||||
'c6f08ba53ea59c74b35f889a183feca2a124d46654a6f0556fb181c3843d7d11f9174a934ce01de630c46be2caf705c9ae636f3e59f9762079c3c821652cea87'
|
||||
'683b40e8d7173ec8d84e2d53454e5111f2effce0c27641e010da1bcec7ee169bfad46142e01893b5e66df87f109bc1afeb944cbae5ce56aa55bfc2544d04e87a'
|
||||
'28234c79599248929c85936c68ab68f977a722069c51424ae0faa92eddd5d4bf9fc75df0f4a509704ae5b56a2be13481883d675627c4e7fd47f6320a70d259ea'
|
||||
'4cb372dd9b5711242bce1b82008f9b7c2cfae59c4d2f378df20a88134b61b050aa8f000b01e6e1c0195c14967111497974d67104c1895afb75065d2b6f461255'
|
||||
'd345c041854864ff8c21cbc5c934d3b5dda2fc7f97eee484d8cee4f3c8671ba5f2dcecad313a199e750a2d64d4e0dfbe9a6033d0ea701c1f9d9b6753502bf72b')
|
||||
|
||||
build() {
|
||||
make CFLAGS="$CFLAGS"
|
||||
}
|
||||
|
||||
package() {
|
||||
local installopts='--mode 0644 -D --target-directory'
|
||||
local shrdir="$pkgdir/usr/share"
|
||||
local licdir="$shrdir/licenses/$pkgname"
|
||||
local docdir="$shrdir/doc/$pkgname"
|
||||
make PREFIX=/usr DESTDIR="$pkgdir" install
|
||||
install $installopts "$licdir" "LICENSE"
|
||||
install $installopts "$docdir" "README"
|
||||
# install $installopts "$docdir" README.terminfo.rst
|
||||
# install $installopts "$shrdir/$pkgname" "$_sourcedir/st.info"
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
||||
|
|
@ -162,10 +162,10 @@ static const char *altcolorname[] = {
|
|||
* Default colors (colorname index)
|
||||
* foreground, background, cursor, reverse cursor
|
||||
*/
|
||||
unsigned int defaultfg = 258;
|
||||
unsigned int defaultbg = 259;
|
||||
unsigned int defaultcs = 256;
|
||||
static unsigned int defaultrcs = 257;
|
||||
unsigned int defaultfg = 12;
|
||||
unsigned int defaultbg = 8;
|
||||
static unsigned int defaultcs = 14;
|
||||
static unsigned int defaultrcs = 15;
|
||||
|
||||
/*
|
||||
* Default shape of cursor
|
||||
|
|
|
|||
8
config.h
8
config.h
|
|
@ -5,12 +5,12 @@
|
|||
*
|
||||
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
|
||||
*/
|
||||
static char *font = "Fira Code:size=10:antialias=true;autohint=true";
|
||||
static char *font = "Fira Code:size=11:antialias=true;autohint=true";
|
||||
static char *font2[] = {
|
||||
"Noto Color Emoji:size=10:antialias=true;autohint=true"
|
||||
};
|
||||
static int borderpx = 0;
|
||||
float alpha = 0.7;
|
||||
static int borderpx = 2;
|
||||
float alpha = 0.95;
|
||||
|
||||
/* Lines to move per scroll */
|
||||
const unsigned int mousescrollincrement = 5;
|
||||
|
|
@ -151,7 +151,7 @@ static const char *altcolorname[] = {
|
|||
*/
|
||||
unsigned int defaultfg = 12;
|
||||
unsigned int defaultbg = 8;
|
||||
unsigned int defaultcs = 14;
|
||||
static unsigned int defaultcs = 14;
|
||||
static unsigned int defaultrcs = 15;
|
||||
|
||||
/*
|
||||
|
|
|
|||
10
config.mk
10
config.mk
|
|
@ -1,5 +1,5 @@
|
|||
# st version
|
||||
VERSION = 0.9.2
|
||||
VERSION = 0.8.4
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
|
@ -24,16 +24,14 @@ LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
|
|||
|
||||
# flags
|
||||
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
|
||||
CFLAGS = -O1
|
||||
STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
STLDFLAGS = $(LIBS) $(LDFLAGS)
|
||||
STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS)
|
||||
STLDFLAGS = $(LIBS) $(LDFLAGS)
|
||||
|
||||
# OpenBSD:
|
||||
#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
|
||||
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
|
||||
# `$(PKG_CONFIG) --libs fontconfig` \
|
||||
# `$(PKG_CONFIG) --libs freetype2`
|
||||
#MANPREFIX = ${PREFIX}/man
|
||||
|
||||
# compiler and linker
|
||||
CC = cc
|
||||
# CC = c99
|
||||
|
|
|
|||
169
st.c
169
st.c
|
|
@ -168,7 +168,6 @@ static void csidump(void);
|
|||
static void csihandle(void);
|
||||
static void csiparse(void);
|
||||
static void csireset(void);
|
||||
static void osc_color_response(int, int, int);
|
||||
static int eschandle(uchar);
|
||||
static void strdump(void);
|
||||
static void strhandle(void);
|
||||
|
|
@ -194,18 +193,18 @@ static void tputc(Rune);
|
|||
static void treset(void);
|
||||
static void tscrollup(int, int, int);
|
||||
static void tscrolldown(int, int, int);
|
||||
static void tsetattr(const int *, int);
|
||||
static void tsetchar(Rune, const Glyph *, int, int);
|
||||
static void tsetattr(int *, int);
|
||||
static void tsetchar(Rune, Glyph *, int, int);
|
||||
static void tsetdirt(int, int);
|
||||
static void tsetscroll(int, int);
|
||||
static void tswapscreen(void);
|
||||
static void tsetmode(int, int, const int *, int);
|
||||
static void tsetmode(int, int, int *, int);
|
||||
static int twrite(const char *, int, int);
|
||||
static void tfulldirt(void);
|
||||
static void tcontrolcode(uchar );
|
||||
static void tdectest(char );
|
||||
static void tdefutf8(char);
|
||||
static int32_t tdefcolor(const int *, int *, int);
|
||||
static int32_t tdefcolor(int *, int *, int);
|
||||
static void tdeftran(char);
|
||||
static void tstrsequence(uchar);
|
||||
|
||||
|
|
@ -234,10 +233,10 @@ static int iofd = 1;
|
|||
static int cmdfd;
|
||||
static pid_t pid;
|
||||
|
||||
static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
||||
static const uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
||||
static const Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
||||
static const Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
||||
static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0};
|
||||
static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
|
||||
static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
|
||||
static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
|
||||
|
||||
ssize_t
|
||||
xwrite(int fd, const char *s, size_t len)
|
||||
|
|
@ -277,14 +276,12 @@ xrealloc(void *p, size_t len)
|
|||
}
|
||||
|
||||
char *
|
||||
xstrdup(const char *s)
|
||||
xstrdup(char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if ((p = strdup(s)) == NULL)
|
||||
if ((s = strdup(s)) == NULL)
|
||||
die("strdup: %s\n", strerror(errno));
|
||||
|
||||
return p;
|
||||
return s;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
@ -357,10 +354,25 @@ utf8validate(Rune *u, size_t i)
|
|||
return i;
|
||||
}
|
||||
|
||||
static const char base64_digits[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0,
|
||||
63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, -1, 0, 0, 0, 0, 1,
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
char
|
||||
base64dec_getc(const char **src)
|
||||
{
|
||||
while (**src && !isprint((unsigned char)**src))
|
||||
while (**src && !isprint(**src))
|
||||
(*src)++;
|
||||
return **src ? *((*src)++) : '='; /* emulate padding if string ends */
|
||||
}
|
||||
|
|
@ -370,13 +382,6 @@ base64dec(const char *src)
|
|||
{
|
||||
size_t in_len = strlen(src);
|
||||
char *result, *dst;
|
||||
static const char base64_digits[256] = {
|
||||
[43] = 62, 0, 0, 0, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
|
||||
0, 0, 0, -1, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0,
|
||||
0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
|
||||
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
|
||||
};
|
||||
|
||||
if (in_len % 4)
|
||||
in_len += 4 - (in_len % 4);
|
||||
|
|
@ -520,7 +525,7 @@ selsnap(int *x, int *y, int direction)
|
|||
{
|
||||
int newx, newy, xt, yt;
|
||||
int delim, prevdelim;
|
||||
const Glyph *gp, *prevgp;
|
||||
Glyph *gp, *prevgp;
|
||||
|
||||
switch (sel.snap) {
|
||||
case SNAP_WORD:
|
||||
|
|
@ -593,7 +598,7 @@ getsel(void)
|
|||
{
|
||||
char *str, *ptr;
|
||||
int y, bufsize, lastx, linelen;
|
||||
const Glyph *gp, *last;
|
||||
Glyph *gp, *last;
|
||||
|
||||
if (sel.ob.x == -1)
|
||||
return NULL;
|
||||
|
|
@ -760,7 +765,7 @@ stty(char **args)
|
|||
}
|
||||
|
||||
int
|
||||
ttynew(const char *line, char *cmd, const char *out, char **args)
|
||||
ttynew(char *line, char *cmd, char *out, char **args)
|
||||
{
|
||||
int m, s;
|
||||
|
||||
|
|
@ -793,15 +798,14 @@ ttynew(const char *line, char *cmd, const char *out, char **args)
|
|||
break;
|
||||
case 0:
|
||||
close(iofd);
|
||||
close(m);
|
||||
setsid(); /* create a new process group */
|
||||
dup2(s, 0);
|
||||
dup2(s, 1);
|
||||
dup2(s, 2);
|
||||
if (ioctl(s, TIOCSCTTY, NULL) < 0)
|
||||
die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
|
||||
if (s > 2)
|
||||
close(s);
|
||||
close(s);
|
||||
close(m);
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio getpw proc exec", NULL) == -1)
|
||||
die("pledge\n");
|
||||
|
|
@ -949,7 +953,7 @@ ttyresize(int tw, int th)
|
|||
}
|
||||
|
||||
void
|
||||
ttyhangup(void)
|
||||
ttyhangup()
|
||||
{
|
||||
/* Send SIGHUP to shell */
|
||||
kill(pid, SIGHUP);
|
||||
|
|
@ -1249,9 +1253,9 @@ tmoveto(int x, int y)
|
|||
}
|
||||
|
||||
void
|
||||
tsetchar(Rune u, const Glyph *attr, int x, int y)
|
||||
tsetchar(Rune u, Glyph *attr, int x, int y)
|
||||
{
|
||||
static const char *vt100_0[62] = { /* 0x41 - 0x7e */
|
||||
static char *vt100_0[62] = { /* 0x41 - 0x7e */
|
||||
"↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
|
||||
0, 0, 0, 0, 0, 0, 0, 0, /* P - W */
|
||||
|
|
@ -1366,7 +1370,7 @@ tdeleteline(int n)
|
|||
}
|
||||
|
||||
int32_t
|
||||
tdefcolor(const int *attr, int *npar, int l)
|
||||
tdefcolor(int *attr, int *npar, int l)
|
||||
{
|
||||
int32_t idx = -1;
|
||||
uint r, g, b;
|
||||
|
|
@ -1416,7 +1420,7 @@ tdefcolor(const int *attr, int *npar, int l)
|
|||
}
|
||||
|
||||
void
|
||||
tsetattr(const int *attr, int l)
|
||||
tsetattr(int *attr, int l)
|
||||
{
|
||||
int i;
|
||||
int32_t idx;
|
||||
|
|
@ -1534,9 +1538,9 @@ tsetscroll(int t, int b)
|
|||
}
|
||||
|
||||
void
|
||||
tsetmode(int priv, int set, const int *args, int narg)
|
||||
tsetmode(int priv, int set, int *args, int narg)
|
||||
{
|
||||
int alt; const int *lim;
|
||||
int alt, *lim;
|
||||
|
||||
for (lim = args + narg; args < lim; ++args) {
|
||||
if (priv) {
|
||||
|
|
@ -1839,18 +1843,11 @@ csihandle(void)
|
|||
case 'm': /* SGR -- Terminal attribute (color) */
|
||||
tsetattr(csiescseq.arg, csiescseq.narg);
|
||||
break;
|
||||
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" */
|
||||
case 'n': /* DSR – Device Status Report (cursor position) */
|
||||
if (csiescseq.arg[0] == 6) {
|
||||
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 */
|
||||
|
|
@ -1912,41 +1909,11 @@ csireset(void)
|
|||
memset(&csiescseq, 0, sizeof(csiescseq));
|
||||
}
|
||||
|
||||
void
|
||||
osc_color_response(int num, int index, int is_osc4)
|
||||
{
|
||||
int n;
|
||||
char buf[32];
|
||||
unsigned char r, g, b;
|
||||
|
||||
if (xgetcolor(is_osc4 ? num : index, &r, &g, &b)) {
|
||||
fprintf(stderr, "erresc: failed to fetch %s color %d\n",
|
||||
is_osc4 ? "osc4" : "osc",
|
||||
is_osc4 ? num : index);
|
||||
return;
|
||||
}
|
||||
|
||||
n = snprintf(buf, sizeof buf, "\033]%s%d;rgb:%02x%02x/%02x%02x/%02x%02x\007",
|
||||
is_osc4 ? "4;" : "", num, r, r, g, g, b, b);
|
||||
if (n < 0 || n >= sizeof(buf)) {
|
||||
fprintf(stderr, "error: %s while printing %s response\n",
|
||||
n < 0 ? "snprintf failed" : "truncation occurred",
|
||||
is_osc4 ? "osc4" : "osc");
|
||||
} else {
|
||||
ttywrite(buf, n, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
strhandle(void)
|
||||
{
|
||||
char *p = NULL, *dec;
|
||||
int j, narg, par;
|
||||
const struct { int idx; char *str; } osc_table[] = {
|
||||
{ defaultfg, "foreground" },
|
||||
{ defaultbg, "background" },
|
||||
{ defaultcs, "cursor" }
|
||||
};
|
||||
|
||||
term.esc &= ~(ESC_STR_END|ESC_STR);
|
||||
strparse();
|
||||
|
|
@ -1956,15 +1923,7 @@ strhandle(void)
|
|||
case ']': /* OSC -- Operating System Command */
|
||||
switch (par) {
|
||||
case 0:
|
||||
if (narg > 1) {
|
||||
xsettitle(strescseq.args[1]);
|
||||
xseticontitle(strescseq.args[1]);
|
||||
}
|
||||
return;
|
||||
case 1:
|
||||
if (narg > 1)
|
||||
xseticontitle(strescseq.args[1]);
|
||||
return;
|
||||
case 2:
|
||||
if (narg > 1)
|
||||
xsettitle(strescseq.args[1]);
|
||||
|
|
@ -1980,39 +1939,16 @@ strhandle(void)
|
|||
}
|
||||
}
|
||||
return;
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
if (narg < 2)
|
||||
break;
|
||||
p = strescseq.args[1];
|
||||
if ((j = par - 10) < 0 || j >= LEN(osc_table))
|
||||
break; /* shouldn't be possible */
|
||||
|
||||
if (!strcmp(p, "?")) {
|
||||
osc_color_response(par, osc_table[j].idx, 0);
|
||||
} else if (xsetcolorname(osc_table[j].idx, p)) {
|
||||
fprintf(stderr, "erresc: invalid %s color: %s\n",
|
||||
osc_table[j].str, p);
|
||||
} else {
|
||||
tfulldirt();
|
||||
}
|
||||
return;
|
||||
case 4: /* color set */
|
||||
if (narg < 3)
|
||||
break;
|
||||
p = strescseq.args[2];
|
||||
/* FALLTHROUGH */
|
||||
case 104: /* color reset */
|
||||
case 104: /* color reset, here p = NULL */
|
||||
j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
|
||||
|
||||
if (p && !strcmp(p, "?")) {
|
||||
osc_color_response(j, 0, 1);
|
||||
} else if (xsetcolorname(j, p)) {
|
||||
if (par == 104 && narg <= 1) {
|
||||
xloadcols();
|
||||
if (xsetcolorname(j, p)) {
|
||||
if (par == 104 && narg <= 1)
|
||||
return; /* color reset without parameter */
|
||||
}
|
||||
fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
|
||||
j, p ? p : "(null)");
|
||||
} else {
|
||||
|
|
@ -2020,7 +1956,7 @@ strhandle(void)
|
|||
* TODO if defaultbg color is changed, borders
|
||||
* are dirty
|
||||
*/
|
||||
tfulldirt();
|
||||
redraw();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -2146,7 +2082,7 @@ void
|
|||
tdumpline(int n)
|
||||
{
|
||||
char buf[UTF_SIZ];
|
||||
const Glyph *bp, *end;
|
||||
Glyph *bp, *end;
|
||||
|
||||
bp = &term.line[n][0];
|
||||
end = &bp[MIN(tlinelen(n), term.col) - 1];
|
||||
|
|
@ -2492,9 +2428,6 @@ 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
|
||||
|
|
@ -2541,10 +2474,8 @@ 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);
|
||||
|
|
@ -2557,10 +2488,6 @@ check_control_code:
|
|||
if (width == 2) {
|
||||
gp->mode |= ATTR_WIDE;
|
||||
if (term.c.x+1 < term.col) {
|
||||
if (gp[1].mode == ATTR_WIDE && term.c.x+2 < term.col) {
|
||||
gp[2].u = ' ';
|
||||
gp[2].mode &= ~ATTR_WDUMMY;
|
||||
}
|
||||
gp[1].u = '\0';
|
||||
gp[1].mode = ATTR_WDUMMY;
|
||||
}
|
||||
|
|
|
|||
5
st.h
5
st.h
|
|
@ -97,7 +97,7 @@ void tnew(int, int);
|
|||
void tresize(int, int);
|
||||
void tsetdirtattr(int);
|
||||
void ttyhangup(void);
|
||||
int ttynew(const char *, char *, const char *, char **);
|
||||
int ttynew(char *, char *, char *, char **);
|
||||
size_t ttyread(void);
|
||||
void ttyresize(int, int);
|
||||
void ttywrite(const char *, size_t, int);
|
||||
|
|
@ -115,7 +115,7 @@ size_t utf8encode(Rune, char *);
|
|||
|
||||
void *xmalloc(size_t);
|
||||
void *xrealloc(void *, size_t);
|
||||
char *xstrdup(const char *);
|
||||
char *xstrdup(char *);
|
||||
|
||||
int isboxdraw(Rune);
|
||||
ushort boxdrawindex(const Glyph *);
|
||||
|
|
@ -140,4 +140,3 @@ extern unsigned int defaultfg;
|
|||
extern unsigned int defaultbg;
|
||||
extern const int boxdraw, boxdraw_bold, boxdraw_braille;
|
||||
extern float alpha;
|
||||
extern unsigned int defaultcs;
|
||||
|
|
|
|||
2
win.h
2
win.h
|
|
@ -30,8 +30,6 @@ void xdrawline(Line, int, int, int);
|
|||
void xfinishdraw(void);
|
||||
void xloadcols(void);
|
||||
int xsetcolorname(int, const char *);
|
||||
int xgetcolor(int, unsigned char *, unsigned char *, unsigned char *);
|
||||
void xseticontitle(char *);
|
||||
void xsettitle(char *);
|
||||
int xsetcursor(int);
|
||||
void xsetmode(int, unsigned int);
|
||||
|
|
|
|||
Loading…
Reference in New Issue