Compare commits
No commits in common. "26adaa667aed344a705ec1cb0111ed003b205c6c" and "baa9357e96d2478baa52a3301e70ac80a229b726" have entirely different histories.
26adaa667a
...
baa9357e96
23 changed files with 507 additions and 1604 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,5 +0,0 @@
|
||||||
patches/
|
|
||||||
.gitignore
|
|
||||||
*.o
|
|
||||||
st
|
|
||||||
*.orig
|
|
250
FAQ
Normal file
250
FAQ
Normal file
|
@ -0,0 +1,250 @@
|
||||||
|
## Why does st not handle utmp entries?
|
||||||
|
|
||||||
|
Use the excellent tool of [utmp](https://git.suckless.org/utmp/) for this task.
|
||||||
|
|
||||||
|
|
||||||
|
## Some _random program_ complains that st is unknown/not recognised/unsupported/whatever!
|
||||||
|
|
||||||
|
It means that st doesn’t have any terminfo entry on your system. Chances are
|
||||||
|
you did not `make install`. If you just want to test it without installing it,
|
||||||
|
you can manually run `tic -sx st.info`.
|
||||||
|
|
||||||
|
|
||||||
|
## Nothing works, and nothing is said about an unknown terminal!
|
||||||
|
|
||||||
|
* Some programs just assume they’re running in xterm i.e. they don’t rely on
|
||||||
|
terminfo. What you see is the current state of the “xterm compliance”.
|
||||||
|
* Some programs don’t complain about the lacking st description and default to
|
||||||
|
another terminal. In that case see the question about terminfo.
|
||||||
|
|
||||||
|
|
||||||
|
## How do I scroll back up?
|
||||||
|
|
||||||
|
* Using a terminal multiplexer.
|
||||||
|
* `st -e tmux` using C-b [
|
||||||
|
* `st -e screen` using C-a ESC
|
||||||
|
* Using the excellent tool of [scroll](https://git.suckless.org/scroll/).
|
||||||
|
* Using the scrollback [patch](https://st.suckless.org/patches/scrollback/).
|
||||||
|
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
|
||||||
|
## Why doesn't the Del key work in some programs?
|
||||||
|
|
||||||
|
Taken from the terminfo manpage:
|
||||||
|
|
||||||
|
If the terminal has a keypad that transmits codes when the keys
|
||||||
|
are pressed, this information can be given. Note that it is not
|
||||||
|
possible to handle terminals where the keypad only works in
|
||||||
|
local (this applies, for example, to the unshifted HP 2621 keys).
|
||||||
|
If the keypad can be set to transmit or not transmit, give these
|
||||||
|
codes as smkx and rmkx. Otherwise the keypad is assumed to
|
||||||
|
always transmit.
|
||||||
|
|
||||||
|
In the st case smkx=E[?1hE= and rmkx=E[?1lE>, so it is mandatory that
|
||||||
|
applications which want to test against keypad keys send these
|
||||||
|
sequences.
|
||||||
|
|
||||||
|
But buggy applications (like bash and irssi, for example) don't do this. A fast
|
||||||
|
solution for them is to use the following command:
|
||||||
|
|
||||||
|
$ printf '\033[?1h\033=' >/dev/tty
|
||||||
|
|
||||||
|
or
|
||||||
|
$ tput smkx
|
||||||
|
|
||||||
|
In the case of bash, readline is used. Readline has a different note in its
|
||||||
|
manpage about this issue:
|
||||||
|
|
||||||
|
enable-keypad (Off)
|
||||||
|
When set to On, readline will try to enable the
|
||||||
|
application keypad when it is called. Some systems
|
||||||
|
need this to enable arrow keys.
|
||||||
|
|
||||||
|
Adding this option to your .inputrc will fix the keypad problem for all
|
||||||
|
applications using readline.
|
||||||
|
|
||||||
|
If you are using zsh, then read the zsh FAQ
|
||||||
|
<http://zsh.sourceforge.net/FAQ/zshfaq03.html#l25>:
|
||||||
|
|
||||||
|
It should be noted that the O / [ confusion can occur with other keys
|
||||||
|
such as Home and End. Some systems let you query the key sequences
|
||||||
|
sent by these keys from the system's terminal database, terminfo.
|
||||||
|
Unfortunately, the key sequences given there typically apply to the
|
||||||
|
mode that is not the one zsh uses by default (it's the "application"
|
||||||
|
mode rather than the "raw" mode). Explaining the use of terminfo is
|
||||||
|
outside of the scope of this FAQ, but if you wish to use the key
|
||||||
|
sequences given there you can tell the line editor to turn on
|
||||||
|
"application" mode when it starts and turn it off when it stops:
|
||||||
|
|
||||||
|
function zle-line-init () { echoti smkx }
|
||||||
|
function zle-line-finish () { echoti rmkx }
|
||||||
|
zle -N zle-line-init
|
||||||
|
zle -N zle-line-finish
|
||||||
|
|
||||||
|
Putting these lines into your .zshrc will fix the problems.
|
||||||
|
|
||||||
|
|
||||||
|
## How can I use meta in 8bit mode?
|
||||||
|
|
||||||
|
St supports meta in 8bit mode, but the default terminfo entry doesn't
|
||||||
|
use this capability. If you want it, you have to use the 'st-meta' value
|
||||||
|
in TERM.
|
||||||
|
|
||||||
|
|
||||||
|
## I cannot compile st in OpenBSD
|
||||||
|
|
||||||
|
OpenBSD lacks librt, despite it being mandatory in POSIX
|
||||||
|
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tag_20_11_13>.
|
||||||
|
If you want to compile st for OpenBSD you have to remove -lrt from config.mk, and
|
||||||
|
st will compile without any loss of functionality, because all the functions are
|
||||||
|
included in libc on this platform.
|
||||||
|
|
||||||
|
|
||||||
|
## The Backspace Case
|
||||||
|
|
||||||
|
St is emulating the Linux way of handling backspace being delete and delete being
|
||||||
|
backspace.
|
||||||
|
|
||||||
|
This is an issue that was discussed in suckless mailing list
|
||||||
|
<https://lists.suckless.org/dev/1404/20697.html>. Here is why some old grumpy
|
||||||
|
terminal users wants its backspace to be how he feels it:
|
||||||
|
|
||||||
|
Well, I am going to comment why I want to change the behaviour
|
||||||
|
of this key. When ASCII was defined in 1968, communication
|
||||||
|
with computers was done using punched cards, or hardcopy
|
||||||
|
terminals (basically a typewriter machine connected with the
|
||||||
|
computer using a serial port). ASCII defines DELETE as 7F,
|
||||||
|
because, in punched-card terms, it means all the holes of the
|
||||||
|
card punched; it is thus a kind of 'physical delete'. In the
|
||||||
|
same way, the BACKSPACE key was a non-destructive backspace,
|
||||||
|
as on a typewriter. So, if you wanted to delete a character,
|
||||||
|
you had to BACKSPACE and then DELETE. Another use of BACKSPACE
|
||||||
|
was to type accented characters, for example 'a BACKSPACE `'.
|
||||||
|
The VT100 had no BACKSPACE key; it was generated using the
|
||||||
|
CONTROL key as another control character (CONTROL key sets to
|
||||||
|
0 b7 b6 b5, so it converts H (code 0x48) into BACKSPACE (code
|
||||||
|
0x08)), but it had a DELETE key in a similar position where
|
||||||
|
the BACKSPACE key is located today on common PC keyboards.
|
||||||
|
All the terminal emulators emulated the difference between
|
||||||
|
these keys correctly: the backspace key generated a BACKSPACE
|
||||||
|
(^H) and delete key generated a DELETE (^?).
|
||||||
|
|
||||||
|
But a problem arose when Linus Torvalds wrote Linux. Unlike
|
||||||
|
earlier terminals, the Linux virtual terminal (the terminal
|
||||||
|
emulator integrated in the kernel) returned a DELETE when
|
||||||
|
backspace was pressed, due to the VT100 having a DELETE key in
|
||||||
|
the same position. This created a lot of problems (see [1]
|
||||||
|
and [2]). Since Linux has become the king, a lot of terminal
|
||||||
|
emulators today generate a DELETE when the backspace key is
|
||||||
|
pressed in order to avoid problems with Linux. The result is
|
||||||
|
that the only way of generating a BACKSPACE on these systems
|
||||||
|
is by using CONTROL + H. (I also think that emacs had an
|
||||||
|
important point here because the CONTROL + H prefix is used
|
||||||
|
in emacs in some commands (help commands).)
|
||||||
|
|
||||||
|
From point of view of the kernel, you can change the key
|
||||||
|
for deleting a previous character with stty erase. When you
|
||||||
|
connect a real terminal into a machine you describe the type
|
||||||
|
of terminal, so getty configures the correct value of stty
|
||||||
|
erase for this terminal. In the case of terminal emulators,
|
||||||
|
however, you don't have any getty that can set the correct
|
||||||
|
value of stty erase, so you always get the default value.
|
||||||
|
For this reason, it is necessary to add 'stty erase ^H' to your
|
||||||
|
profile if you have changed the value of the backspace key.
|
||||||
|
Of course, another solution is for st itself to modify the
|
||||||
|
value of stty erase. I usually have the inverse problem:
|
||||||
|
when I connect to non-Unix machines, I have to press CONTROL +
|
||||||
|
h to get a BACKSPACE. The inverse problem occurs when a user
|
||||||
|
connects to my Unix machines from a different system with a
|
||||||
|
correct backspace key.
|
||||||
|
|
||||||
|
[1] http://www.ibb.net/~anne/keyboard.html
|
||||||
|
[2] http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html
|
||||||
|
|
||||||
|
|
||||||
|
## But I really want the old grumpy behaviour of my terminal
|
||||||
|
|
||||||
|
Apply [1].
|
||||||
|
|
||||||
|
[1] https://st.suckless.org/patches/delkey
|
||||||
|
|
||||||
|
|
||||||
|
## Why do images not work in st using the w3m image hack?
|
||||||
|
|
||||||
|
w3mimg uses a hack that draws an image on top of the terminal emulator Drawable
|
||||||
|
window. The hack relies on the terminal to use a single buffer to draw its
|
||||||
|
contents directly.
|
||||||
|
|
||||||
|
st uses double-buffered drawing so the image is quickly replaced and may show a
|
||||||
|
short flicker effect.
|
||||||
|
|
||||||
|
Below is a patch example to change st double-buffering to a single Drawable
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
diff --git a/x.c b/x.c
|
||||||
|
--- a/x.c
|
||||||
|
+++ b/x.c
|
||||||
|
@@ -732,10 +732,6 @@ xresize(int col, int row)
|
||||||
|
win.tw = col * win.cw;
|
||||||
|
win.th = row * win.ch;
|
||||||
|
|
||||||
|
- XFreePixmap(xw.dpy, xw.buf);
|
||||||
|
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
|
- DefaultDepth(xw.dpy, xw.scr));
|
||||||
|
- XftDrawChange(xw.draw, xw.buf);
|
||||||
|
xclear(0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
/* resize to new width */
|
||||||
|
@@ -1148,8 +1144,7 @@ xinit(int cols, int rows)
|
||||||
|
gcvalues.graphics_exposures = False;
|
||||||
|
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||||
|
&gcvalues);
|
||||||
|
- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
|
- DefaultDepth(xw.dpy, xw.scr));
|
||||||
|
+ xw.buf = xw.win;
|
||||||
|
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||||
|
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
@@ -1632,8 +1627,6 @@ xdrawline(Line line, int x1, int y1, int x2)
|
||||||
|
void
|
||||||
|
xfinishdraw(void)
|
||||||
|
{
|
||||||
|
- XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w,
|
||||||
|
- win.h, 0, 0);
|
||||||
|
XSetForeground(xw.dpy, dc.gc,
|
||||||
|
dc.col[IS_SET(MODE_REVERSE)?
|
||||||
|
defaultfg : defaultbg].pixel);
|
||||||
|
|
||||||
|
|
||||||
|
## BadLength X error in Xft when trying to render emoji
|
||||||
|
|
||||||
|
Xft makes st crash when rendering color emojis with the following error:
|
||||||
|
|
||||||
|
"X Error of failed request: BadLength (poly request too large or internal Xlib length error)"
|
||||||
|
Major opcode of failed request: 139 (RENDER)
|
||||||
|
Minor opcode of failed request: 20 (RenderAddGlyphs)
|
||||||
|
Serial number of failed request: 1595
|
||||||
|
Current serial number in output stream: 1818"
|
||||||
|
|
||||||
|
This is a known bug in Xft (not st) which happens on some platforms and
|
||||||
|
combination of particular fonts and fontconfig settings.
|
||||||
|
|
||||||
|
See also:
|
||||||
|
https://gitlab.freedesktop.org/xorg/lib/libxft/issues/6
|
||||||
|
https://bugs.freedesktop.org/show_bug.cgi?id=107534
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
||||||
|
|
||||||
|
The solution is to remove color emoji fonts or disable this in the fontconfig
|
||||||
|
XML configuration. As an ugly workaround (which may work only on newer
|
||||||
|
fontconfig versions (FC_COLOR)), the following code can be used to mask color
|
||||||
|
fonts:
|
||||||
|
|
||||||
|
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
||||||
|
|
||||||
|
Please don't bother reporting this bug to st, but notify the upstream Xft
|
||||||
|
developers about fixing this bug.
|
|
@ -1,2 +0,0 @@
|
||||||
custom: ["https://lukesmith.xyz/donate.html"]
|
|
||||||
github: lukesmithxyz
|
|
17
LEGACY
Normal file
17
LEGACY
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
A STATEMENT ON LEGACY SUPPORT
|
||||||
|
|
||||||
|
In the terminal world there is much cruft that comes from old and unsup‐
|
||||||
|
ported terminals that inherit incompatible modes and escape sequences
|
||||||
|
which noone is able to know, except when he/she comes from that time and
|
||||||
|
developed a graphical vt100 emulator at that time.
|
||||||
|
|
||||||
|
One goal of st is to only support what is really needed. When you en‐
|
||||||
|
counter a sequence which you really need, implement it. But while you
|
||||||
|
are at it, do not add the other cruft you might encounter while sneek‐
|
||||||
|
ing at other terminal emulators. History has bloated them and there is
|
||||||
|
no real evidence that most of the sequences are used today.
|
||||||
|
|
||||||
|
|
||||||
|
Christoph Lohmann <20h@r-36.net>
|
||||||
|
2012-09-13T07:00:36.081271045+02:00
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
SRC = st.c x.c boxdraw.c hb.c
|
SRC = st.c x.c
|
||||||
OBJ = $(SRC:.c=.o)
|
OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
all: options st
|
all: options st
|
||||||
|
@ -15,13 +15,14 @@ options:
|
||||||
@echo "LDFLAGS = $(STLDFLAGS)"
|
@echo "LDFLAGS = $(STLDFLAGS)"
|
||||||
@echo "CC = $(CC)"
|
@echo "CC = $(CC)"
|
||||||
|
|
||||||
|
config.h:
|
||||||
|
cp config.def.h config.h
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(STCFLAGS) -c $<
|
$(CC) $(STCFLAGS) -c $<
|
||||||
|
|
||||||
st.o: config.h st.h win.h
|
st.o: config.h st.h win.h
|
||||||
x.o: arg.h config.h st.h win.h hb.h
|
x.o: arg.h config.h st.h win.h
|
||||||
hb.o: st.h
|
|
||||||
boxdraw.o: config.h st.h boxdraw_data.h
|
|
||||||
|
|
||||||
$(OBJ): config.h config.mk
|
$(OBJ): config.h config.mk
|
||||||
|
|
||||||
|
@ -29,12 +30,12 @@ st: $(OBJ)
|
||||||
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
|
$(CC) -o $@ $(OBJ) $(STLDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f st $(OBJ) st-$(VERSION).tar.gz *.rej *.orig *.o
|
rm -f st $(OBJ) st-$(VERSION).tar.gz
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p st-$(VERSION)
|
mkdir -p st-$(VERSION)
|
||||||
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
|
cp -R FAQ LEGACY TODO LICENSE Makefile README config.mk\
|
||||||
config.h st.info st.1 arg.h st.h win.h $(SRC)\
|
config.def.h st.info st.1 arg.h st.h win.h $(SRC)\
|
||||||
st-$(VERSION)
|
st-$(VERSION)
|
||||||
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
tar -cf - st-$(VERSION) | gzip > st-$(VERSION).tar.gz
|
||||||
rm -rf st-$(VERSION)
|
rm -rf st-$(VERSION)
|
||||||
|
@ -42,11 +43,7 @@ dist: clean
|
||||||
install: st
|
install: st
|
||||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f st $(DESTDIR)$(PREFIX)/bin
|
cp -f st $(DESTDIR)$(PREFIX)/bin
|
||||||
cp -f st-copyout $(DESTDIR)$(PREFIX)/bin
|
|
||||||
cp -f st-urlhandler $(DESTDIR)$(PREFIX)/bin
|
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
chmod 755 $(DESTDIR)$(PREFIX)/bin/st
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-copyout
|
|
||||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-urlhandler
|
|
||||||
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
||||||
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
sed "s/VERSION/$(VERSION)/g" < st.1 > $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
|
@ -55,8 +52,6 @@ install: st
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
rm -f $(DESTDIR)$(PREFIX)/bin/st
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st-copyout
|
|
||||||
rm -f $(DESTDIR)$(PREFIX)/bin/st-urlhandler
|
|
||||||
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
.PHONY: all options clean dist install uninstall
|
||||||
|
|
45
PKGBUILD
45
PKGBUILD
|
@ -1,45 +0,0 @@
|
||||||
# Maintainer:
|
|
||||||
|
|
||||||
pkgname=st-luke-git
|
|
||||||
_pkgname=st
|
|
||||||
pkgver=0.8.2.r1062.2087ab9
|
|
||||||
pkgrel=1
|
|
||||||
epoch=1
|
|
||||||
pkgdesc="Luke's simple (suckless) terminal with vim-bindings, transparency, xresources, etc. "
|
|
||||||
url='https://github.com/LukeSmithxyz/st'
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
license=('MIT')
|
|
||||||
options=('zipman')
|
|
||||||
depends=('libxft')
|
|
||||||
makedepends=('ncurses' 'libxext' 'git')
|
|
||||||
optdepends=('dmenu: feed urls to dmenu')
|
|
||||||
source=(git+https://github.com/LukeSmithxyz/st)
|
|
||||||
sha1sums=('SKIP')
|
|
||||||
|
|
||||||
provides=("${_pkgname}")
|
|
||||||
conflicts=("${_pkgname}")
|
|
||||||
|
|
||||||
pkgver() {
|
|
||||||
cd "${_pkgname}"
|
|
||||||
printf "%s.r%s.%s" "$(awk '/^VERSION =/ {print $3}' config.mk)" \
|
|
||||||
"$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
|
|
||||||
}
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
cd $srcdir/${_pkgname}
|
|
||||||
# skip terminfo which conflicts with ncurses
|
|
||||||
sed -i '/tic /d' Makefile
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "${_pkgname}"
|
|
||||||
make X11INC=/usr/include/X11 X11LIB=/usr/lib/X11
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${_pkgname}"
|
|
||||||
make PREFIX=/usr DESTDIR="${pkgdir}" install
|
|
||||||
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
|
||||||
install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
|
|
||||||
install -Dm644 Xdefaults "${pkgdir}/usr/share/doc/${pkgname}/Xdefaults.example"
|
|
||||||
}
|
|
34
README
Normal file
34
README
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
st - simple terminal
|
||||||
|
--------------------
|
||||||
|
st is a simple terminal emulator for X which sucks less.
|
||||||
|
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
In order to build st you need the Xlib header files.
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
Edit config.mk to match your local setup (st is installed into
|
||||||
|
the /usr/local namespace by default).
|
||||||
|
|
||||||
|
Afterwards enter the following command to build and install st (if
|
||||||
|
necessary as root):
|
||||||
|
|
||||||
|
make clean install
|
||||||
|
|
||||||
|
|
||||||
|
Running st
|
||||||
|
----------
|
||||||
|
If you did not install st with make clean install, you must compile
|
||||||
|
the st terminfo entry with the following command:
|
||||||
|
|
||||||
|
tic -sx st.info
|
||||||
|
|
||||||
|
See the man page for additional details.
|
||||||
|
|
||||||
|
Credits
|
||||||
|
-------
|
||||||
|
Based on Aurélien APTEL <aurelien dot aptel at gmail dot com> bt source code.
|
||||||
|
|
89
README.md
89
README.md
|
@ -1,89 +0,0 @@
|
||||||
# Luke's build of st - the simple (suckless) terminal
|
|
||||||
|
|
||||||
The [suckless terminal (st)](https://st.suckless.org/) with some additional
|
|
||||||
features that make it literally the best terminal emulator ever:
|
|
||||||
|
|
||||||
## Unique features (using dmenu)
|
|
||||||
|
|
||||||
+ **follow urls** by pressing `alt-l`
|
|
||||||
+ **copy urls** in the same way with `alt-y`
|
|
||||||
+ **copy the output of commands** with `alt-o`
|
|
||||||
|
|
||||||
## Bindings for
|
|
||||||
|
|
||||||
+ **scrollback** with `alt-↑/↓` or `alt-pageup/down` or `shift` while scrolling the
|
|
||||||
mouse.
|
|
||||||
+ OR **vim-bindings**: scroll up/down in history with `alt-k` and `alt-j`.
|
|
||||||
Faster with `alt-u`/`alt-d`.
|
|
||||||
+ **zoom/change font size**: same bindings as above, but holding down shift as
|
|
||||||
well. `alt-home` returns to default
|
|
||||||
+ **copy text** with `alt-c`, **paste** is `alt-v` or `shift-insert`
|
|
||||||
|
|
||||||
## Pretty stuff
|
|
||||||
|
|
||||||
+ Compatibility with `Xresources` and `pywal` for dynamic colors.
|
|
||||||
+ Default [gruvbox](https://github.com/morhetz/gruvbox) colors otherwise.
|
|
||||||
+ Transparency/alpha, which is also adjustable from your `Xresources`.
|
|
||||||
+ Default font is system "mono" at 14pt, meaning the font will match your
|
|
||||||
system font.
|
|
||||||
|
|
||||||
## Other st patches
|
|
||||||
|
|
||||||
+ Boxdraw
|
|
||||||
+ Ligatures
|
|
||||||
+ font2
|
|
||||||
+ updated to latest version 0.8.5
|
|
||||||
|
|
||||||
## Installation for newbs
|
|
||||||
|
|
||||||
You should have xlib header files and libharfbuzz build files installed.
|
|
||||||
|
|
||||||
```
|
|
||||||
git clone https://github.com/LukeSmithxyz/st
|
|
||||||
cd st
|
|
||||||
sudo make install
|
|
||||||
```
|
|
||||||
|
|
||||||
Obviously, `make` is required to build. `fontconfig` is required for the
|
|
||||||
default build, since it asks `fontconfig` for your system monospace font. It
|
|
||||||
might be obvious, but `libX11` and `libXft` are required as well. Chances are,
|
|
||||||
you have all of this installed already.
|
|
||||||
|
|
||||||
On OpenBSD, be sure to edit `config.mk` first and remove `-lrt` from the
|
|
||||||
`$LIBS` before compiling.
|
|
||||||
|
|
||||||
Be sure to have a composite manager (`xcompmgr`, `picom`, etc.) running if you
|
|
||||||
want transparency.
|
|
||||||
|
|
||||||
## How to configure dynamically with Xresources
|
|
||||||
|
|
||||||
For many key variables, this build of `st` will look for X settings set in
|
|
||||||
either `~/.Xdefaults` or `~/.Xresources`. You must run `xrdb` on one of these
|
|
||||||
files to load the settings.
|
|
||||||
|
|
||||||
For example, you can define your desired fonts, transparency or colors:
|
|
||||||
|
|
||||||
```
|
|
||||||
*.font: Liberation Mono:pixelsize=12:antialias=true:autohint=true;
|
|
||||||
*.alpha: 0.9
|
|
||||||
*.color0: #111
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
The `alpha` value (for transparency) goes from `0` (transparent) to `1`
|
|
||||||
(opaque). There is an example `Xdefaults` file in this respository.
|
|
||||||
|
|
||||||
### Colors
|
|
||||||
|
|
||||||
To be clear about the color settings:
|
|
||||||
|
|
||||||
- This build will use gruvbox colors by default and as a fallback.
|
|
||||||
- If there are Xresources colors defined, those will take priority.
|
|
||||||
- But if `wal` has run in your session, its colors will take priority.
|
|
||||||
|
|
||||||
Note that when you run `wal`, it will negate the transparency of existing windows, but new windows will continue with the previously defined transparency.
|
|
||||||
|
|
||||||
## Contact
|
|
||||||
|
|
||||||
- Luke Smith <luke@lukesmith.xyz>
|
|
||||||
- [https://lukesmith.xyz](https://lukesmith.xyz)
|
|
28
TODO
Normal file
28
TODO
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
vt emulation
|
||||||
|
------------
|
||||||
|
|
||||||
|
* double-height support
|
||||||
|
|
||||||
|
code & interface
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* add a simple way to do multiplexing
|
||||||
|
|
||||||
|
drawing
|
||||||
|
-------
|
||||||
|
* add diacritics support to xdraws()
|
||||||
|
* switch to a suckless font drawing library
|
||||||
|
* make the font cache simpler
|
||||||
|
* add better support for brightening of the upper colors
|
||||||
|
|
||||||
|
bugs
|
||||||
|
----
|
||||||
|
|
||||||
|
* fix shift up/down (shift selection in emacs)
|
||||||
|
* remove DEC test sequence when appropriate
|
||||||
|
|
||||||
|
misc
|
||||||
|
----
|
||||||
|
|
||||||
|
$ grep -nE 'XXX|TODO' st.c
|
||||||
|
|
128
Xdefaults
128
Xdefaults
|
@ -1,128 +0,0 @@
|
||||||
!! Transparency (0-1):
|
|
||||||
st.alpha: 0.92
|
|
||||||
st.alphaOffset: 0.3
|
|
||||||
|
|
||||||
!! Set a default font and font size as below:
|
|
||||||
st.font: Monospace-11;
|
|
||||||
|
|
||||||
! st.termname: st-256color
|
|
||||||
! st.borderpx: 2
|
|
||||||
|
|
||||||
!! Set the background, foreground and cursor colors as below:
|
|
||||||
|
|
||||||
!! gruvbox:
|
|
||||||
*.color0: #1d2021
|
|
||||||
*.color1: #cc241d
|
|
||||||
*.color2: #98971a
|
|
||||||
*.color3: #d79921
|
|
||||||
*.color4: #458588
|
|
||||||
*.color5: #b16286
|
|
||||||
*.color6: #689d6a
|
|
||||||
*.color7: #a89984
|
|
||||||
*.color8: #928374
|
|
||||||
*.color9: #fb4934
|
|
||||||
*.color10: #b8bb26
|
|
||||||
*.color11: #fabd2f
|
|
||||||
*.color12: #83a598
|
|
||||||
*.color13: #d3869b
|
|
||||||
*.color14: #8ec07c
|
|
||||||
*.color15: #ebdbb2
|
|
||||||
*.background: #282828
|
|
||||||
*.foreground: white
|
|
||||||
*.cursorColor: white
|
|
||||||
|
|
||||||
/* /1* !! gruvbox light: *1/ */
|
|
||||||
/* *.color0: #fbf1c7 */
|
|
||||||
/* *.color1: #cc241d */
|
|
||||||
/* *.color2: #98971a */
|
|
||||||
/* *.color3: #d79921 */
|
|
||||||
/* *.color4: #458588 */
|
|
||||||
/* *.color5: #b16286 */
|
|
||||||
/* *.color6: #689d6a */
|
|
||||||
/* *.color7: #7c6f64 */
|
|
||||||
/* *.color8: #928374 */
|
|
||||||
/* *.color9: #9d0006 */
|
|
||||||
/* *.color10: #79740e */
|
|
||||||
/* *.color11: #b57614 */
|
|
||||||
/* *.color12: #076678 */
|
|
||||||
/* *.color13: #8f3f71 */
|
|
||||||
/* *.color14: #427b58 */
|
|
||||||
/* *.color15: #3c3836 */
|
|
||||||
/* *.background: #fbf1c7 */
|
|
||||||
/* *.foreground: #282828 */
|
|
||||||
/* *.cursorColor: #282828 */
|
|
||||||
|
|
||||||
/* !! brogrammer: */
|
|
||||||
/* *.foreground: #d6dbe5 */
|
|
||||||
/* *.background: #131313 */
|
|
||||||
/* *.color0: #1f1f1f */
|
|
||||||
/* *.color8: #d6dbe5 */
|
|
||||||
/* *.color1: #f81118 */
|
|
||||||
/* *.color9: #de352e */
|
|
||||||
/* *.color2: #2dc55e */
|
|
||||||
/* *.color10: #1dd361 */
|
|
||||||
/* *.color3: #ecba0f */
|
|
||||||
/* *.color11: #f3bd09 */
|
|
||||||
/* *.color4: #2a84d2 */
|
|
||||||
/* *.color12: #1081d6 */
|
|
||||||
/* *.color5: #4e5ab7 */
|
|
||||||
/* *.color13: #5350b9 */
|
|
||||||
/* *.color6: #1081d6 */
|
|
||||||
/* *.color14: #0f7ddb */
|
|
||||||
/* *.color7: #d6dbe5 */
|
|
||||||
/* *.color15: #ffffff */
|
|
||||||
/* *.colorBD: #d6dbe5 */
|
|
||||||
|
|
||||||
/* ! base16 */
|
|
||||||
/* *.color0: #181818 */
|
|
||||||
/* *.color1: #ab4642 */
|
|
||||||
/* *.color2: #a1b56c */
|
|
||||||
/* *.color3: #f7ca88 */
|
|
||||||
/* *.color4: #7cafc2 */
|
|
||||||
/* *.color5: #ba8baf */
|
|
||||||
/* *.color6: #86c1b9 */
|
|
||||||
/* *.color7: #d8d8d8 */
|
|
||||||
/* *.color8: #585858 */
|
|
||||||
/* *.color9: #ab4642 */
|
|
||||||
/* *.color10: #a1b56c */
|
|
||||||
/* *.color11: #f7ca88 */
|
|
||||||
/* *.color12: #7cafc2 */
|
|
||||||
/* *.color13: #ba8baf */
|
|
||||||
/* *.color14: #86c1b9 */
|
|
||||||
/* *.color15: #f8f8f8 */
|
|
||||||
|
|
||||||
/* !! solarized */
|
|
||||||
/* *.color0: #073642 */
|
|
||||||
/* *.color1: #dc322f */
|
|
||||||
/* *.color2: #859900 */
|
|
||||||
/* *.color3: #b58900 */
|
|
||||||
/* *.color4: #268bd2 */
|
|
||||||
/* *.color5: #d33682 */
|
|
||||||
/* *.color6: #2aa198 */
|
|
||||||
/* *.color7: #eee8d5 */
|
|
||||||
/* *.color9: #cb4b16 */
|
|
||||||
/* *.color8: #fdf6e3 */
|
|
||||||
/* *.color10: #586e75 */
|
|
||||||
/* *.color11: #657b83 */
|
|
||||||
/* *.color12: #839496 */
|
|
||||||
/* *.color13: #6c71c4 */
|
|
||||||
/* *.color14: #93a1a1 */
|
|
||||||
/* *.color15: #fdf6e3 */
|
|
||||||
|
|
||||||
/* !! xterm */
|
|
||||||
/* *.color0: #000000 */
|
|
||||||
/* *.color1: #cd0000 */
|
|
||||||
/* *.color2: #00cd00 */
|
|
||||||
/* *.color3: #cdcd00 */
|
|
||||||
/* *.color4: #0000cd */
|
|
||||||
/* *.color5: #cd00cd */
|
|
||||||
/* *.color6: #00cdcd */
|
|
||||||
/* *.color7: #e5e5e5 */
|
|
||||||
/* *.color8: #4d4d4d */
|
|
||||||
/* *.color9: #ff0000 */
|
|
||||||
/* *.color10: #00ff00 */
|
|
||||||
/* *.color11: #ffff00 */
|
|
||||||
/* *.color12: #0000ff */
|
|
||||||
/* *.color13: #ff00ff */
|
|
||||||
/* *.color14: #00ffff */
|
|
||||||
/* *.color15: #aabac8 */
|
|
194
boxdraw.c
194
boxdraw.c
|
@ -1,194 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih
|
|
||||||
* MIT/X Consortium License
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
#include "st.h"
|
|
||||||
#include "boxdraw_data.h"
|
|
||||||
|
|
||||||
/* Rounded non-negative integers division of n / d */
|
|
||||||
#define DIV(n, d) (((n) + (d) / 2) / (d))
|
|
||||||
|
|
||||||
static Display *xdpy;
|
|
||||||
static Colormap xcmap;
|
|
||||||
static XftDraw *xd;
|
|
||||||
static Visual *xvis;
|
|
||||||
|
|
||||||
static void drawbox(int, int, int, int, XftColor *, XftColor *, ushort);
|
|
||||||
static void drawboxlines(int, int, int, int, XftColor *, ushort);
|
|
||||||
|
|
||||||
/* public API */
|
|
||||||
|
|
||||||
void
|
|
||||||
boxdraw_xinit(Display *dpy, Colormap cmap, XftDraw *draw, Visual *vis)
|
|
||||||
{
|
|
||||||
xdpy = dpy; xcmap = cmap; xd = draw, xvis = vis;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
isboxdraw(Rune u)
|
|
||||||
{
|
|
||||||
Rune block = u & ~0xff;
|
|
||||||
return (boxdraw && block == 0x2500 && boxdata[(uint8_t)u]) ||
|
|
||||||
(boxdraw_braille && block == 0x2800);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the "index" is actually the entire shape data encoded as ushort */
|
|
||||||
ushort
|
|
||||||
boxdrawindex(const Glyph *g)
|
|
||||||
{
|
|
||||||
if (boxdraw_braille && (g->u & ~0xff) == 0x2800)
|
|
||||||
return BRL | (uint8_t)g->u;
|
|
||||||
if (boxdraw_bold && (g->mode & ATTR_BOLD))
|
|
||||||
return BDB | boxdata[(uint8_t)g->u];
|
|
||||||
return boxdata[(uint8_t)g->u];
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drawboxes(int x, int y, int cw, int ch, XftColor *fg, XftColor *bg,
|
|
||||||
const XftGlyphFontSpec *specs, int len)
|
|
||||||
{
|
|
||||||
for ( ; len-- > 0; x += cw, specs++)
|
|
||||||
drawbox(x, y, cw, ch, fg, bg, (ushort)specs->glyph);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* implementation */
|
|
||||||
|
|
||||||
void
|
|
||||||
drawbox(int x, int y, int w, int h, XftColor *fg, XftColor *bg, ushort bd)
|
|
||||||
{
|
|
||||||
ushort cat = bd & ~(BDB | 0xff); /* mask out bold and data */
|
|
||||||
if (bd & (BDL | BDA)) {
|
|
||||||
/* lines (light/double/heavy/arcs) */
|
|
||||||
drawboxlines(x, y, w, h, fg, bd);
|
|
||||||
|
|
||||||
} else if (cat == BBD) {
|
|
||||||
/* lower (8-X)/8 block */
|
|
||||||
int d = DIV((uint8_t)bd * h, 8);
|
|
||||||
XftDrawRect(xd, fg, x, y + d, w, h - d);
|
|
||||||
|
|
||||||
} else if (cat == BBU) {
|
|
||||||
/* upper X/8 block */
|
|
||||||
XftDrawRect(xd, fg, x, y, w, DIV((uint8_t)bd * h, 8));
|
|
||||||
|
|
||||||
} else if (cat == BBL) {
|
|
||||||
/* left X/8 block */
|
|
||||||
XftDrawRect(xd, fg, x, y, DIV((uint8_t)bd * w, 8), h);
|
|
||||||
|
|
||||||
} else if (cat == BBR) {
|
|
||||||
/* right (8-X)/8 block */
|
|
||||||
int d = DIV((uint8_t)bd * w, 8);
|
|
||||||
XftDrawRect(xd, fg, x + d, y, w - d, h);
|
|
||||||
|
|
||||||
} else if (cat == BBQ) {
|
|
||||||
/* Quadrants */
|
|
||||||
int w2 = DIV(w, 2), h2 = DIV(h, 2);
|
|
||||||
if (bd & TL)
|
|
||||||
XftDrawRect(xd, fg, x, y, w2, h2);
|
|
||||||
if (bd & TR)
|
|
||||||
XftDrawRect(xd, fg, x + w2, y, w - w2, h2);
|
|
||||||
if (bd & BL)
|
|
||||||
XftDrawRect(xd, fg, x, y + h2, w2, h - h2);
|
|
||||||
if (bd & BR)
|
|
||||||
XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2);
|
|
||||||
|
|
||||||
} else if (bd & BBS) {
|
|
||||||
/* Shades - data is 1/2/3 for 25%/50%/75% alpha, respectively */
|
|
||||||
int d = (uint8_t)bd;
|
|
||||||
XftColor xfc;
|
|
||||||
XRenderColor xrc = { .alpha = 0xffff };
|
|
||||||
|
|
||||||
xrc.red = DIV(fg->color.red * d + bg->color.red * (4 - d), 4);
|
|
||||||
xrc.green = DIV(fg->color.green * d + bg->color.green * (4 - d), 4);
|
|
||||||
xrc.blue = DIV(fg->color.blue * d + bg->color.blue * (4 - d), 4);
|
|
||||||
|
|
||||||
XftColorAllocValue(xdpy, xvis, xcmap, &xrc, &xfc);
|
|
||||||
XftDrawRect(xd, &xfc, x, y, w, h);
|
|
||||||
XftColorFree(xdpy, xvis, xcmap, &xfc);
|
|
||||||
|
|
||||||
} else if (cat == BRL) {
|
|
||||||
/* braille, each data bit corresponds to one dot at 2x4 grid */
|
|
||||||
int w1 = DIV(w, 2);
|
|
||||||
int h1 = DIV(h, 4), h2 = DIV(h, 2), h3 = DIV(3 * h, 4);
|
|
||||||
|
|
||||||
if (bd & 1) XftDrawRect(xd, fg, x, y, w1, h1);
|
|
||||||
if (bd & 2) XftDrawRect(xd, fg, x, y + h1, w1, h2 - h1);
|
|
||||||
if (bd & 4) XftDrawRect(xd, fg, x, y + h2, w1, h3 - h2);
|
|
||||||
if (bd & 8) XftDrawRect(xd, fg, x + w1, y, w - w1, h1);
|
|
||||||
if (bd & 16) XftDrawRect(xd, fg, x + w1, y + h1, w - w1, h2 - h1);
|
|
||||||
if (bd & 32) XftDrawRect(xd, fg, x + w1, y + h2, w - w1, h3 - h2);
|
|
||||||
if (bd & 64) XftDrawRect(xd, fg, x, y + h3, w1, h - h3);
|
|
||||||
if (bd & 128) XftDrawRect(xd, fg, x + w1, y + h3, w - w1, h - h3);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
drawboxlines(int x, int y, int w, int h, XftColor *fg, ushort bd)
|
|
||||||
{
|
|
||||||
/* s: stem thickness. width/8 roughly matches underscore thickness. */
|
|
||||||
/* We draw bold as 1.5 * normal-stem and at least 1px thicker. */
|
|
||||||
/* doubles draw at least 3px, even when w or h < 3. bold needs 6px. */
|
|
||||||
int mwh = MIN(w, h);
|
|
||||||
int base_s = MAX(1, DIV(mwh, 8));
|
|
||||||
int bold = (bd & BDB) && mwh >= 6; /* possibly ignore boldness */
|
|
||||||
int s = bold ? MAX(base_s + 1, DIV(3 * base_s, 2)) : base_s;
|
|
||||||
int w2 = DIV(w - s, 2), h2 = DIV(h - s, 2);
|
|
||||||
/* the s-by-s square (x + w2, y + h2, s, s) is the center texel. */
|
|
||||||
/* The base length (per direction till edge) includes this square. */
|
|
||||||
|
|
||||||
int light = bd & (LL | LU | LR | LD);
|
|
||||||
int double_ = bd & (DL | DU | DR | DD);
|
|
||||||
|
|
||||||
if (light) {
|
|
||||||
/* d: additional (negative) length to not-draw the center */
|
|
||||||
/* texel - at arcs and avoid drawing inside (some) doubles */
|
|
||||||
int arc = bd & BDA;
|
|
||||||
int multi_light = light & (light - 1);
|
|
||||||
int multi_double = double_ & (double_ - 1);
|
|
||||||
/* light crosses double only at DH+LV, DV+LH (ref. shapes) */
|
|
||||||
int d = arc || (multi_double && !multi_light) ? -s : 0;
|
|
||||||
|
|
||||||
if (bd & LL)
|
|
||||||
XftDrawRect(xd, fg, x, y + h2, w2 + s + d, s);
|
|
||||||
if (bd & LU)
|
|
||||||
XftDrawRect(xd, fg, x + w2, y, s, h2 + s + d);
|
|
||||||
if (bd & LR)
|
|
||||||
XftDrawRect(xd, fg, x + w2 - d, y + h2, w - w2 + d, s);
|
|
||||||
if (bd & LD)
|
|
||||||
XftDrawRect(xd, fg, x + w2, y + h2 - d, s, h - h2 + d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* double lines - also align with light to form heavy when combined */
|
|
||||||
if (double_) {
|
|
||||||
/*
|
|
||||||
* going clockwise, for each double-ray: p is additional length
|
|
||||||
* to the single-ray nearer to the previous direction, and n to
|
|
||||||
* the next. p and n adjust from the base length to lengths
|
|
||||||
* which consider other doubles - shorter to avoid intersections
|
|
||||||
* (p, n), or longer to draw the far-corner texel (n).
|
|
||||||
*/
|
|
||||||
int dl = bd & DL, du = bd & DU, dr = bd & DR, dd = bd & DD;
|
|
||||||
if (dl) {
|
|
||||||
int p = dd ? -s : 0, n = du ? -s : dd ? s : 0;
|
|
||||||
XftDrawRect(xd, fg, x, y + h2 + s, w2 + s + p, s);
|
|
||||||
XftDrawRect(xd, fg, x, y + h2 - s, w2 + s + n, s);
|
|
||||||
}
|
|
||||||
if (du) {
|
|
||||||
int p = dl ? -s : 0, n = dr ? -s : dl ? s : 0;
|
|
||||||
XftDrawRect(xd, fg, x + w2 - s, y, s, h2 + s + p);
|
|
||||||
XftDrawRect(xd, fg, x + w2 + s, y, s, h2 + s + n);
|
|
||||||
}
|
|
||||||
if (dr) {
|
|
||||||
int p = du ? -s : 0, n = dd ? -s : du ? s : 0;
|
|
||||||
XftDrawRect(xd, fg, x + w2 - p, y + h2 - s, w - w2 + p, s);
|
|
||||||
XftDrawRect(xd, fg, x + w2 - n, y + h2 + s, w - w2 + n, s);
|
|
||||||
}
|
|
||||||
if (dd) {
|
|
||||||
int p = dr ? -s : 0, n = dl ? -s : dr ? s : 0;
|
|
||||||
XftDrawRect(xd, fg, x + w2 + s, y + h2 - p, s, h - h2 + p);
|
|
||||||
XftDrawRect(xd, fg, x + w2 - s, y + h2 - n, s, h - h2 + n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
214
boxdraw_data.h
214
boxdraw_data.h
|
@ -1,214 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih
|
|
||||||
* MIT/X Consortium License
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* U+25XX codepoints data
|
|
||||||
*
|
|
||||||
* References:
|
|
||||||
* http://www.unicode.org/charts/PDF/U2500.pdf
|
|
||||||
* http://www.unicode.org/charts/PDF/U2580.pdf
|
|
||||||
*
|
|
||||||
* Test page:
|
|
||||||
* https://github.com/GNOME/vte/blob/master/doc/boxes.txt
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Each shape is encoded as 16-bits. Higher bits are category, lower are data */
|
|
||||||
/* Categories (mutually exclusive except BDB): */
|
|
||||||
/* For convenience, BDL/BDA/BBS/BDB are 1 bit each, the rest are enums */
|
|
||||||
#define BDL (1<<8) /* Box Draw Lines (light/double/heavy) */
|
|
||||||
#define BDA (1<<9) /* Box Draw Arc (light) */
|
|
||||||
|
|
||||||
#define BBD (1<<10) /* Box Block Down (lower) X/8 */
|
|
||||||
#define BBL (2<<10) /* Box Block Left X/8 */
|
|
||||||
#define BBU (3<<10) /* Box Block Upper X/8 */
|
|
||||||
#define BBR (4<<10) /* Box Block Right X/8 */
|
|
||||||
#define BBQ (5<<10) /* Box Block Quadrants */
|
|
||||||
#define BRL (6<<10) /* Box Braille (data is lower byte of U28XX) */
|
|
||||||
|
|
||||||
#define BBS (1<<14) /* Box Block Shades */
|
|
||||||
#define BDB (1<<15) /* Box Draw is Bold */
|
|
||||||
|
|
||||||
/* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical */
|
|
||||||
/* Heavy is light+double (literally drawing light+double align to form heavy) */
|
|
||||||
#define LL (1<<0)
|
|
||||||
#define LU (1<<1)
|
|
||||||
#define LR (1<<2)
|
|
||||||
#define LD (1<<3)
|
|
||||||
#define LH (LL+LR)
|
|
||||||
#define LV (LU+LD)
|
|
||||||
|
|
||||||
#define DL (1<<4)
|
|
||||||
#define DU (1<<5)
|
|
||||||
#define DR (1<<6)
|
|
||||||
#define DD (1<<7)
|
|
||||||
#define DH (DL+DR)
|
|
||||||
#define DV (DU+DD)
|
|
||||||
|
|
||||||
#define HL (LL+DL)
|
|
||||||
#define HU (LU+DU)
|
|
||||||
#define HR (LR+DR)
|
|
||||||
#define HD (LD+DD)
|
|
||||||
#define HH (HL+HR)
|
|
||||||
#define HV (HU+HD)
|
|
||||||
|
|
||||||
/* (BBQ) Quadrants Top/Bottom x Left/Right */
|
|
||||||
#define TL (1<<0)
|
|
||||||
#define TR (1<<1)
|
|
||||||
#define BL (1<<2)
|
|
||||||
#define BR (1<<3)
|
|
||||||
|
|
||||||
/* Data for U+2500 - U+259F except dashes/diagonals */
|
|
||||||
static const unsigned short boxdata[256] = {
|
|
||||||
/* light lines */
|
|
||||||
[0x00] = BDL + LH, /* light horizontal */
|
|
||||||
[0x02] = BDL + LV, /* light vertical */
|
|
||||||
[0x0c] = BDL + LD + LR, /* light down and right */
|
|
||||||
[0x10] = BDL + LD + LL, /* light down and left */
|
|
||||||
[0x14] = BDL + LU + LR, /* light up and right */
|
|
||||||
[0x18] = BDL + LU + LL, /* light up and left */
|
|
||||||
[0x1c] = BDL + LV + LR, /* light vertical and right */
|
|
||||||
[0x24] = BDL + LV + LL, /* light vertical and left */
|
|
||||||
[0x2c] = BDL + LH + LD, /* light horizontal and down */
|
|
||||||
[0x34] = BDL + LH + LU, /* light horizontal and up */
|
|
||||||
[0x3c] = BDL + LV + LH, /* light vertical and horizontal */
|
|
||||||
[0x74] = BDL + LL, /* light left */
|
|
||||||
[0x75] = BDL + LU, /* light up */
|
|
||||||
[0x76] = BDL + LR, /* light right */
|
|
||||||
[0x77] = BDL + LD, /* light down */
|
|
||||||
|
|
||||||
/* heavy [+light] lines */
|
|
||||||
[0x01] = BDL + HH,
|
|
||||||
[0x03] = BDL + HV,
|
|
||||||
[0x0d] = BDL + HR + LD,
|
|
||||||
[0x0e] = BDL + HD + LR,
|
|
||||||
[0x0f] = BDL + HD + HR,
|
|
||||||
[0x11] = BDL + HL + LD,
|
|
||||||
[0x12] = BDL + HD + LL,
|
|
||||||
[0x13] = BDL + HD + HL,
|
|
||||||
[0x15] = BDL + HR + LU,
|
|
||||||
[0x16] = BDL + HU + LR,
|
|
||||||
[0x17] = BDL + HU + HR,
|
|
||||||
[0x19] = BDL + HL + LU,
|
|
||||||
[0x1a] = BDL + HU + LL,
|
|
||||||
[0x1b] = BDL + HU + HL,
|
|
||||||
[0x1d] = BDL + HR + LV,
|
|
||||||
[0x1e] = BDL + HU + LD + LR,
|
|
||||||
[0x1f] = BDL + HD + LR + LU,
|
|
||||||
[0x20] = BDL + HV + LR,
|
|
||||||
[0x21] = BDL + HU + HR + LD,
|
|
||||||
[0x22] = BDL + HD + HR + LU,
|
|
||||||
[0x23] = BDL + HV + HR,
|
|
||||||
[0x25] = BDL + HL + LV,
|
|
||||||
[0x26] = BDL + HU + LD + LL,
|
|
||||||
[0x27] = BDL + HD + LU + LL,
|
|
||||||
[0x28] = BDL + HV + LL,
|
|
||||||
[0x29] = BDL + HU + HL + LD,
|
|
||||||
[0x2a] = BDL + HD + HL + LU,
|
|
||||||
[0x2b] = BDL + HV + HL,
|
|
||||||
[0x2d] = BDL + HL + LD + LR,
|
|
||||||
[0x2e] = BDL + HR + LL + LD,
|
|
||||||
[0x2f] = BDL + HH + LD,
|
|
||||||
[0x30] = BDL + HD + LH,
|
|
||||||
[0x31] = BDL + HD + HL + LR,
|
|
||||||
[0x32] = BDL + HR + HD + LL,
|
|
||||||
[0x33] = BDL + HH + HD,
|
|
||||||
[0x35] = BDL + HL + LU + LR,
|
|
||||||
[0x36] = BDL + HR + LU + LL,
|
|
||||||
[0x37] = BDL + HH + LU,
|
|
||||||
[0x38] = BDL + HU + LH,
|
|
||||||
[0x39] = BDL + HU + HL + LR,
|
|
||||||
[0x3a] = BDL + HU + HR + LL,
|
|
||||||
[0x3b] = BDL + HH + HU,
|
|
||||||
[0x3d] = BDL + HL + LV + LR,
|
|
||||||
[0x3e] = BDL + HR + LV + LL,
|
|
||||||
[0x3f] = BDL + HH + LV,
|
|
||||||
[0x40] = BDL + HU + LH + LD,
|
|
||||||
[0x41] = BDL + HD + LH + LU,
|
|
||||||
[0x42] = BDL + HV + LH,
|
|
||||||
[0x43] = BDL + HU + HL + LD + LR,
|
|
||||||
[0x44] = BDL + HU + HR + LD + LL,
|
|
||||||
[0x45] = BDL + HD + HL + LU + LR,
|
|
||||||
[0x46] = BDL + HD + HR + LU + LL,
|
|
||||||
[0x47] = BDL + HH + HU + LD,
|
|
||||||
[0x48] = BDL + HH + HD + LU,
|
|
||||||
[0x49] = BDL + HV + HL + LR,
|
|
||||||
[0x4a] = BDL + HV + HR + LL,
|
|
||||||
[0x4b] = BDL + HV + HH,
|
|
||||||
[0x78] = BDL + HL,
|
|
||||||
[0x79] = BDL + HU,
|
|
||||||
[0x7a] = BDL + HR,
|
|
||||||
[0x7b] = BDL + HD,
|
|
||||||
[0x7c] = BDL + HR + LL,
|
|
||||||
[0x7d] = BDL + HD + LU,
|
|
||||||
[0x7e] = BDL + HL + LR,
|
|
||||||
[0x7f] = BDL + HU + LD,
|
|
||||||
|
|
||||||
/* double [+light] lines */
|
|
||||||
[0x50] = BDL + DH,
|
|
||||||
[0x51] = BDL + DV,
|
|
||||||
[0x52] = BDL + DR + LD,
|
|
||||||
[0x53] = BDL + DD + LR,
|
|
||||||
[0x54] = BDL + DR + DD,
|
|
||||||
[0x55] = BDL + DL + LD,
|
|
||||||
[0x56] = BDL + DD + LL,
|
|
||||||
[0x57] = BDL + DL + DD,
|
|
||||||
[0x58] = BDL + DR + LU,
|
|
||||||
[0x59] = BDL + DU + LR,
|
|
||||||
[0x5a] = BDL + DU + DR,
|
|
||||||
[0x5b] = BDL + DL + LU,
|
|
||||||
[0x5c] = BDL + DU + LL,
|
|
||||||
[0x5d] = BDL + DL + DU,
|
|
||||||
[0x5e] = BDL + DR + LV,
|
|
||||||
[0x5f] = BDL + DV + LR,
|
|
||||||
[0x60] = BDL + DV + DR,
|
|
||||||
[0x61] = BDL + DL + LV,
|
|
||||||
[0x62] = BDL + DV + LL,
|
|
||||||
[0x63] = BDL + DV + DL,
|
|
||||||
[0x64] = BDL + DH + LD,
|
|
||||||
[0x65] = BDL + DD + LH,
|
|
||||||
[0x66] = BDL + DD + DH,
|
|
||||||
[0x67] = BDL + DH + LU,
|
|
||||||
[0x68] = BDL + DU + LH,
|
|
||||||
[0x69] = BDL + DH + DU,
|
|
||||||
[0x6a] = BDL + DH + LV,
|
|
||||||
[0x6b] = BDL + DV + LH,
|
|
||||||
[0x6c] = BDL + DH + DV,
|
|
||||||
|
|
||||||
/* (light) arcs */
|
|
||||||
[0x6d] = BDA + LD + LR,
|
|
||||||
[0x6e] = BDA + LD + LL,
|
|
||||||
[0x6f] = BDA + LU + LL,
|
|
||||||
[0x70] = BDA + LU + LR,
|
|
||||||
|
|
||||||
/* Lower (Down) X/8 block (data is 8 - X) */
|
|
||||||
[0x81] = BBD + 7, [0x82] = BBD + 6, [0x83] = BBD + 5, [0x84] = BBD + 4,
|
|
||||||
[0x85] = BBD + 3, [0x86] = BBD + 2, [0x87] = BBD + 1, [0x88] = BBD + 0,
|
|
||||||
|
|
||||||
/* Left X/8 block (data is X) */
|
|
||||||
[0x89] = BBL + 7, [0x8a] = BBL + 6, [0x8b] = BBL + 5, [0x8c] = BBL + 4,
|
|
||||||
[0x8d] = BBL + 3, [0x8e] = BBL + 2, [0x8f] = BBL + 1,
|
|
||||||
|
|
||||||
/* upper 1/2 (4/8), 1/8 block (X), right 1/2, 1/8 block (8-X) */
|
|
||||||
[0x80] = BBU + 4, [0x94] = BBU + 1,
|
|
||||||
[0x90] = BBR + 4, [0x95] = BBR + 7,
|
|
||||||
|
|
||||||
/* Quadrants */
|
|
||||||
[0x96] = BBQ + BL,
|
|
||||||
[0x97] = BBQ + BR,
|
|
||||||
[0x98] = BBQ + TL,
|
|
||||||
[0x99] = BBQ + TL + BL + BR,
|
|
||||||
[0x9a] = BBQ + TL + BR,
|
|
||||||
[0x9b] = BBQ + TL + TR + BL,
|
|
||||||
[0x9c] = BBQ + TL + TR + BR,
|
|
||||||
[0x9d] = BBQ + TR,
|
|
||||||
[0x9e] = BBQ + BL + TR,
|
|
||||||
[0x9f] = BBQ + BL + TR + BR,
|
|
||||||
|
|
||||||
/* Shades, data is an alpha value in 25% units (1/4, 1/2, 3/4) */
|
|
||||||
[0x91] = BBS + 1, [0x92] = BBS + 2, [0x93] = BBS + 3,
|
|
||||||
|
|
||||||
/* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */
|
|
||||||
/* U+2571 - U+2573: unsupported (diagonals) */
|
|
||||||
};
|
|
|
@ -5,8 +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 = "mono:pixelsize=16:antialias=true:autohint=true";
|
static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true";
|
||||||
static char *font2[] = { "NotoColorEmoji:pixelsize=16:antialias=true:autohint=true" };
|
|
||||||
static int borderpx = 2;
|
static int borderpx = 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -68,18 +67,6 @@ static unsigned int blinktimeout = 800;
|
||||||
*/
|
*/
|
||||||
static unsigned int cursorthickness = 2;
|
static unsigned int cursorthickness = 2;
|
||||||
|
|
||||||
/*
|
|
||||||
* 1: render most of the lines/blocks characters without using the font for
|
|
||||||
* perfect alignment between cells (U2500 - U259F except dashes/diagonals).
|
|
||||||
* Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored.
|
|
||||||
* 0: disable (render all U25XX glyphs normally from the font).
|
|
||||||
*/
|
|
||||||
const int boxdraw = 1;
|
|
||||||
const int boxdraw_bold = 0;
|
|
||||||
|
|
||||||
/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */
|
|
||||||
const int boxdraw_braille = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
|
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
|
||||||
* it
|
* it
|
||||||
|
@ -106,35 +93,35 @@ char *termname = "st-256color";
|
||||||
*/
|
*/
|
||||||
unsigned int tabspaces = 8;
|
unsigned int tabspaces = 8;
|
||||||
|
|
||||||
/* bg opacity */
|
|
||||||
float alpha = 0.8;
|
|
||||||
float alphaOffset = 0.0;
|
|
||||||
float alphaUnfocus;
|
|
||||||
|
|
||||||
/* Terminal colors (16 first used in escape sequence) */
|
/* Terminal colors (16 first used in escape sequence) */
|
||||||
static const char *colorname[] = {
|
static const char *colorname[] = {
|
||||||
"#282828", /* hard contrast: #1d2021 / soft contrast: #32302f */
|
/* 8 normal colors */
|
||||||
"#cc241d",
|
"black",
|
||||||
"#98971a",
|
"red3",
|
||||||
"#d79921",
|
"green3",
|
||||||
"#458588",
|
"yellow3",
|
||||||
"#b16286",
|
"blue2",
|
||||||
"#689d6a",
|
"magenta3",
|
||||||
"#a89984",
|
"cyan3",
|
||||||
"#928374",
|
"gray90",
|
||||||
"#fb4934",
|
|
||||||
"#b8bb26",
|
/* 8 bright colors */
|
||||||
"#fabd2f",
|
"gray50",
|
||||||
"#83a598",
|
"red",
|
||||||
"#d3869b",
|
"green",
|
||||||
"#8ec07c",
|
"yellow",
|
||||||
"#ebdbb2",
|
"#5c5cff",
|
||||||
|
"magenta",
|
||||||
|
"cyan",
|
||||||
|
"white",
|
||||||
|
|
||||||
[255] = 0,
|
[255] = 0,
|
||||||
|
|
||||||
/* more colors can be added after 255 to use with DefaultXX */
|
/* more colors can be added after 255 to use with DefaultXX */
|
||||||
"#add8e6", /* 256 -> cursor */
|
"#cccccc",
|
||||||
"#555555", /* 257 -> rev cursor*/
|
"#555555",
|
||||||
"#282828", /* 258 -> bg */
|
"gray90", /* default foreground colour */
|
||||||
"#ebdbb2", /* 259 -> fg */
|
"black", /* default background colour */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -142,11 +129,10 @@ static const char *colorname[] = {
|
||||||
* Default colors (colorname index)
|
* Default colors (colorname index)
|
||||||
* foreground, background, cursor, reverse cursor
|
* foreground, background, cursor, reverse cursor
|
||||||
*/
|
*/
|
||||||
unsigned int defaultfg = 259;
|
unsigned int defaultfg = 258;
|
||||||
unsigned int defaultbg = 258;
|
unsigned int defaultbg = 259;
|
||||||
unsigned int defaultcs = 256;
|
unsigned int defaultcs = 256;
|
||||||
unsigned int defaultrcs = 257;
|
static unsigned int defaultrcs = 257;
|
||||||
unsigned int background = 258;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default shape of cursor
|
* Default shape of cursor
|
||||||
|
@ -184,53 +170,12 @@ static unsigned int defaultattr = 11;
|
||||||
*/
|
*/
|
||||||
static uint forcemousemod = ShiftMask;
|
static uint forcemousemod = ShiftMask;
|
||||||
|
|
||||||
/*
|
|
||||||
* Xresources preferences to load at startup
|
|
||||||
*/
|
|
||||||
ResourcePref resources[] = {
|
|
||||||
{ "font", STRING, &font },
|
|
||||||
{ "fontalt0", STRING, &font2[0] },
|
|
||||||
{ "color0", STRING, &colorname[0] },
|
|
||||||
{ "color1", STRING, &colorname[1] },
|
|
||||||
{ "color2", STRING, &colorname[2] },
|
|
||||||
{ "color3", STRING, &colorname[3] },
|
|
||||||
{ "color4", STRING, &colorname[4] },
|
|
||||||
{ "color5", STRING, &colorname[5] },
|
|
||||||
{ "color6", STRING, &colorname[6] },
|
|
||||||
{ "color7", STRING, &colorname[7] },
|
|
||||||
{ "color8", STRING, &colorname[8] },
|
|
||||||
{ "color9", STRING, &colorname[9] },
|
|
||||||
{ "color10", STRING, &colorname[10] },
|
|
||||||
{ "color11", STRING, &colorname[11] },
|
|
||||||
{ "color12", STRING, &colorname[12] },
|
|
||||||
{ "color13", STRING, &colorname[13] },
|
|
||||||
{ "color14", STRING, &colorname[14] },
|
|
||||||
{ "color15", STRING, &colorname[15] },
|
|
||||||
{ "background", STRING, &colorname[258] },
|
|
||||||
{ "foreground", STRING, &colorname[259] },
|
|
||||||
{ "cursorColor", STRING, &colorname[256] },
|
|
||||||
{ "termname", STRING, &termname },
|
|
||||||
{ "shell", STRING, &shell },
|
|
||||||
{ "minlatency", INTEGER, &minlatency },
|
|
||||||
{ "maxlatency", INTEGER, &maxlatency },
|
|
||||||
{ "blinktimeout", INTEGER, &blinktimeout },
|
|
||||||
{ "bellvolume", INTEGER, &bellvolume },
|
|
||||||
{ "tabspaces", INTEGER, &tabspaces },
|
|
||||||
{ "borderpx", INTEGER, &borderpx },
|
|
||||||
{ "cwscale", FLOAT, &cwscale },
|
|
||||||
{ "chscale", FLOAT, &chscale },
|
|
||||||
{ "alpha", FLOAT, &alpha },
|
|
||||||
{ "alphaOffset", FLOAT, &alphaOffset },
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal mouse shortcuts.
|
* Internal mouse shortcuts.
|
||||||
* Beware that overloading Button1 will disable the selection.
|
* Beware that overloading Button1 will disable the selection.
|
||||||
*/
|
*/
|
||||||
static MouseShortcut mshortcuts[] = {
|
static MouseShortcut mshortcuts[] = {
|
||||||
/* mask button function argument release */
|
/* mask button function argument release */
|
||||||
{ XK_NO_MOD, Button4, kscrollup, {.i = 1} },
|
|
||||||
{ XK_NO_MOD, Button5, kscrolldown, {.i = 1} },
|
|
||||||
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
|
||||||
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
|
||||||
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
|
||||||
|
@ -240,11 +185,7 @@ static MouseShortcut mshortcuts[] = {
|
||||||
|
|
||||||
/* Internal keyboard shortcuts. */
|
/* Internal keyboard shortcuts. */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod1Mask
|
||||||
#define TERMMOD (Mod1Mask|ShiftMask)
|
#define TERMMOD (ControlMask|ShiftMask)
|
||||||
|
|
||||||
static char *openurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -o", "externalpipe", NULL };
|
|
||||||
static char *copyurlcmd[] = { "/bin/sh", "-c", "st-urlhandler -c", "externalpipe", NULL };
|
|
||||||
static char *copyoutput[] = { "/bin/sh", "-c", "st-copyout", "externalpipe", NULL };
|
|
||||||
|
|
||||||
static Shortcut shortcuts[] = {
|
static Shortcut shortcuts[] = {
|
||||||
/* mask keysym function argument */
|
/* mask keysym function argument */
|
||||||
|
@ -257,32 +198,9 @@ static Shortcut shortcuts[] = {
|
||||||
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
|
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
|
||||||
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
|
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
|
||||||
{ TERMMOD, XK_V, clippaste, {.i = 0} },
|
{ TERMMOD, XK_V, clippaste, {.i = 0} },
|
||||||
{ MODKEY, XK_c, clipcopy, {.i = 0} },
|
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
|
||||||
{ ShiftMask, XK_Insert, clippaste, {.i = 0} },
|
|
||||||
{ MODKEY, XK_v, clippaste, {.i = 0} },
|
|
||||||
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
|
||||||
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
|
||||||
{ ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
|
|
||||||
{ ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
|
|
||||||
{ MODKEY, XK_Page_Up, kscrollup, {.i = -1} },
|
|
||||||
{ MODKEY, XK_Page_Down, kscrolldown, {.i = -1} },
|
|
||||||
{ MODKEY, XK_k, kscrollup, {.i = 1} },
|
|
||||||
{ MODKEY, XK_j, kscrolldown, {.i = 1} },
|
|
||||||
{ MODKEY, XK_Up, kscrollup, {.i = 1} },
|
|
||||||
{ MODKEY, XK_Down, kscrolldown, {.i = 1} },
|
|
||||||
{ MODKEY, XK_u, kscrollup, {.i = -1} },
|
|
||||||
{ MODKEY, XK_d, kscrolldown, {.i = -1} },
|
|
||||||
{ MODKEY, XK_s, changealpha, {.f = -0.05} },
|
|
||||||
{ MODKEY, XK_a, changealpha, {.f = +0.05} },
|
|
||||||
{ TERMMOD, XK_Up, zoom, {.f = +1} },
|
|
||||||
{ TERMMOD, XK_Down, zoom, {.f = -1} },
|
|
||||||
{ TERMMOD, XK_K, zoom, {.f = +1} },
|
|
||||||
{ TERMMOD, XK_J, zoom, {.f = -1} },
|
|
||||||
{ TERMMOD, XK_U, zoom, {.f = +2} },
|
|
||||||
{ TERMMOD, XK_D, zoom, {.f = -2} },
|
|
||||||
{ MODKEY, XK_l, externalpipe, {.v = openurlcmd } },
|
|
||||||
{ MODKEY, XK_y, externalpipe, {.v = copyurlcmd } },
|
|
||||||
{ MODKEY, XK_o, externalpipe, {.v = copyoutput } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -554,4 +472,3 @@ static char ascii_printable[] =
|
||||||
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
" !\"#$%&'()*+,-./0123456789:;<=>?"
|
||||||
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
|
||||||
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
"`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||||
|
|
|
@ -15,12 +15,10 @@ PKG_CONFIG = pkg-config
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I$(X11INC) \
|
INCS = -I$(X11INC) \
|
||||||
`$(PKG_CONFIG) --cflags fontconfig` \
|
`$(PKG_CONFIG) --cflags fontconfig` \
|
||||||
`$(PKG_CONFIG) --cflags freetype2` \
|
`$(PKG_CONFIG) --cflags freetype2`
|
||||||
`$(PKG_CONFIG) --cflags harfbuzz`
|
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
|
||||||
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
|
|
||||||
`$(PKG_CONFIG) --libs fontconfig` \
|
`$(PKG_CONFIG) --libs fontconfig` \
|
||||||
`$(PKG_CONFIG) --libs freetype2` \
|
`$(PKG_CONFIG) --libs freetype2`
|
||||||
`$(PKG_CONFIG) --libs harfbuzz`
|
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
|
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
|
||||||
|
@ -32,6 +30,7 @@ STLDFLAGS = $(LIBS) $(LDFLAGS)
|
||||||
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
|
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
|
||||||
# `$(PKG_CONFIG) --libs fontconfig` \
|
# `$(PKG_CONFIG) --libs fontconfig` \
|
||||||
# `$(PKG_CONFIG) --libs freetype2`
|
# `$(PKG_CONFIG) --libs freetype2`
|
||||||
|
#MANPREFIX = ${PREFIX}/man
|
||||||
|
|
||||||
# compiler and linker
|
# compiler and linker
|
||||||
# CC = c99
|
# CC = c99
|
||||||
|
|
154
hb.c
154
hb.c
|
@ -1,154 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <math.h>
|
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
#include <X11/cursorfont.h>
|
|
||||||
#include <hb.h>
|
|
||||||
#include <hb-ft.h>
|
|
||||||
|
|
||||||
#include "st.h"
|
|
||||||
|
|
||||||
#define FEATURE(c1,c2,c3,c4) { .tag = HB_TAG(c1,c2,c3,c4), .value = 1, .start = HB_FEATURE_GLOBAL_START, .end = HB_FEATURE_GLOBAL_END }
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Replace 0 with a list of font features, wrapped in FEATURE macro, e.g.
|
|
||||||
* FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g')
|
|
||||||
*
|
|
||||||
* Uncomment either one of the 2 lines below. Uncomment the prior to disable (any) font features. Uncomment the
|
|
||||||
* latter to enable the (selected) font features.
|
|
||||||
*/
|
|
||||||
|
|
||||||
hb_feature_t features[] = { 0 };
|
|
||||||
//hb_feature_t features[] = { FEATURE('s','s','0','1'), FEATURE('s','s','0','2'), FEATURE('s','s','0','3'), FEATURE('s','s','0','5'), FEATURE('s','s','0','6'), FEATURE('s','s','0','7'), FEATURE('s','s','0','8'), FEATURE('z','e','r','o') };
|
|
||||||
|
|
||||||
void hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length);
|
|
||||||
hb_font_t *hbfindfont(XftFont *match);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
XftFont *match;
|
|
||||||
hb_font_t *font;
|
|
||||||
} HbFontMatch;
|
|
||||||
|
|
||||||
static int hbfontslen = 0;
|
|
||||||
static HbFontMatch *hbfontcache = NULL;
|
|
||||||
|
|
||||||
void
|
|
||||||
hbunloadfonts()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < hbfontslen; i++) {
|
|
||||||
hb_font_destroy(hbfontcache[i].font);
|
|
||||||
XftUnlockFace(hbfontcache[i].match);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hbfontcache != NULL) {
|
|
||||||
free(hbfontcache);
|
|
||||||
hbfontcache = NULL;
|
|
||||||
}
|
|
||||||
hbfontslen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
hb_font_t *
|
|
||||||
hbfindfont(XftFont *match)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < hbfontslen; i++) {
|
|
||||||
if (hbfontcache[i].match == match)
|
|
||||||
return hbfontcache[i].font;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Font not found in cache, caching it now. */
|
|
||||||
hbfontcache = realloc(hbfontcache, sizeof(HbFontMatch) * (hbfontslen + 1));
|
|
||||||
FT_Face face = XftLockFace(match);
|
|
||||||
hb_font_t *font = hb_ft_font_create(face, NULL);
|
|
||||||
if (font == NULL)
|
|
||||||
die("Failed to load Harfbuzz font.");
|
|
||||||
|
|
||||||
hbfontcache[hbfontslen].match = match;
|
|
||||||
hbfontcache[hbfontslen].font = font;
|
|
||||||
hbfontslen += 1;
|
|
||||||
|
|
||||||
return font;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
hbtransform(XftGlyphFontSpec *specs, const Glyph *glyphs, size_t len, int x, int y)
|
|
||||||
{
|
|
||||||
int start = 0, length = 1, gstart = 0;
|
|
||||||
hb_codepoint_t *codepoints = calloc((unsigned int)len, sizeof(hb_codepoint_t));
|
|
||||||
|
|
||||||
for (int idx = 1, specidx = 1; idx < len; idx++) {
|
|
||||||
if (glyphs[idx].mode & ATTR_WDUMMY) {
|
|
||||||
length += 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (specs[specidx].font != specs[start].font || ATTRCMP(glyphs[gstart], glyphs[idx]) || selected(x + idx, y) != selected(x + gstart, y)) {
|
|
||||||
hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);
|
|
||||||
|
|
||||||
/* Reset the sequence. */
|
|
||||||
length = 1;
|
|
||||||
start = specidx;
|
|
||||||
gstart = idx;
|
|
||||||
} else {
|
|
||||||
length += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
specidx++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* EOL. */
|
|
||||||
hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);
|
|
||||||
|
|
||||||
/* Apply the transformation to glyph specs. */
|
|
||||||
for (int i = 0, specidx = 0; i < len; i++) {
|
|
||||||
if (glyphs[i].mode & ATTR_WDUMMY)
|
|
||||||
continue;
|
|
||||||
if (glyphs[i].mode & ATTR_BOXDRAW) {
|
|
||||||
specidx++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (codepoints[i] != specs[specidx].glyph)
|
|
||||||
((Glyph *)glyphs)[i].mode |= ATTR_LIGA;
|
|
||||||
|
|
||||||
specs[specidx++].glyph = codepoints[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
free(codepoints);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
hbtransformsegment(XftFont *xfont, const Glyph *string, hb_codepoint_t *codepoints, int start, int length)
|
|
||||||
{
|
|
||||||
hb_font_t *font = hbfindfont(xfont);
|
|
||||||
if (font == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Rune rune;
|
|
||||||
ushort mode = USHRT_MAX;
|
|
||||||
hb_buffer_t *buffer = hb_buffer_create();
|
|
||||||
hb_buffer_set_direction(buffer, HB_DIRECTION_LTR);
|
|
||||||
|
|
||||||
/* Fill buffer with codepoints. */
|
|
||||||
for (int i = start; i < (start+length); i++) {
|
|
||||||
rune = string[i].u;
|
|
||||||
mode = string[i].mode;
|
|
||||||
if (mode & ATTR_WDUMMY)
|
|
||||||
rune = 0x0020;
|
|
||||||
hb_buffer_add_codepoints(buffer, &rune, 1, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Shape the segment. */
|
|
||||||
hb_shape(font, buffer, features, sizeof(features));
|
|
||||||
|
|
||||||
/* Get new glyph info. */
|
|
||||||
hb_glyph_info_t *info = hb_buffer_get_glyph_infos(buffer, NULL);
|
|
||||||
|
|
||||||
/* Write new codepoints. */
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
hb_codepoint_t gid = info[i].codepoint;
|
|
||||||
codepoints[start+i] = gid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cleanup. */
|
|
||||||
hb_buffer_destroy(buffer);
|
|
||||||
}
|
|
7
hb.h
7
hb.h
|
@ -1,7 +0,0 @@
|
||||||
#include <X11/Xft/Xft.h>
|
|
||||||
#include <hb.h>
|
|
||||||
#include <hb-ft.h>
|
|
||||||
|
|
||||||
void hbunloadfonts();
|
|
||||||
void hbtransform(XftGlyphFontSpec *, const Glyph *, size_t, int, int);
|
|
||||||
|
|
13
st-copyout
13
st-copyout
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# Using external pipe with st, give a dmenu prompt of recent commands,
|
|
||||||
# allowing the user to copy the output of one.
|
|
||||||
# xclip required for this script.
|
|
||||||
# By Jaywalker and Luke
|
|
||||||
tmpfile=$(mktemp /tmp/st-cmd-output.XXXXXX)
|
|
||||||
trap 'rm "$tmpfile"' 0 1 15
|
|
||||||
sed -n "w $tmpfile"
|
|
||||||
sed -i 's/\x0//g' "$tmpfile"
|
|
||||||
ps1="$(grep "\S" "$tmpfile" | tail -n 1 | sed 's/^\s*//' | cut -d' ' -f1)"
|
|
||||||
chosen="$(grep -F "$ps1" "$tmpfile" | sed '$ d' | tac | dmenu -p "Copy which command's output?" -i -l 10 | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
|
||||||
eps1="$(echo "$ps1" | sed 's/[^^]/[&]/g; s/\^/\\^/g')"
|
|
||||||
awk "/^$chosen$/{p=1;print;next} p&&/$eps1/{p=0};p" "$tmpfile" | xclip -selection clipboard
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
urlregex="(((http|https|gopher|gemini|ftp|ftps|git)://|www\\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|((magnet:\\?xt=urn:btih:)[a-zA-Z0-9]*)"
|
|
||||||
|
|
||||||
urls="$(sed 's/.*│//g' | tr -d '\n' | # First remove linebreaks and mutt sidebars:
|
|
||||||
grep -aEo "$urlregex" | # grep only urls as defined above.
|
|
||||||
uniq | # Ignore neighboring duplicates.
|
|
||||||
sed "s/\(\.\|,\|;\|\!\\|\?\)$//;
|
|
||||||
s/^www./http:\/\/www\./")" # xdg-open will not detect url without http
|
|
||||||
|
|
||||||
[ -z "$urls" ] && exit 1
|
|
||||||
|
|
||||||
while getopts "hoc" o; do case "${o}" in
|
|
||||||
h) printf "Optional arguments for custom use:\\n -c: copy\\n -o: xdg-open\\n -h: Show this message\\n" && exit 1 ;;
|
|
||||||
o) chosen="$(echo "$urls" | dmenu -i -p 'Follow which url?' -l 10)"
|
|
||||||
setsid xdg-open "$chosen" >/dev/null 2>&1 & ;;
|
|
||||||
c) echo "$urls" | dmenu -i -p 'Copy which url?' -l 10 | tr -d '\n' | xclip -selection clipboard ;;
|
|
||||||
*) printf "Invalid option: -%s\\n" "$OPTARG" && exit 1 ;;
|
|
||||||
esac done
|
|
54
st.1
54
st.1
|
@ -125,41 +125,6 @@ and all the remaining arguments are used as a command
|
||||||
even without it.
|
even without it.
|
||||||
.SH SHORTCUTS
|
.SH SHORTCUTS
|
||||||
.TP
|
.TP
|
||||||
.B Alt-j/k or Alt-Up/Down or Alt-Mouse Wheel
|
|
||||||
Scroll up/down one line at a time.
|
|
||||||
.TP
|
|
||||||
.B Alt-u/d or Alt-Page Up/Page Down
|
|
||||||
Scroll up/down one screen at a time.
|
|
||||||
.TP
|
|
||||||
.B Alt-Shift-k/j or Alt-Shift-Page Up/Page Down or Alt-Shift-Mouse Wheel
|
|
||||||
Increase or decrease font size.
|
|
||||||
.TP
|
|
||||||
.B Alt-Home
|
|
||||||
Reset to default font size.
|
|
||||||
.TP
|
|
||||||
.B Shift-Insert or Alt-v
|
|
||||||
Paste from clipboard.
|
|
||||||
.TP
|
|
||||||
.B Alt-c
|
|
||||||
Copy to clipboard.
|
|
||||||
.TP
|
|
||||||
.B Alt-p
|
|
||||||
Paste/input primary selection.
|
|
||||||
.TP
|
|
||||||
.B Alt-l
|
|
||||||
Show dmenu menu of all URLs on screen and choose one to open.
|
|
||||||
.TP
|
|
||||||
.B Alt-y
|
|
||||||
Show dmenu menu of all URLs on screen and choose one to copy.
|
|
||||||
.TP
|
|
||||||
.B Alt-o
|
|
||||||
Show dmenu menu of all recently run commands and copy the output of the chosen command to the clipboard.
|
|
||||||
.I xclip
|
|
||||||
required.
|
|
||||||
.TP
|
|
||||||
.B Alt-a/s
|
|
||||||
Increase or decrease opacity/alpha value (make window more or less transparent).
|
|
||||||
.TP
|
|
||||||
.B Break
|
.B Break
|
||||||
Send a break in the serial line.
|
Send a break in the serial line.
|
||||||
Break key is obtained in PC keyboards
|
Break key is obtained in PC keyboards
|
||||||
|
@ -176,6 +141,24 @@ Print the full screen to the
|
||||||
.B Print Screen
|
.B Print Screen
|
||||||
Print the selection to the
|
Print the selection to the
|
||||||
.I iofile.
|
.I iofile.
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-Page Up
|
||||||
|
Increase font size.
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-Page Down
|
||||||
|
Decrease font size.
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-Home
|
||||||
|
Reset to default font size.
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-y
|
||||||
|
Paste from primary selection (middle mouse button).
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-c
|
||||||
|
Copy the selected text to the clipboard selection.
|
||||||
|
.TP
|
||||||
|
.B Ctrl-Shift-v
|
||||||
|
Paste from the clipboard selection.
|
||||||
.SH CUSTOMIZATION
|
.SH CUSTOMIZATION
|
||||||
.B st
|
.B st
|
||||||
can be customized by creating a custom config.h and (re)compiling the source
|
can be customized by creating a custom config.h and (re)compiling the source
|
||||||
|
@ -191,3 +174,4 @@ See the LICENSE file for the terms of redistribution.
|
||||||
.BR scroll (1)
|
.BR scroll (1)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
See the TODO file in the distribution.
|
See the TODO file in the distribution.
|
||||||
|
|
||||||
|
|
228
st.c
228
st.c
|
@ -35,7 +35,6 @@
|
||||||
#define ESC_ARG_SIZ 16
|
#define ESC_ARG_SIZ 16
|
||||||
#define STR_BUF_SIZ ESC_BUF_SIZ
|
#define STR_BUF_SIZ ESC_BUF_SIZ
|
||||||
#define STR_ARG_SIZ ESC_ARG_SIZ
|
#define STR_ARG_SIZ ESC_ARG_SIZ
|
||||||
#define HISTSIZE 2000
|
|
||||||
|
|
||||||
/* macros */
|
/* macros */
|
||||||
#define IS_SET(flag) ((term.mode & (flag)) != 0)
|
#define IS_SET(flag) ((term.mode & (flag)) != 0)
|
||||||
|
@ -43,10 +42,6 @@
|
||||||
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
|
#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
|
||||||
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
|
#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
|
||||||
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
|
#define ISDELIM(u) (u && wcschr(worddelimiters, u))
|
||||||
#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \
|
|
||||||
term.scr + HISTSIZE + 1) % HISTSIZE] : \
|
|
||||||
term.line[(y) - term.scr])
|
|
||||||
#define TLINE_HIST(y) ((y) <= HISTSIZE-term.row+2 ? term.hist[(y)] : term.line[(y-HISTSIZE+term.row-3)])
|
|
||||||
|
|
||||||
enum term_mode {
|
enum term_mode {
|
||||||
MODE_WRAP = 1 << 0,
|
MODE_WRAP = 1 << 0,
|
||||||
|
@ -118,12 +113,8 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int row; /* nb row */
|
int row; /* nb row */
|
||||||
int col; /* nb col */
|
int col; /* nb col */
|
||||||
int maxcol;
|
|
||||||
Line *line; /* screen */
|
Line *line; /* screen */
|
||||||
Line *alt; /* alternate screen */
|
Line *alt; /* alternate screen */
|
||||||
Line hist[HISTSIZE]; /* history buffer */
|
|
||||||
int histi; /* history index */
|
|
||||||
int scr; /* scroll back */
|
|
||||||
int *dirty; /* dirtyness of lines */
|
int *dirty; /* dirtyness of lines */
|
||||||
TCursor c; /* cursor */
|
TCursor c; /* cursor */
|
||||||
int ocx; /* old cursor col */
|
int ocx; /* old cursor col */
|
||||||
|
@ -194,8 +185,8 @@ static void tnewline(int);
|
||||||
static void tputtab(int);
|
static void tputtab(int);
|
||||||
static void tputc(Rune);
|
static void tputc(Rune);
|
||||||
static void treset(void);
|
static void treset(void);
|
||||||
static void tscrollup(int, int, int);
|
static void tscrollup(int, int);
|
||||||
static void tscrolldown(int, int, int);
|
static void tscrolldown(int, int);
|
||||||
static void tsetattr(const int *, int);
|
static void tsetattr(const int *, int);
|
||||||
static void tsetchar(Rune, const Glyph *, int, int);
|
static void tsetchar(Rune, const Glyph *, int, int);
|
||||||
static void tsetdirt(int, int);
|
static void tsetdirt(int, int);
|
||||||
|
@ -203,6 +194,7 @@ static void tsetscroll(int, int);
|
||||||
static void tswapscreen(void);
|
static void tswapscreen(void);
|
||||||
static void tsetmode(int, int, const int *, int);
|
static void tsetmode(int, int, const int *, int);
|
||||||
static int twrite(const char *, int, int);
|
static int twrite(const char *, int, int);
|
||||||
|
static void tfulldirt(void);
|
||||||
static void tcontrolcode(uchar );
|
static void tcontrolcode(uchar );
|
||||||
static void tdectest(char );
|
static void tdectest(char );
|
||||||
static void tdefutf8(char);
|
static void tdefutf8(char);
|
||||||
|
@ -280,8 +272,6 @@ xrealloc(void *p, size_t len)
|
||||||
char *
|
char *
|
||||||
xstrdup(const char *s)
|
xstrdup(const char *s)
|
||||||
{
|
{
|
||||||
if ((s = strdup(s)) == NULL)
|
|
||||||
die("strdup: %s\n", strerror(errno));
|
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if ((p = strdup(s)) == NULL)
|
if ((p = strdup(s)) == NULL)
|
||||||
|
@ -419,24 +409,10 @@ tlinelen(int y)
|
||||||
{
|
{
|
||||||
int i = term.col;
|
int i = term.col;
|
||||||
|
|
||||||
if (TLINE(y)[i - 1].mode & ATTR_WRAP)
|
if (term.line[y][i - 1].mode & ATTR_WRAP)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
while (i > 0 && TLINE(y)[i - 1].u == ' ')
|
while (i > 0 && term.line[y][i - 1].u == ' ')
|
||||||
--i;
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
tlinehistlen(int y)
|
|
||||||
{
|
|
||||||
int i = term.col;
|
|
||||||
|
|
||||||
if (TLINE_HIST(y)[i - 1].mode & ATTR_WRAP)
|
|
||||||
return i;
|
|
||||||
|
|
||||||
while (i > 0 && TLINE_HIST(y)[i - 1].u == ' ')
|
|
||||||
--i;
|
--i;
|
||||||
|
|
||||||
return i;
|
return i;
|
||||||
|
@ -488,7 +464,6 @@ selextend(int col, int row, int type, int done)
|
||||||
sel.mode = done ? SEL_IDLE : SEL_READY;
|
sel.mode = done ? SEL_IDLE : SEL_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
selnormalize(void)
|
selnormalize(void)
|
||||||
{
|
{
|
||||||
|
@ -546,7 +521,7 @@ selsnap(int *x, int *y, int direction)
|
||||||
* Snap around if the word wraps around at the end or
|
* Snap around if the word wraps around at the end or
|
||||||
* beginning of a line.
|
* beginning of a line.
|
||||||
*/
|
*/
|
||||||
prevgp = &TLINE(*y)[*x];
|
prevgp = &term.line[*y][*x];
|
||||||
prevdelim = ISDELIM(prevgp->u);
|
prevdelim = ISDELIM(prevgp->u);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
newx = *x + direction;
|
newx = *x + direction;
|
||||||
|
@ -561,14 +536,14 @@ selsnap(int *x, int *y, int direction)
|
||||||
yt = *y, xt = *x;
|
yt = *y, xt = *x;
|
||||||
else
|
else
|
||||||
yt = newy, xt = newx;
|
yt = newy, xt = newx;
|
||||||
if (!(TLINE(yt)[xt].mode & ATTR_WRAP))
|
if (!(term.line[yt][xt].mode & ATTR_WRAP))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newx >= tlinelen(newy))
|
if (newx >= tlinelen(newy))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
gp = &TLINE(newy)[newx];
|
gp = &term.line[newy][newx];
|
||||||
delim = ISDELIM(gp->u);
|
delim = ISDELIM(gp->u);
|
||||||
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|
||||||
|| (delim && gp->u != prevgp->u)))
|
|| (delim && gp->u != prevgp->u)))
|
||||||
|
@ -589,14 +564,14 @@ selsnap(int *x, int *y, int direction)
|
||||||
*x = (direction < 0) ? 0 : term.col - 1;
|
*x = (direction < 0) ? 0 : term.col - 1;
|
||||||
if (direction < 0) {
|
if (direction < 0) {
|
||||||
for (; *y > 0; *y += direction) {
|
for (; *y > 0; *y += direction) {
|
||||||
if (!(TLINE(*y-1)[term.col-1].mode
|
if (!(term.line[*y-1][term.col-1].mode
|
||||||
& ATTR_WRAP)) {
|
& ATTR_WRAP)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (direction > 0) {
|
} else if (direction > 0) {
|
||||||
for (; *y < term.row-1; *y += direction) {
|
for (; *y < term.row-1; *y += direction) {
|
||||||
if (!(TLINE(*y)[term.col-1].mode
|
if (!(term.line[*y][term.col-1].mode
|
||||||
& ATTR_WRAP)) {
|
& ATTR_WRAP)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -627,13 +602,13 @@ getsel(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel.type == SEL_RECTANGULAR) {
|
if (sel.type == SEL_RECTANGULAR) {
|
||||||
gp = &TLINE(y)[sel.nb.x];
|
gp = &term.line[y][sel.nb.x];
|
||||||
lastx = sel.ne.x;
|
lastx = sel.ne.x;
|
||||||
} else {
|
} else {
|
||||||
gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0];
|
gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0];
|
||||||
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1;
|
||||||
}
|
}
|
||||||
last = &TLINE(y)[MIN(lastx, linelen-1)];
|
last = &term.line[y][MIN(lastx, linelen-1)];
|
||||||
while (last >= gp && last->u == ' ')
|
while (last >= gp && last->u == ' ')
|
||||||
--last;
|
--last;
|
||||||
|
|
||||||
|
@ -869,9 +844,6 @@ void
|
||||||
ttywrite(const char *s, size_t n, int may_echo)
|
ttywrite(const char *s, size_t n, int may_echo)
|
||||||
{
|
{
|
||||||
const char *next;
|
const char *next;
|
||||||
Arg arg = (Arg) { .i = term.scr };
|
|
||||||
|
|
||||||
kscrolldown(&arg);
|
|
||||||
|
|
||||||
if (may_echo && IS_SET(MODE_ECHO))
|
if (may_echo && IS_SET(MODE_ECHO))
|
||||||
twrite(s, n, 1);
|
twrite(s, n, 1);
|
||||||
|
@ -967,7 +939,7 @@ ttyresize(int tw, int th)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ttyhangup(void)
|
ttyhangup()
|
||||||
{
|
{
|
||||||
/* Send SIGHUP to shell */
|
/* Send SIGHUP to shell */
|
||||||
kill(pid, SIGHUP);
|
kill(pid, SIGHUP);
|
||||||
|
@ -1083,53 +1055,13 @@ tswapscreen(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kscrolldown(const Arg* a)
|
tscrolldown(int orig, int n)
|
||||||
{
|
|
||||||
int n = a->i;
|
|
||||||
|
|
||||||
if (n < 0)
|
|
||||||
n = term.row + n;
|
|
||||||
|
|
||||||
if (n > term.scr)
|
|
||||||
n = term.scr;
|
|
||||||
|
|
||||||
if (term.scr > 0) {
|
|
||||||
term.scr -= n;
|
|
||||||
selscroll(0, -n);
|
|
||||||
tfulldirt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
kscrollup(const Arg* a)
|
|
||||||
{
|
|
||||||
int n = a->i;
|
|
||||||
|
|
||||||
if (n < 0)
|
|
||||||
n = term.row + n;
|
|
||||||
|
|
||||||
if (term.scr <= HISTSIZE-n) {
|
|
||||||
term.scr += n;
|
|
||||||
selscroll(0, n);
|
|
||||||
tfulldirt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
tscrolldown(int orig, int n, int copyhist)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Line temp;
|
Line temp;
|
||||||
|
|
||||||
LIMIT(n, 0, term.bot-orig+1);
|
LIMIT(n, 0, term.bot-orig+1);
|
||||||
|
|
||||||
if (copyhist) {
|
|
||||||
term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
|
|
||||||
temp = term.hist[term.histi];
|
|
||||||
term.hist[term.histi] = term.line[term.bot];
|
|
||||||
term.line[term.bot] = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
tsetdirt(orig, term.bot-n);
|
tsetdirt(orig, term.bot-n);
|
||||||
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
|
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
|
||||||
|
|
||||||
|
@ -1139,28 +1071,17 @@ tscrolldown(int orig, int n, int copyhist)
|
||||||
term.line[i-n] = temp;
|
term.line[i-n] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term.scr == 0)
|
|
||||||
selscroll(orig, n);
|
selscroll(orig, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tscrollup(int orig, int n, int copyhist)
|
tscrollup(int orig, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Line temp;
|
Line temp;
|
||||||
|
|
||||||
LIMIT(n, 0, term.bot-orig+1);
|
LIMIT(n, 0, term.bot-orig+1);
|
||||||
|
|
||||||
if (copyhist) {
|
|
||||||
term.histi = (term.histi + 1) % HISTSIZE;
|
|
||||||
temp = term.hist[term.histi];
|
|
||||||
term.hist[term.histi] = term.line[orig];
|
|
||||||
term.line[orig] = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (term.scr > 0 && term.scr < HISTSIZE)
|
|
||||||
term.scr = MIN(term.scr + n, HISTSIZE-1);
|
|
||||||
|
|
||||||
tclearregion(0, orig, term.col-1, orig+n-1);
|
tclearregion(0, orig, term.col-1, orig+n-1);
|
||||||
tsetdirt(orig+n, term.bot);
|
tsetdirt(orig+n, term.bot);
|
||||||
|
|
||||||
|
@ -1170,7 +1091,6 @@ tscrollup(int orig, int n, int copyhist)
|
||||||
term.line[i+n] = temp;
|
term.line[i+n] = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term.scr == 0)
|
|
||||||
selscroll(orig, -n);
|
selscroll(orig, -n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1200,7 +1120,7 @@ tnewline(int first_col)
|
||||||
int y = term.c.y;
|
int y = term.c.y;
|
||||||
|
|
||||||
if (y == term.bot) {
|
if (y == term.bot) {
|
||||||
tscrollup(term.top, 1, 1);
|
tscrollup(term.top, 1);
|
||||||
} else {
|
} else {
|
||||||
y++;
|
y++;
|
||||||
}
|
}
|
||||||
|
@ -1295,9 +1215,6 @@ tsetchar(Rune u, const Glyph *attr, int x, int y)
|
||||||
term.dirty[y] = 1;
|
term.dirty[y] = 1;
|
||||||
term.line[y][x] = *attr;
|
term.line[y][x] = *attr;
|
||||||
term.line[y][x].u = u;
|
term.line[y][x].u = u;
|
||||||
|
|
||||||
if (isboxdraw(u))
|
|
||||||
term.line[y][x].mode |= ATTR_BOXDRAW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1311,8 +1228,8 @@ tclearregion(int x1, int y1, int x2, int y2)
|
||||||
if (y1 > y2)
|
if (y1 > y2)
|
||||||
temp = y1, y1 = y2, y2 = temp;
|
temp = y1, y1 = y2, y2 = temp;
|
||||||
|
|
||||||
LIMIT(x1, 0, term.maxcol-1);
|
LIMIT(x1, 0, term.col-1);
|
||||||
LIMIT(x2, 0, term.maxcol-1);
|
LIMIT(x2, 0, term.col-1);
|
||||||
LIMIT(y1, 0, term.row-1);
|
LIMIT(y1, 0, term.row-1);
|
||||||
LIMIT(y2, 0, term.row-1);
|
LIMIT(y2, 0, term.row-1);
|
||||||
|
|
||||||
|
@ -1368,14 +1285,14 @@ void
|
||||||
tinsertblankline(int n)
|
tinsertblankline(int n)
|
||||||
{
|
{
|
||||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||||
tscrolldown(term.c.y, n, 0);
|
tscrolldown(term.c.y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tdeleteline(int n)
|
tdeleteline(int n)
|
||||||
{
|
{
|
||||||
if (BETWEEN(term.c.y, term.top, term.bot))
|
if (BETWEEN(term.c.y, term.top, term.bot))
|
||||||
tscrollup(term.c.y, n, 0);
|
tscrollup(term.c.y, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
|
@ -1812,11 +1729,11 @@ csihandle(void)
|
||||||
break;
|
break;
|
||||||
case 'S': /* SU -- Scroll <n> line up */
|
case 'S': /* SU -- Scroll <n> line up */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tscrollup(term.top, csiescseq.arg[0], 0);
|
tscrollup(term.top, csiescseq.arg[0]);
|
||||||
break;
|
break;
|
||||||
case 'T': /* SD -- Scroll <n> line down */
|
case 'T': /* SD -- Scroll <n> line down */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
tscrolldown(term.top, csiescseq.arg[0], 0);
|
tscrolldown(term.top, csiescseq.arg[0]);
|
||||||
break;
|
break;
|
||||||
case 'L': /* IL -- Insert <n> blank lines */
|
case 'L': /* IL -- Insert <n> blank lines */
|
||||||
DEFAULT(csiescseq.arg[0], 1);
|
DEFAULT(csiescseq.arg[0], 1);
|
||||||
|
@ -2064,61 +1981,6 @@ strparse(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
externalpipe(const Arg *arg)
|
|
||||||
{
|
|
||||||
int to[2];
|
|
||||||
char buf[UTF_SIZ];
|
|
||||||
void (*oldsigpipe)(int);
|
|
||||||
Glyph *bp, *end;
|
|
||||||
int lastpos, n, newline;
|
|
||||||
|
|
||||||
if (pipe(to) == -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (fork()) {
|
|
||||||
case -1:
|
|
||||||
close(to[0]);
|
|
||||||
close(to[1]);
|
|
||||||
return;
|
|
||||||
case 0:
|
|
||||||
dup2(to[0], STDIN_FILENO);
|
|
||||||
close(to[0]);
|
|
||||||
close(to[1]);
|
|
||||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
|
||||||
fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
|
|
||||||
perror("failed");
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
close(to[0]);
|
|
||||||
/* ignore sigpipe for now, in case child exists early */
|
|
||||||
oldsigpipe = signal(SIGPIPE, SIG_IGN);
|
|
||||||
newline = 0;
|
|
||||||
for (n = 0; n <= HISTSIZE + 2; n++) {
|
|
||||||
bp = TLINE_HIST(n);
|
|
||||||
lastpos = MIN(tlinehistlen(n) + 1, term.col) - 1;
|
|
||||||
if (lastpos < 0)
|
|
||||||
break;
|
|
||||||
if (lastpos == 0)
|
|
||||||
continue;
|
|
||||||
end = &bp[lastpos + 1];
|
|
||||||
for (; bp < end; ++bp)
|
|
||||||
if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
|
|
||||||
break;
|
|
||||||
if ((newline = TLINE_HIST(n)[lastpos].mode & ATTR_WRAP))
|
|
||||||
continue;
|
|
||||||
if (xwrite(to[1], "\n", 1) < 0)
|
|
||||||
break;
|
|
||||||
newline = 0;
|
|
||||||
}
|
|
||||||
if (newline)
|
|
||||||
(void)xwrite(to[1], "\n", 1);
|
|
||||||
close(to[1]);
|
|
||||||
/* restore */
|
|
||||||
signal(SIGPIPE, oldsigpipe);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
strdump(void)
|
strdump(void)
|
||||||
{
|
{
|
||||||
|
@ -2434,7 +2296,7 @@ eschandle(uchar ascii)
|
||||||
return 0;
|
return 0;
|
||||||
case 'D': /* IND -- Linefeed */
|
case 'D': /* IND -- Linefeed */
|
||||||
if (term.c.y == term.bot) {
|
if (term.c.y == term.bot) {
|
||||||
tscrollup(term.top, 1, 1);
|
tscrollup(term.top, 1);
|
||||||
} else {
|
} else {
|
||||||
tmoveto(term.c.x, term.c.y+1);
|
tmoveto(term.c.x, term.c.y+1);
|
||||||
}
|
}
|
||||||
|
@ -2447,7 +2309,7 @@ eschandle(uchar ascii)
|
||||||
break;
|
break;
|
||||||
case 'M': /* RI -- Reverse index */
|
case 'M': /* RI -- Reverse index */
|
||||||
if (term.c.y == term.top) {
|
if (term.c.y == term.top) {
|
||||||
tscrolldown(term.top, 1, 1);
|
tscrolldown(term.top, 1);
|
||||||
} else {
|
} else {
|
||||||
tmoveto(term.c.x, term.c.y-1);
|
tmoveto(term.c.x, term.c.y-1);
|
||||||
}
|
}
|
||||||
|
@ -2661,19 +2523,12 @@ twrite(const char *buf, int buflen, int show_ctrl)
|
||||||
void
|
void
|
||||||
tresize(int col, int row)
|
tresize(int col, int row)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
int tmp;
|
int minrow = MIN(row, term.row);
|
||||||
int minrow, mincol;
|
int mincol = MIN(col, term.col);
|
||||||
int *bp;
|
int *bp;
|
||||||
TCursor c;
|
TCursor c;
|
||||||
|
|
||||||
tmp = col;
|
|
||||||
if (!term.maxcol)
|
|
||||||
term.maxcol = term.col;
|
|
||||||
col = MAX(col, term.maxcol);
|
|
||||||
minrow = MIN(row, term.row);
|
|
||||||
mincol = MIN(col, term.maxcol);
|
|
||||||
|
|
||||||
if (col < 1 || row < 1) {
|
if (col < 1 || row < 1) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"tresize: error resizing to %dx%d\n", col, row);
|
"tresize: error resizing to %dx%d\n", col, row);
|
||||||
|
@ -2705,14 +2560,6 @@ tresize(int col, int row)
|
||||||
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
|
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
|
||||||
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
|
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
|
||||||
|
|
||||||
for (i = 0; i < HISTSIZE; i++) {
|
|
||||||
term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
|
|
||||||
for (j = mincol; j < col; j++) {
|
|
||||||
term.hist[i][j] = term.c.attr;
|
|
||||||
term.hist[i][j].u = ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* resize each row to new width, zero-pad if needed */
|
/* resize each row to new width, zero-pad if needed */
|
||||||
for (i = 0; i < minrow; i++) {
|
for (i = 0; i < minrow; i++) {
|
||||||
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
|
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
|
||||||
|
@ -2724,18 +2571,17 @@ tresize(int col, int row)
|
||||||
term.line[i] = xmalloc(col * sizeof(Glyph));
|
term.line[i] = xmalloc(col * sizeof(Glyph));
|
||||||
term.alt[i] = xmalloc(col * sizeof(Glyph));
|
term.alt[i] = xmalloc(col * sizeof(Glyph));
|
||||||
}
|
}
|
||||||
if (col > term.maxcol) {
|
if (col > term.col) {
|
||||||
bp = term.tabs + term.maxcol;
|
bp = term.tabs + term.col;
|
||||||
|
|
||||||
memset(bp, 0, sizeof(*term.tabs) * (col - term.maxcol));
|
memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
|
||||||
while (--bp > term.tabs && !*bp)
|
while (--bp > term.tabs && !*bp)
|
||||||
/* nothing */ ;
|
/* nothing */ ;
|
||||||
for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces)
|
for (bp += tabspaces; bp < term.tabs + col; bp += tabspaces)
|
||||||
*bp = 1;
|
*bp = 1;
|
||||||
}
|
}
|
||||||
/* update terminal size */
|
/* update terminal size */
|
||||||
term.col = tmp;
|
term.col = col;
|
||||||
term.maxcol = col;
|
|
||||||
term.row = row;
|
term.row = row;
|
||||||
/* reset scrolling region */
|
/* reset scrolling region */
|
||||||
tsetscroll(0, row-1);
|
tsetscroll(0, row-1);
|
||||||
|
@ -2772,7 +2618,7 @@ drawregion(int x1, int y1, int x2, int y2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
term.dirty[y] = 0;
|
term.dirty[y] = 0;
|
||||||
xdrawline(TLINE(y), x1, y, x2);
|
xdrawline(term.line[y], x1, y, x2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2793,13 +2639,8 @@ draw(void)
|
||||||
cx--;
|
cx--;
|
||||||
|
|
||||||
drawregion(0, 0, term.col, term.row);
|
drawregion(0, 0, term.col, term.row);
|
||||||
if (term.scr == 0)
|
|
||||||
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
|
||||||
term.ocx, term.ocy, term.line[term.ocy][term.ocx],
|
term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
|
||||||
term.line[term.ocy], term.col);
|
|
||||||
/* xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], */
|
|
||||||
/* term.ocx, term.ocy, term.line[term.ocy][term.ocx], */
|
|
||||||
/* term.line[term.ocy], term.col); */
|
|
||||||
term.ocx = cx;
|
term.ocx = cx;
|
||||||
term.ocy = term.c.y;
|
term.ocy = term.c.y;
|
||||||
xfinishdraw();
|
xfinishdraw();
|
||||||
|
@ -2813,4 +2654,3 @@ redraw(void)
|
||||||
tfulldirt();
|
tfulldirt();
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
st.h
22
st.h
|
@ -11,8 +11,7 @@
|
||||||
#define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d))
|
#define DIVCEIL(n, d) (((n) + ((d) - 1)) / (d))
|
||||||
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
|
#define DEFAULT(a, b) (a) = (a) ? (a) : (b)
|
||||||
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
|
#define LIMIT(x, a, b) (x) = (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
|
||||||
#define ATTRCMP(a, b) (((a).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) != ((b).mode & (~ATTR_WRAP) & (~ATTR_LIGA)) || \
|
#define ATTRCMP(a, b) ((a).mode != (b).mode || (a).fg != (b).fg || \
|
||||||
(a).fg != (b).fg || \
|
|
||||||
(a).bg != (b).bg)
|
(a).bg != (b).bg)
|
||||||
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
|
#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + \
|
||||||
(t1.tv_nsec-t2.tv_nsec)/1E6)
|
(t1.tv_nsec-t2.tv_nsec)/1E6)
|
||||||
|
@ -34,8 +33,6 @@ enum glyph_attribute {
|
||||||
ATTR_WRAP = 1 << 8,
|
ATTR_WRAP = 1 << 8,
|
||||||
ATTR_WIDE = 1 << 9,
|
ATTR_WIDE = 1 << 9,
|
||||||
ATTR_WDUMMY = 1 << 10,
|
ATTR_WDUMMY = 1 << 10,
|
||||||
ATTR_BOXDRAW = 1 << 11,
|
|
||||||
ATTR_LIGA = 1 << 12,
|
|
||||||
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,13 +79,8 @@ typedef union {
|
||||||
|
|
||||||
void die(const char *, ...);
|
void die(const char *, ...);
|
||||||
void redraw(void);
|
void redraw(void);
|
||||||
void tfulldirt(void);
|
|
||||||
void draw(void);
|
void draw(void);
|
||||||
|
|
||||||
void externalpipe(const Arg *);
|
|
||||||
void kscrolldown(const Arg *);
|
|
||||||
void kscrollup(const Arg *);
|
|
||||||
|
|
||||||
void printscreen(const Arg *);
|
void printscreen(const Arg *);
|
||||||
void printsel(const Arg *);
|
void printsel(const Arg *);
|
||||||
void sendbreak(const Arg *);
|
void sendbreak(const Arg *);
|
||||||
|
@ -119,14 +111,6 @@ void *xmalloc(size_t);
|
||||||
void *xrealloc(void *, size_t);
|
void *xrealloc(void *, size_t);
|
||||||
char *xstrdup(const char *);
|
char *xstrdup(const char *);
|
||||||
|
|
||||||
int isboxdraw(Rune);
|
|
||||||
ushort boxdrawindex(const Glyph *);
|
|
||||||
#ifdef XFT_VERSION
|
|
||||||
/* only exposed to x.c, otherwise we'll need Xft.h for the types */
|
|
||||||
void boxdraw_xinit(Display *, Colormap, XftDraw *, Visual *);
|
|
||||||
void drawboxes(int, int, int, int, XftColor *, XftColor *, const XftGlyphFontSpec *, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* config.h globals */
|
/* config.h globals */
|
||||||
extern char *utmp;
|
extern char *utmp;
|
||||||
extern char *scroll;
|
extern char *scroll;
|
||||||
|
@ -139,8 +123,4 @@ extern char *termname;
|
||||||
extern unsigned int tabspaces;
|
extern unsigned int tabspaces;
|
||||||
extern unsigned int defaultfg;
|
extern unsigned int defaultfg;
|
||||||
extern unsigned int defaultbg;
|
extern unsigned int defaultbg;
|
||||||
extern float alpha;
|
|
||||||
extern float alphaUnfocus;
|
|
||||||
extern const int boxdraw, boxdraw_bold, boxdraw_braille;
|
|
||||||
extern unsigned int defaultcs;
|
extern unsigned int defaultcs;
|
||||||
|
|
||||||
|
|
3
win.h
3
win.h
|
@ -25,7 +25,7 @@ enum win_mode {
|
||||||
|
|
||||||
void xbell(void);
|
void xbell(void);
|
||||||
void xclipcopy(void);
|
void xclipcopy(void);
|
||||||
void xdrawcursor(int, int, Glyph, int, int, Glyph, Line, int);
|
void xdrawcursor(int, int, Glyph, int, int, Glyph);
|
||||||
void xdrawline(Line, int, int, int);
|
void xdrawline(Line, int, int, int);
|
||||||
void xfinishdraw(void);
|
void xfinishdraw(void);
|
||||||
void xloadcols(void);
|
void xloadcols(void);
|
||||||
|
@ -39,4 +39,3 @@ void xsetpointermotion(int);
|
||||||
void xsetsel(char *);
|
void xsetsel(char *);
|
||||||
int xstartdraw(void);
|
int xstartdraw(void);
|
||||||
void xximspot(int, int);
|
void xximspot(int, int);
|
||||||
|
|
||||||
|
|
412
x.c
412
x.c
|
@ -14,13 +14,11 @@
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/Xft/Xft.h>
|
#include <X11/Xft/Xft.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include <X11/Xresource.h>
|
|
||||||
|
|
||||||
char *argv0;
|
char *argv0;
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
#include "st.h"
|
#include "st.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "hb.h"
|
|
||||||
|
|
||||||
/* types used in config.h */
|
/* types used in config.h */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -47,19 +45,6 @@ typedef struct {
|
||||||
signed char appcursor; /* application cursor */
|
signed char appcursor; /* application cursor */
|
||||||
} Key;
|
} Key;
|
||||||
|
|
||||||
/* Xresources preferences */
|
|
||||||
enum resource_type {
|
|
||||||
STRING = 0,
|
|
||||||
INTEGER = 1,
|
|
||||||
FLOAT = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
enum resource_type type;
|
|
||||||
void *dst;
|
|
||||||
} ResourcePref;
|
|
||||||
|
|
||||||
/* X modifiers */
|
/* X modifiers */
|
||||||
#define XK_ANY_MOD UINT_MAX
|
#define XK_ANY_MOD UINT_MAX
|
||||||
#define XK_NO_MOD 0
|
#define XK_NO_MOD 0
|
||||||
|
@ -70,7 +55,6 @@ static void clipcopy(const Arg *);
|
||||||
static void clippaste(const Arg *);
|
static void clippaste(const Arg *);
|
||||||
static void numlock(const Arg *);
|
static void numlock(const Arg *);
|
||||||
static void selpaste(const Arg *);
|
static void selpaste(const Arg *);
|
||||||
static void changealpha(const Arg *);
|
|
||||||
static void zoom(const Arg *);
|
static void zoom(const Arg *);
|
||||||
static void zoomabs(const Arg *);
|
static void zoomabs(const Arg *);
|
||||||
static void zoomreset(const Arg *);
|
static void zoomreset(const Arg *);
|
||||||
|
@ -121,7 +105,6 @@ typedef struct {
|
||||||
XSetWindowAttributes attrs;
|
XSetWindowAttributes attrs;
|
||||||
int scr;
|
int scr;
|
||||||
int isfixed; /* is fixed geometry? */
|
int isfixed; /* is fixed geometry? */
|
||||||
int depth; /* bit depth */
|
|
||||||
int l, t; /* left and top offset */
|
int l, t; /* left and top offset */
|
||||||
int gm; /* geometry mask */
|
int gm; /* geometry mask */
|
||||||
} XWindow;
|
} XWindow;
|
||||||
|
@ -173,8 +156,6 @@ static void xresize(int, int);
|
||||||
static void xhints(void);
|
static void xhints(void);
|
||||||
static int xloadcolor(int, const char *, Color *);
|
static int xloadcolor(int, const char *, Color *);
|
||||||
static int xloadfont(Font *, FcPattern *);
|
static int xloadfont(Font *, FcPattern *);
|
||||||
static int xloadsparefont(FcPattern *, int);
|
|
||||||
static void xloadsparefonts(void);
|
|
||||||
static void xloadfonts(const char *, double);
|
static void xloadfonts(const char *, double);
|
||||||
static void xunloadfont(Font *);
|
static void xunloadfont(Font *);
|
||||||
static void xunloadfonts(void);
|
static void xunloadfonts(void);
|
||||||
|
@ -182,7 +163,6 @@ static void xsetenv(void);
|
||||||
static void xseturgency(int);
|
static void xseturgency(int);
|
||||||
static int evcol(XEvent *);
|
static int evcol(XEvent *);
|
||||||
static int evrow(XEvent *);
|
static int evrow(XEvent *);
|
||||||
static float clamp(float, float, float);
|
|
||||||
|
|
||||||
static void expose(XEvent *);
|
static void expose(XEvent *);
|
||||||
static void visibility(XEvent *);
|
static void visibility(XEvent *);
|
||||||
|
@ -263,7 +243,6 @@ static char *usedfont = NULL;
|
||||||
static double usedfontsize = 0;
|
static double usedfontsize = 0;
|
||||||
static double defaultfontsize = 0;
|
static double defaultfontsize = 0;
|
||||||
|
|
||||||
static char *opt_alpha = NULL;
|
|
||||||
static char *opt_class = NULL;
|
static char *opt_class = NULL;
|
||||||
static char **opt_cmd = NULL;
|
static char **opt_cmd = NULL;
|
||||||
static char *opt_embed = NULL;
|
static char *opt_embed = NULL;
|
||||||
|
@ -273,9 +252,6 @@ static char *opt_line = NULL;
|
||||||
static char *opt_name = NULL;
|
static char *opt_name = NULL;
|
||||||
static char *opt_title = NULL;
|
static char *opt_title = NULL;
|
||||||
|
|
||||||
static int focused = 0;
|
|
||||||
|
|
||||||
static int oldbutton = 3; /* button event on startup: 3 = release */
|
|
||||||
static uint buttons; /* bit field of pressed buttons */
|
static uint buttons; /* bit field of pressed buttons */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -316,18 +292,6 @@ numlock(const Arg *dummy)
|
||||||
win.mode ^= MODE_NUMLOCK;
|
win.mode ^= MODE_NUMLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
changealpha(const Arg *arg)
|
|
||||||
{
|
|
||||||
if((alpha > 0 && arg->f < 0) || (alpha < 1 && arg->f > 0))
|
|
||||||
alpha += arg->f;
|
|
||||||
alpha = clamp(alpha, 0.0, 1.0);
|
|
||||||
alphaUnfocus = clamp(alpha-alphaOffset, 0.0, 1.0);
|
|
||||||
|
|
||||||
xloadcols();
|
|
||||||
redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
zoom(const Arg *arg)
|
zoom(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -342,7 +306,6 @@ zoomabs(const Arg *arg)
|
||||||
{
|
{
|
||||||
xunloadfonts();
|
xunloadfonts();
|
||||||
xloadfonts(usedfont, arg->f);
|
xloadfonts(usedfont, arg->f);
|
||||||
xloadsparefonts();
|
|
||||||
cresize(0, 0);
|
cresize(0, 0);
|
||||||
redraw();
|
redraw();
|
||||||
xhints();
|
xhints();
|
||||||
|
@ -381,15 +344,6 @@ evrow(XEvent *e)
|
||||||
return y / win.ch;
|
return y / win.ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
|
||||||
clamp(float value, float lower, float upper) {
|
|
||||||
if(value < lower)
|
|
||||||
return lower;
|
|
||||||
if(value > upper)
|
|
||||||
return upper;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mousesel(XEvent *e, int done)
|
mousesel(XEvent *e, int done)
|
||||||
{
|
{
|
||||||
|
@ -410,59 +364,68 @@ mousesel(XEvent *e, int done)
|
||||||
void
|
void
|
||||||
mousereport(XEvent *e)
|
mousereport(XEvent *e)
|
||||||
{
|
{
|
||||||
int len, x = evcol(e), y = evrow(e),
|
int len, btn, code;
|
||||||
button = e->xbutton.button, state = e->xbutton.state;
|
int x = evcol(e), y = evrow(e);
|
||||||
|
int state = e->xbutton.state;
|
||||||
char buf[40];
|
char buf[40];
|
||||||
static int ox, oy;
|
static int ox, oy;
|
||||||
|
|
||||||
/* from urxvt */
|
if (e->type == MotionNotify) {
|
||||||
if (e->xbutton.type == MotionNotify) {
|
|
||||||
if (x == ox && y == oy)
|
if (x == ox && y == oy)
|
||||||
return;
|
return;
|
||||||
if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
|
if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
|
||||||
return;
|
return;
|
||||||
/* MOUSE_MOTION: no reporting if no button is pressed */
|
/* MODE_MOUSEMOTION: no reporting if no button is pressed */
|
||||||
if (IS_SET(MODE_MOUSEMOTION) && oldbutton == 3)
|
if (IS_SET(MODE_MOUSEMOTION) && buttons == 0)
|
||||||
return;
|
return;
|
||||||
|
/* Set btn to lowest-numbered pressed button, or 12 if no
|
||||||
button = oldbutton + 32;
|
* buttons are pressed. */
|
||||||
ox = x;
|
for (btn = 1; btn <= 11 && !(buttons & (1<<(btn-1))); btn++)
|
||||||
oy = y;
|
;
|
||||||
|
code = 32;
|
||||||
} else {
|
} else {
|
||||||
if (!IS_SET(MODE_MOUSESGR) && e->xbutton.type == ButtonRelease) {
|
btn = e->xbutton.button;
|
||||||
button = 3;
|
/* Only buttons 1 through 11 can be encoded */
|
||||||
} else {
|
if (btn < 1 || btn > 11)
|
||||||
button -= Button1;
|
return;
|
||||||
if (button >= 3)
|
if (e->type == ButtonRelease) {
|
||||||
button += 64 - 3;
|
|
||||||
}
|
|
||||||
if (e->xbutton.type == ButtonPress) {
|
|
||||||
oldbutton = button;
|
|
||||||
ox = x;
|
|
||||||
oy = y;
|
|
||||||
} else if (e->xbutton.type == ButtonRelease) {
|
|
||||||
oldbutton = 3;
|
|
||||||
/* MODE_MOUSEX10: no button release reporting */
|
/* MODE_MOUSEX10: no button release reporting */
|
||||||
if (IS_SET(MODE_MOUSEX10))
|
if (IS_SET(MODE_MOUSEX10))
|
||||||
return;
|
return;
|
||||||
if (button == 64 || button == 65)
|
/* Don't send release events for the scroll wheel */
|
||||||
|
if (btn == 4 || btn == 5)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
code = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ox = x;
|
||||||
|
oy = y;
|
||||||
|
|
||||||
|
/* Encode btn into code. If no button is pressed for a motion event in
|
||||||
|
* MODE_MOUSEMANY, then encode it as a release. */
|
||||||
|
if ((!IS_SET(MODE_MOUSESGR) && e->type == ButtonRelease) || btn == 12)
|
||||||
|
code += 3;
|
||||||
|
else if (btn >= 8)
|
||||||
|
code += 128 + btn - 8;
|
||||||
|
else if (btn >= 4)
|
||||||
|
code += 64 + btn - 4;
|
||||||
|
else
|
||||||
|
code += btn - 1;
|
||||||
|
|
||||||
if (!IS_SET(MODE_MOUSEX10)) {
|
if (!IS_SET(MODE_MOUSEX10)) {
|
||||||
button += ((state & ShiftMask ) ? 4 : 0)
|
code += ((state & ShiftMask ) ? 4 : 0)
|
||||||
+ ((state & Mod4Mask ) ? 8 : 0)
|
+ ((state & Mod1Mask ) ? 8 : 0) /* meta key: alt */
|
||||||
+ ((state & ControlMask) ? 16 : 0);
|
+ ((state & ControlMask) ? 16 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SET(MODE_MOUSESGR)) {
|
if (IS_SET(MODE_MOUSESGR)) {
|
||||||
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
|
len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
|
||||||
button, x+1, y+1,
|
code, x+1, y+1,
|
||||||
e->type == ButtonRelease ? 'm' : 'M');
|
e->type == ButtonRelease ? 'm' : 'M');
|
||||||
} else if (x < 223 && y < 223) {
|
} else if (x < 223 && y < 223) {
|
||||||
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c",
|
len = snprintf(buf, sizeof(buf), "\033[M%c%c%c",
|
||||||
32+button, 32+x+1, 32+y+1);
|
32+code, 32+x+1, 32+y+1);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -789,7 +752,7 @@ xresize(int col, int row)
|
||||||
|
|
||||||
XFreePixmap(xw.dpy, xw.buf);
|
XFreePixmap(xw.dpy, xw.buf);
|
||||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
xw.depth);
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XftDrawChange(xw.draw, xw.buf);
|
XftDrawChange(xw.draw, xw.buf);
|
||||||
xclear(0, 0, win.w, win.h);
|
xclear(0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
@ -827,16 +790,6 @@ xloadcolor(int i, const char *name, Color *ncolor)
|
||||||
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
|
return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
xloadalpha(void)
|
|
||||||
{
|
|
||||||
float const usedAlpha = focused ? alpha : alphaUnfocus;
|
|
||||||
if (opt_alpha) alpha = strtof(opt_alpha, NULL);
|
|
||||||
dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * usedAlpha);
|
|
||||||
dc.col[defaultbg].pixel &= 0x00FFFFFF;
|
|
||||||
dc.col[defaultbg].pixel |= (unsigned char)(0xff * usedAlpha) << 24;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xloadcols(void)
|
xloadcols(void)
|
||||||
{
|
{
|
||||||
|
@ -844,23 +797,21 @@ xloadcols(void)
|
||||||
static int loaded;
|
static int loaded;
|
||||||
Color *cp;
|
Color *cp;
|
||||||
|
|
||||||
if (!loaded) {
|
if (loaded) {
|
||||||
dc.collen = 1 + (defaultbg = MAX(LEN(colorname), 256));
|
for (cp = dc.col; cp < &dc.col[dc.collen]; ++cp)
|
||||||
|
XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
|
||||||
|
} else {
|
||||||
|
dc.collen = MAX(LEN(colorname), 256);
|
||||||
dc.col = xmalloc(dc.collen * sizeof(Color));
|
dc.col = xmalloc(dc.collen * sizeof(Color));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i+1 < dc.collen; i++)
|
for (i = 0; i < dc.collen; i++)
|
||||||
if (!xloadcolor(i, NULL, &dc.col[i])) {
|
if (!xloadcolor(i, NULL, &dc.col[i])) {
|
||||||
if (colorname[i])
|
if (colorname[i])
|
||||||
die("could not allocate color '%s'\n", colorname[i]);
|
die("could not allocate color '%s'\n", colorname[i]);
|
||||||
else
|
else
|
||||||
die("could not allocate color %d\n", i);
|
die("could not allocate color %d\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dc.collen) // cannot die, as the color is already loaded.
|
|
||||||
xloadcolor(background, NULL, &dc.col[defaultbg]);
|
|
||||||
|
|
||||||
xloadalpha();
|
|
||||||
loaded = 1;
|
loaded = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,8 +859,8 @@ xclear(int x1, int y1, int x2, int y2)
|
||||||
void
|
void
|
||||||
xhints(void)
|
xhints(void)
|
||||||
{
|
{
|
||||||
XClassHint class = {opt_name ? opt_name : "st",
|
XClassHint class = {opt_name ? opt_name : termname,
|
||||||
opt_class ? opt_class : "St"};
|
opt_class ? opt_class : termname};
|
||||||
XWMHints wm = {.flags = InputHint, .input = 1};
|
XWMHints wm = {.flags = InputHint, .input = 1};
|
||||||
XSizeHints *sizeh;
|
XSizeHints *sizeh;
|
||||||
|
|
||||||
|
@ -1099,101 +1050,6 @@ xloadfonts(const char *fontstr, double fontsize)
|
||||||
FcPatternDestroy(pattern);
|
FcPatternDestroy(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
xloadsparefont(FcPattern *pattern, int flags)
|
|
||||||
{
|
|
||||||
FcPattern *match;
|
|
||||||
FcResult result;
|
|
||||||
|
|
||||||
match = FcFontMatch(NULL, pattern, &result);
|
|
||||||
if (!match) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(frc[frclen].font = XftFontOpenPattern(xw.dpy, match))) {
|
|
||||||
FcPatternDestroy(match);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
frc[frclen].flags = flags;
|
|
||||||
/* Believe U+0000 glyph will present in each default font */
|
|
||||||
frc[frclen].unicodep = 0;
|
|
||||||
frclen++;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
xloadsparefonts(void)
|
|
||||||
{
|
|
||||||
FcPattern *pattern;
|
|
||||||
double sizeshift, fontval;
|
|
||||||
int fc;
|
|
||||||
char **fp;
|
|
||||||
|
|
||||||
if (frclen != 0)
|
|
||||||
die("can't embed spare fonts. cache isn't empty");
|
|
||||||
|
|
||||||
/* Calculate count of spare fonts */
|
|
||||||
fc = sizeof(font2) / sizeof(*font2);
|
|
||||||
if (fc == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Allocate memory for cache entries. */
|
|
||||||
if (frccap < 4 * fc) {
|
|
||||||
frccap += 4 * fc - frccap;
|
|
||||||
frc = xrealloc(frc, frccap * sizeof(Fontcache));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (fp = font2; fp - font2 < fc; ++fp) {
|
|
||||||
|
|
||||||
if (**fp == '-')
|
|
||||||
pattern = XftXlfdParse(*fp, False, False);
|
|
||||||
else
|
|
||||||
pattern = FcNameParse((FcChar8 *)*fp);
|
|
||||||
|
|
||||||
if (!pattern)
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
if (defaultfontsize > 0) {
|
|
||||||
sizeshift = usedfontsize - defaultfontsize;
|
|
||||||
if (sizeshift != 0 &&
|
|
||||||
FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) ==
|
|
||||||
FcResultMatch) {
|
|
||||||
fontval += sizeshift;
|
|
||||||
FcPatternDel(pattern, FC_PIXEL_SIZE);
|
|
||||||
FcPatternDel(pattern, FC_SIZE);
|
|
||||||
FcPatternAddDouble(pattern, FC_PIXEL_SIZE, fontval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FcPatternAddBool(pattern, FC_SCALABLE, 1);
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
|
|
||||||
XftDefaultSubstitute(xw.dpy, xw.scr, pattern);
|
|
||||||
|
|
||||||
if (xloadsparefont(pattern, FRC_NORMAL))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_SLANT);
|
|
||||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
|
|
||||||
if (xloadsparefont(pattern, FRC_ITALIC))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_WEIGHT);
|
|
||||||
FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
|
|
||||||
if (xloadsparefont(pattern, FRC_ITALICBOLD))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDel(pattern, FC_SLANT);
|
|
||||||
FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
|
|
||||||
if (xloadsparefont(pattern, FRC_BOLD))
|
|
||||||
die("can't open spare font %s\n", *fp);
|
|
||||||
|
|
||||||
FcPatternDestroy(pattern);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
xunloadfont(Font *f)
|
xunloadfont(Font *f)
|
||||||
{
|
{
|
||||||
|
@ -1206,9 +1062,6 @@ xunloadfont(Font *f)
|
||||||
void
|
void
|
||||||
xunloadfonts(void)
|
xunloadfonts(void)
|
||||||
{
|
{
|
||||||
/* Clear Harfbuzz font cache. */
|
|
||||||
hbunloadfonts();
|
|
||||||
|
|
||||||
/* Free the loaded fonts in the font cache. */
|
/* Free the loaded fonts in the font cache. */
|
||||||
while (frclen > 0)
|
while (frclen > 0)
|
||||||
XftFontClose(xw.dpy, frc[--frclen].font);
|
XftFontClose(xw.dpy, frc[--frclen].font);
|
||||||
|
@ -1281,21 +1134,11 @@ xinit(int cols, int rows)
|
||||||
Window parent;
|
Window parent;
|
||||||
pid_t thispid = getpid();
|
pid_t thispid = getpid();
|
||||||
XColor xmousefg, xmousebg;
|
XColor xmousefg, xmousebg;
|
||||||
XWindowAttributes attr;
|
|
||||||
XVisualInfo vis;
|
|
||||||
|
|
||||||
|
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||||
|
die("can't open display\n");
|
||||||
xw.scr = XDefaultScreen(xw.dpy);
|
xw.scr = XDefaultScreen(xw.dpy);
|
||||||
|
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
||||||
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
|
|
||||||
parent = XRootWindow(xw.dpy, xw.scr);
|
|
||||||
xw.depth = 32;
|
|
||||||
} else {
|
|
||||||
XGetWindowAttributes(xw.dpy, parent, &attr);
|
|
||||||
xw.depth = attr.depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
|
|
||||||
xw.vis = vis.visual;
|
|
||||||
|
|
||||||
/* font */
|
/* font */
|
||||||
if (!FcInit())
|
if (!FcInit())
|
||||||
|
@ -1304,11 +1147,8 @@ xinit(int cols, int rows)
|
||||||
usedfont = (opt_font == NULL)? font : opt_font;
|
usedfont = (opt_font == NULL)? font : opt_font;
|
||||||
xloadfonts(usedfont, 0);
|
xloadfonts(usedfont, 0);
|
||||||
|
|
||||||
/* spare fonts */
|
|
||||||
xloadsparefonts();
|
|
||||||
|
|
||||||
/* colors */
|
/* colors */
|
||||||
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
|
||||||
xloadcols();
|
xloadcols();
|
||||||
|
|
||||||
/* adjust fixed window geometry */
|
/* adjust fixed window geometry */
|
||||||
|
@ -1328,15 +1168,19 @@ xinit(int cols, int rows)
|
||||||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||||
xw.attrs.colormap = xw.cmap;
|
xw.attrs.colormap = xw.cmap;
|
||||||
|
|
||||||
|
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
|
||||||
|
parent = XRootWindow(xw.dpy, xw.scr);
|
||||||
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
|
||||||
win.w, win.h, 0, xw.depth, InputOutput,
|
win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
|
||||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||||
| CWEventMask | CWColormap, &xw.attrs);
|
| CWEventMask | CWColormap, &xw.attrs);
|
||||||
|
|
||||||
memset(&gcvalues, 0, sizeof(gcvalues));
|
memset(&gcvalues, 0, sizeof(gcvalues));
|
||||||
gcvalues.graphics_exposures = False;
|
gcvalues.graphics_exposures = False;
|
||||||
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
|
dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
|
||||||
dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
|
&gcvalues);
|
||||||
|
xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
|
||||||
|
DefaultDepth(xw.dpy, xw.scr));
|
||||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||||
|
|
||||||
|
@ -1393,8 +1237,6 @@ xinit(int cols, int rows)
|
||||||
xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0);
|
xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0);
|
||||||
if (xsel.xtarget == None)
|
if (xsel.xtarget == None)
|
||||||
xsel.xtarget = XA_STRING;
|
xsel.xtarget = XA_STRING;
|
||||||
|
|
||||||
boxdraw_xinit(xw.dpy, xw.cmap, xw.draw, xw.vis);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1419,7 +1261,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
mode = glyphs[i].mode;
|
mode = glyphs[i].mode;
|
||||||
|
|
||||||
/* Skip dummy wide-character spacing. */
|
/* Skip dummy wide-character spacing. */
|
||||||
if (mode & ATTR_WDUMMY)
|
if (mode == ATTR_WDUMMY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Determine font for glyph if different from previous glyph. */
|
/* Determine font for glyph if different from previous glyph. */
|
||||||
|
@ -1441,13 +1283,8 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
yp = winy + font->ascent;
|
yp = winy + font->ascent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode & ATTR_BOXDRAW) {
|
|
||||||
/* minor shoehorning: boxdraw uses only this ushort */
|
|
||||||
glyphidx = boxdrawindex(&glyphs[i]);
|
|
||||||
} else {
|
|
||||||
/* Lookup character index with default font. */
|
/* Lookup character index with default font. */
|
||||||
glyphidx = XftCharIndex(xw.dpy, font->match, rune);
|
glyphidx = XftCharIndex(xw.dpy, font->match, rune);
|
||||||
}
|
|
||||||
if (glyphidx) {
|
if (glyphidx) {
|
||||||
specs[numspecs].font = font->match;
|
specs[numspecs].font = font->match;
|
||||||
specs[numspecs].glyph = glyphidx;
|
specs[numspecs].glyph = glyphidx;
|
||||||
|
@ -1531,9 +1368,6 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
||||||
numspecs++;
|
numspecs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Harfbuzz transformation for ligatures. */
|
|
||||||
hbtransform(specs, glyphs, len, x, y);
|
|
||||||
|
|
||||||
return numspecs;
|
return numspecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1654,16 +1488,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
||||||
r.width = width;
|
r.width = width;
|
||||||
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
|
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
|
||||||
|
|
||||||
if (base.mode & ATTR_BOXDRAW) {
|
|
||||||
drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len);
|
|
||||||
} else {
|
|
||||||
/* Render the glyphs. */
|
/* Render the glyphs. */
|
||||||
XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
||||||
}
|
|
||||||
|
|
||||||
/* Render underline and strikethrough. */
|
/* Render underline and strikethrough. */
|
||||||
if (base.mode & ATTR_UNDERLINE) {
|
if (base.mode & ATTR_UNDERLINE) {
|
||||||
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
|
XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent * chscale + 1,
|
||||||
width, 1);
|
width, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1687,17 +1517,14 @@ xdrawglyph(Glyph g, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int len)
|
xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
||||||
{
|
{
|
||||||
Color drawcol;
|
Color drawcol;
|
||||||
|
|
||||||
/* remove the old cursor */
|
/* remove the old cursor */
|
||||||
if (selected(ox, oy))
|
if (selected(ox, oy))
|
||||||
og.mode ^= ATTR_REVERSE;
|
og.mode ^= ATTR_REVERSE;
|
||||||
|
xdrawglyph(og, ox, oy);
|
||||||
/* Redraw the line where cursor was previously.
|
|
||||||
* It will restore the ligatures broken by the cursor. */
|
|
||||||
xdrawline(line, 0, oy, len);
|
|
||||||
|
|
||||||
if (IS_SET(MODE_HIDE))
|
if (IS_SET(MODE_HIDE))
|
||||||
return;
|
return;
|
||||||
|
@ -1705,7 +1532,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og, Line line, int le
|
||||||
/*
|
/*
|
||||||
* Select the right color for the right mode.
|
* Select the right color for the right mode.
|
||||||
*/
|
*/
|
||||||
g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE|ATTR_BOXDRAW;
|
g.mode &= ATTR_BOLD|ATTR_ITALIC|ATTR_UNDERLINE|ATTR_STRUCK|ATTR_WIDE;
|
||||||
|
|
||||||
if (IS_SET(MODE_REVERSE)) {
|
if (IS_SET(MODE_REVERSE)) {
|
||||||
g.mode |= ATTR_REVERSE;
|
g.mode |= ATTR_REVERSE;
|
||||||
|
@ -1950,22 +1777,12 @@ focus(XEvent *ev)
|
||||||
xseturgency(0);
|
xseturgency(0);
|
||||||
if (IS_SET(MODE_FOCUS))
|
if (IS_SET(MODE_FOCUS))
|
||||||
ttywrite("\033[I", 3, 0);
|
ttywrite("\033[I", 3, 0);
|
||||||
if (!focused) {
|
|
||||||
focused = 1;
|
|
||||||
xloadcols();
|
|
||||||
tfulldirt();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (xw.ime.xic)
|
if (xw.ime.xic)
|
||||||
XUnsetICFocus(xw.ime.xic);
|
XUnsetICFocus(xw.ime.xic);
|
||||||
win.mode &= ~MODE_FOCUSED;
|
win.mode &= ~MODE_FOCUSED;
|
||||||
if (IS_SET(MODE_FOCUS))
|
if (IS_SET(MODE_FOCUS))
|
||||||
ttywrite("\033[O", 3, 0);
|
ttywrite("\033[O", 3, 0);
|
||||||
if (focused) {
|
|
||||||
focused = 0;
|
|
||||||
xloadcols();
|
|
||||||
tfulldirt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2017,10 +1834,8 @@ kpress(XEvent *ev)
|
||||||
{
|
{
|
||||||
XKeyEvent *e = &ev->xkey;
|
XKeyEvent *e = &ev->xkey;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
char *buf = NULL, *customkey;
|
char buf[64], *customkey;
|
||||||
int len = 0;
|
int len;
|
||||||
int buf_size = 64;
|
|
||||||
int critical = - 1;
|
|
||||||
Rune c;
|
Rune c;
|
||||||
Status status;
|
Status status;
|
||||||
Shortcut *bp;
|
Shortcut *bp;
|
||||||
|
@ -2028,44 +1843,27 @@ kpress(XEvent *ev)
|
||||||
if (IS_SET(MODE_KBDLOCK))
|
if (IS_SET(MODE_KBDLOCK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
reallocbuf:
|
if (xw.ime.xic)
|
||||||
if (critical > 0)
|
len = XmbLookupString(xw.ime.xic, e, buf, sizeof buf, &ksym, &status);
|
||||||
goto cleanup;
|
else
|
||||||
if (buf)
|
len = XLookupString(e, buf, sizeof buf, &ksym, NULL);
|
||||||
free(buf);
|
|
||||||
|
|
||||||
buf = xmalloc((buf_size) * sizeof(char));
|
|
||||||
critical += 1;
|
|
||||||
|
|
||||||
if (xw.ime.xic) {
|
|
||||||
len = XmbLookupString(xw.ime.xic, e, buf, buf_size, &ksym, &status);
|
|
||||||
if (status == XBufferOverflow) {
|
|
||||||
buf_size = len;
|
|
||||||
goto reallocbuf;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Not sure how to fix this and if it is fixable
|
|
||||||
// but at least it does write something into the buffer
|
|
||||||
// so it is not as critical
|
|
||||||
len = XLookupString(e, buf, buf_size, &ksym, NULL);
|
|
||||||
}
|
|
||||||
/* 1. shortcuts */
|
/* 1. shortcuts */
|
||||||
for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
|
for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
|
||||||
if (ksym == bp->keysym && match(bp->mod, e->state)) {
|
if (ksym == bp->keysym && match(bp->mod, e->state)) {
|
||||||
bp->func(&(bp->arg));
|
bp->func(&(bp->arg));
|
||||||
goto cleanup;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2. custom keys from config.h */
|
/* 2. custom keys from config.h */
|
||||||
if ((customkey = kmap(ksym, e->state))) {
|
if ((customkey = kmap(ksym, e->state))) {
|
||||||
ttywrite(customkey, strlen(customkey), 1);
|
ttywrite(customkey, strlen(customkey), 1);
|
||||||
goto cleanup;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3. composed string from input method */
|
/* 3. composed string from input method */
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
goto cleanup;
|
return;
|
||||||
if (len == 1 && e->state & Mod1Mask) {
|
if (len == 1 && e->state & Mod1Mask) {
|
||||||
if (IS_SET(MODE_8BIT)) {
|
if (IS_SET(MODE_8BIT)) {
|
||||||
if (*buf < 0177) {
|
if (*buf < 0177) {
|
||||||
|
@ -2078,11 +1876,7 @@ reallocbuf:
|
||||||
len = 2;
|
len = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len <= buf_size)
|
|
||||||
ttywrite(buf, len, 1);
|
ttywrite(buf, len, 1);
|
||||||
cleanup:
|
|
||||||
if (buf)
|
|
||||||
free(buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2217,59 +2011,6 @@ run(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
|
||||||
{
|
|
||||||
char **sdst = dst;
|
|
||||||
int *idst = dst;
|
|
||||||
float *fdst = dst;
|
|
||||||
|
|
||||||
char fullname[256];
|
|
||||||
char fullclass[256];
|
|
||||||
char *type;
|
|
||||||
XrmValue ret;
|
|
||||||
|
|
||||||
snprintf(fullname, sizeof(fullname), "%s.%s",
|
|
||||||
opt_name ? opt_name : "st", name);
|
|
||||||
snprintf(fullclass, sizeof(fullclass), "%s.%s",
|
|
||||||
opt_class ? opt_class : "St", name);
|
|
||||||
fullname[sizeof(fullname) - 1] = fullclass[sizeof(fullclass) - 1] = '\0';
|
|
||||||
|
|
||||||
XrmGetResource(db, fullname, fullclass, &type, &ret);
|
|
||||||
if (ret.addr == NULL || strncmp("String", type, 64))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
switch (rtype) {
|
|
||||||
case STRING:
|
|
||||||
*sdst = ret.addr;
|
|
||||||
break;
|
|
||||||
case INTEGER:
|
|
||||||
*idst = strtoul(ret.addr, NULL, 10);
|
|
||||||
break;
|
|
||||||
case FLOAT:
|
|
||||||
*fdst = strtof(ret.addr, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
config_init(void)
|
|
||||||
{
|
|
||||||
char *resm;
|
|
||||||
XrmDatabase db;
|
|
||||||
ResourcePref *p;
|
|
||||||
|
|
||||||
XrmInitialize();
|
|
||||||
resm = XResourceManagerString(xw.dpy);
|
|
||||||
if (!resm)
|
|
||||||
return;
|
|
||||||
|
|
||||||
db = XrmGetStringDatabase(resm);
|
|
||||||
for (p = resources; p < resources + LEN(resources); p++)
|
|
||||||
resource_load(db, p->name, p->type, p->dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
@ -2294,9 +2035,6 @@ main(int argc, char *argv[])
|
||||||
case 'a':
|
case 'a':
|
||||||
allowaltscreen = 0;
|
allowaltscreen = 0;
|
||||||
break;
|
break;
|
||||||
case 'A':
|
|
||||||
opt_alpha = EARGF(usage());
|
|
||||||
break;
|
|
||||||
case 'c':
|
case 'c':
|
||||||
opt_class = EARGF(usage());
|
opt_class = EARGF(usage());
|
||||||
break;
|
break;
|
||||||
|
@ -2346,15 +2084,8 @@ run:
|
||||||
|
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
XSetLocaleModifiers("");
|
XSetLocaleModifiers("");
|
||||||
|
|
||||||
if(!(xw.dpy = XOpenDisplay(NULL)))
|
|
||||||
die("Can't open display\n");
|
|
||||||
|
|
||||||
config_init();
|
|
||||||
cols = MAX(cols, 1);
|
cols = MAX(cols, 1);
|
||||||
rows = MAX(rows, 1);
|
rows = MAX(rows, 1);
|
||||||
defaultbg = MAX(LEN(colorname), 256);
|
|
||||||
alphaUnfocus = alpha-alphaOffset;
|
|
||||||
tnew(cols, rows);
|
tnew(cols, rows);
|
||||||
xinit(cols, rows);
|
xinit(cols, rows);
|
||||||
xsetenv();
|
xsetenv();
|
||||||
|
@ -2363,4 +2094,3 @@ run:
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue