st.git
8 years agoAdd missing device path to '-l' example
Klemens Nanni [Thu, 13 Oct 2016 14:28:50 +0000 (16:28 +0200)]
Add missing device path to '-l' example

Also, it's ttyS0 not ttySO.

8 years agoAdd parsing of DCS q sequences
Roberto E. Vargas Caballero [Wed, 14 Sep 2016 06:27:32 +0000 (08:27 +0200)]
Add parsing of DCS q sequences

These sequences are used to operate with sixels, but they are still
str sequences, so they are finished with \a, ST or with a C1 control
code. This patch also disables utf8 handling for the case of sixels.

8 years agoAdd support for enabling/disabling utf
Roberto E. Vargas Caballero [Tue, 13 Sep 2016 12:01:18 +0000 (14:01 +0200)]
Add support for enabling/disabling utf

There are some ocasions where we want to disable the enconding/decoding of utf8, mainly
because it adds an important overhead. This is partial patch for ESC % G and ESC % @,
where they modified the way that st reads and write from/to the serial line, but it does
not modifies how it interacts with the X window part.

8 years agoDelete ncv capability from terminfo
Roberto E. Vargas Caballero [Fri, 9 Sep 2016 11:11:06 +0000 (13:11 +0200)]
Delete ncv capability from terminfo

We do not need to disable the previous ncv definition, because
there is not previous definition.

8 years agost.info: do not prevent st from displaying attributes
Quentin Rameau [Thu, 8 Sep 2016 10:57:43 +0000 (12:57 +0200)]
st.info: do not prevent st from displaying attributes

With ncv set to 3, we prevent st from displaying A_STANDOUT and
A_UNDERLINE with colors while our virtual terminal is capable of it.

8 years agoUpdate the LICENSE.
Christoph Lohmann [Thu, 11 Aug 2016 14:30:29 +0000 (16:30 +0200)]
Update the LICENSE.

This is for the next release.

8 years ago0.7 release
Christoph Lohmann [Thu, 11 Aug 2016 14:25:58 +0000 (16:25 +0200)]
0.7 release

8 years agoChange who's expanding tabs.
Christoph Lohmann [Wed, 20 Jul 2016 11:56:15 +0000 (13:56 +0200)]
Change who's expanding tabs.

8 years agoAdd some hint to have the pseudo terminal in the right mode.
Christoph Lohmann [Wed, 20 Jul 2016 11:52:31 +0000 (13:52 +0200)]
Add some hint to have the pseudo terminal in the right mode.

If you don't make sure that the terminal does not expand tabs to spaces, of
course such a setting won't work.

8 years agoAdd comment about tabspaces.
Christoph Lohmann [Wed, 20 Jul 2016 11:00:43 +0000 (13:00 +0200)]
Add comment about tabspaces.

st.info needs to be changed too, when tabspaces are changed.

8 years agoConsistent Alt+BackSpace behavior
Alive 4ever [Sun, 10 Jul 2016 06:38:04 +0000 (06:38 +0000)]
Consistent Alt+BackSpace behavior

The default config specifies BackSpace as "\177". The default behavior
should persist across modifier keys, commonly Mod1 (Alt or Meta) which
is widely used to delete a word on readline and text editors, notably
Emacs.

This will make Alt+BackSpace behaves as expected, i.e. sends "\033\177"
instead of "\033\010" as previous default behavior.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoUse XftFontMatch in place of FcFontMatch.
Christoph Lohmann [Fri, 3 Jun 2016 13:02:32 +0000 (15:02 +0200)]
Use XftFontMatch in place of FcFontMatch.

git am -s didn't like your patch:

From: Mark Edgar <medgar123@gmail.com>

XftFontMatch calls XftDefaultSubstitute which configures various match
properties according to the user's configured Xft defaults (xrdb) as well as
according to the current display and screen. Most importantly, the screen DPI
is computed [1]. Without this, st uses a "default" DPI of 75 [2].

[1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftdpy.c?id=libXft-2.3.2#n535
[2]: https://cgit.freedesktop.org/fontconfig/tree/src/fcdefault.c?id=2.11.1#n255

8 years agodelete clipboard properties after pasting them
v4hn [Thu, 19 May 2016 10:16:57 +0000 (12:16 +0200)]
delete clipboard properties after pasting them

https://tronche.com/gui/x/icccm/sec-2.html#s-2.4 specifies:
> Once all the data in the selection has been retrieved,
> the requestor should delete the property in the SelectionNotify request

Most Clipboard-Owners ignore whether or not the property is already set,
so this is mostly a cosmetic change to keep the windows property list clean.

However, at least synergy decides to wait for the requestor to delete
the properties if they are already set by a previous paste (from synergy).

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoRemove stupid assignation in memcpy()
Roberto E. Vargas Caballero [Fri, 15 Apr 2016 05:58:26 +0000 (07:58 +0200)]
Remove stupid assignation in memcpy()

8 years agost: Fix off-by-one error when calculating character width.
Tor Andersson [Wed, 9 Mar 2016 16:11:57 +0000 (17:11 +0100)]
st: Fix off-by-one error when calculating character width.

LEN(str) is one larger than strlen(str) because it also counts the zero
terminator. The original code would include the .notdef glyph (since it'll
try to encode character 0, which gets encoded to the .notdef glyph) when
measuring the average dimensions of printable ascii characters.

This causes problems with fonts like GNU Unifont where the .notdef glyph is
not the same width as the usual half-width characters.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoFix vertical character alignment in some cases
Ton van den Heuvel [Mon, 7 Mar 2016 21:18:12 +0000 (22:18 +0100)]
Fix vertical character alignment in some cases

The y-position of a character found by asking fontconfig for a matching
font does not take the border pixels into account, resulting in a
slightly misaligned vertical position.

Signed-off-by: Ton van den Heuvel <tonvandenheuvel@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoI like empty lines.
Christoph Lohmann [Tue, 8 Mar 2016 12:55:22 +0000 (13:55 +0100)]
I like empty lines.

8 years agoMeasure the single advance width with a heuristic method
Ryusei Yamaguchi [Tue, 8 Mar 2016 03:26:04 +0000 (12:26 +0900)]
Measure the single advance width with a heuristic method

This fix is needed to use dual-width fonts, which have double-width
glyphs (e.g. CJK unified ideographs).

Signed-off-by: Ryusei Yamaguchi <mandel59@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoxtermclear() is now done by xdrawglyphfontspecs()
Christoph Lohmann [Mon, 7 Mar 2016 13:33:05 +0000 (14:33 +0100)]
xtermclear() is now done by xdrawglyphfontspecs()

Thanks Ton van den Heuvel for the proposal!

8 years agoarg.h: fixed argv checks order
Lucas Gabriel Vuotto [Fri, 19 Feb 2016 18:59:49 +0000 (15:59 -0300)]
arg.h: fixed argv checks order

This prevents accessing to a potentially out-of-bounds memory section.

Signed-off-by: Lucas Gabriel Vuotto <l.vuotto92@gmail.com>
Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoFix forgotten bracket and duplicate option in usage()
Quentin Rameau [Mon, 1 Feb 2016 11:20:33 +0000 (12:20 +0100)]
Fix forgotten bracket and duplicate option in usage()

Scratch the preceding patch, this one is more correct
(don't forget to 'git am --scissors' ;))
-- >8 --

Also reformat the strings in a saner layout

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoExtract ttyresize() out of cresize()
Quentin Rameau [Sat, 30 Jan 2016 16:54:41 +0000 (17:54 +0100)]
Extract ttyresize() out of cresize()

This way we can call cresize() to set the terminal size before creating
a tty or spawning a process, which will start with the correct size.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoOk, no need for a separate version function.
Christoph Lohmann [Sat, 30 Jan 2016 08:50:18 +0000 (09:50 +0100)]
Ok, no need for a separate version function.

This is just redundant metadata. Please add Java comment meta classes too.

8 years agoAdd -n option for setting WM_CLASS instance name
Quentin Rameau [Fri, 29 Jan 2016 21:03:01 +0000 (22:03 +0100)]
Add -n option for setting WM_CLASS instance name

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoReformat usage and separate version from it
Quentin Rameau [Fri, 29 Jan 2016 21:02:40 +0000 (22:02 +0100)]
Reformat usage and separate version from it

Signed-off-by: Christoph Lohmann <20h@r-36.net>
8 years agoEnforce a terminal size to reduce race conditions in too efficient apps.
Christoph Lohmann [Thu, 28 Jan 2016 17:09:11 +0000 (18:09 +0100)]
Enforce a terminal size to reduce race conditions in too efficient apps.

dvtm is too fast in starting up. It will then have a race condition in finding
the right. terminal size.

8 years agoHeight is height.
Christoph Lohmann [Thu, 14 Jan 2016 22:19:03 +0000 (23:19 +0100)]
Height is height.

8 years agoBump year.
Christoph Lohmann [Fri, 1 Jan 2016 13:18:43 +0000 (14:18 +0100)]
Bump year.

8 years agoFixing the XClassHint setting in st.
Christoph Lohmann [Sun, 20 Dec 2015 00:43:32 +0000 (01:43 +0100)]
Fixing the XClassHint setting in st.

9 years agoAvoid recursive call to ttywrite from ttyread
Roberto E. Vargas Caballero [Sat, 21 Nov 2015 17:21:03 +0000 (18:21 +0100)]
Avoid recursive call to ttywrite from ttyread

Ttyread() calls to ttywrite, so if we check for reading before
that for writing in ttywrite we can get a circular call sequence.

9 years agoarg.h: remove unused macros
Quentin Rameau [Sun, 8 Nov 2015 16:14:58 +0000 (17:14 +0100)]
arg.h: remove unused macros

ARGUM isn't used and ARGNUMF uses estrtol() that isn't defined anywhere.
Those were probably copied from sbase arg.h.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoIntroduce lim in all ttywrite() checks.
Christoph Lohmann [Fri, 6 Nov 2015 19:46:23 +0000 (20:46 +0100)]
Introduce lim in all ttywrite() checks.

9 years agoFix ttywrite()
Roberto E. Vargas Caballero [Fri, 6 Nov 2015 19:01:00 +0000 (20:01 +0100)]
Fix ttywrite()

ttywrite was assuming that if it could not write then it could
read, but this is not necessarily true, there are some situations
where you cannot read or write. The correct behaviour is to detect
if you can read or/and write.

9 years agoNow the mshortcuts are even more consistent.
Ivan Tham [Sun, 1 Nov 2015 02:53:56 +0000 (10:53 +0800)]
Now the mshortcuts are even more consistent.

    Keep everyone happy

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoNow the Shortcuts are more consistent.
Christoph Lohmann [Sat, 31 Oct 2015 08:29:04 +0000 (09:29 +0100)]
Now the Shortcuts are more consistent.

Keep the debile happy.

9 years agofix bug where first selection snaps to lines
Jason Woofenden [Sun, 11 Oct 2015 09:44:34 +0000 (11:44 +0200)]
fix bug where first selection snaps to lines

9 years agoFix the cursor colors selection
Quentin Rameau [Tue, 6 Oct 2015 08:29:44 +0000 (10:29 +0200)]
Fix the cursor colors selection

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoNormalize the whole color selection in xdrawcursor.
Christoph Lohmann [Mon, 5 Oct 2015 22:21:44 +0000 (00:21 +0200)]
Normalize the whole color selection in xdrawcursor.

9 years agoFix the cursor color when over selection.
Quentin Rameau [Mon, 5 Oct 2015 21:10:48 +0000 (23:10 +0200)]
Fix the cursor color when over selection.

If we want to show a custom selected cursor color, we must not set the
revert attribute to the drawn glyph.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoMake the cursor shapes more descriptive.
Christoph Lohmann [Mon, 5 Oct 2015 21:05:38 +0000 (23:05 +0200)]
Make the cursor shapes more descriptive.

»IBeam« is now »Bar« because it's named like that in the source code.

9 years agoSnowman is everywhere.
Christoph Lohmann [Mon, 5 Oct 2015 20:59:04 +0000 (22:59 +0200)]
Snowman is everywhere.

9 years agoStyle normalisation in the config.def.h.
Christoph Lohmann [Mon, 5 Oct 2015 20:54:44 +0000 (22:54 +0200)]
Style normalisation in the config.def.h.

This adds an awareness commit for the big key array too.

9 years agoThe definition of the reverse cursor is now up to the user.
Christoph Lohmann [Mon, 5 Oct 2015 20:38:19 +0000 (22:38 +0200)]
The definition of the reverse cursor is now up to the user.

9 years agoFixing the cursor movement in selections.
Christoph Lohmann [Mon, 5 Oct 2015 20:09:51 +0000 (22:09 +0200)]
Fixing the cursor movement in selections.

Before the fix the cursor wouldn't obey if it's in a selection. If it is
inside it will now change to the reverse. This patch also adds that the
defaultcs will be reversed for the manually drawn cursors.

9 years agoWhen the cursor is moved, clear the selection.
Christoph Lohmann [Mon, 5 Oct 2015 19:18:34 +0000 (21:18 +0200)]
When the cursor is moved, clear the selection.

9 years agoReverse the cursor on selection.
Christoph Lohmann [Mon, 5 Oct 2015 19:06:42 +0000 (21:06 +0200)]
Reverse the cursor on selection.

9 years agoMore style changes. We forgot some switches.
Christoph Lohmann [Mon, 5 Oct 2015 18:48:24 +0000 (20:48 +0200)]
More style changes. We forgot some switches.

9 years agoSmall style change.
Christoph Lohmann [Mon, 5 Oct 2015 18:08:21 +0000 (20:08 +0200)]
Small style change.

9 years agoThere's no need for libXext to compile st.
Christoph Lohmann [Mon, 28 Sep 2015 18:08:58 +0000 (20:08 +0200)]
There's no need for libXext to compile st.

9 years agoFix extra bracketed paste markers when pasting >8kb
dequis [Fri, 25 Sep 2015 03:56:15 +0000 (00:56 -0300)]
Fix extra bracketed paste markers when pasting >8kb

Before this patch, when pasting over BUFSIZE (8192 bytes here), st would
do the following:

    \e[200~...8192 bytes...\e[201~\e[200~...remaining bytes...\e[201~

With this patch, the start marker is only sent when the offset is 0 (at
the beginning of selnotify) and the end marker is only sent when the
remaining bytes to read are 0 (at the end).

For short pastes, both conditions are true in the same iteration.

For long pastes, it removes the extra markers in the middle, keeping the
intended wrapping:

    \e[200~...8192 bytes......remaining bytes...\e[201~

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agodup() -> dup2()
FRIGN [Tue, 22 Sep 2015 11:13:25 +0000 (13:13 +0200)]
dup() -> dup2()

gcc would warn about an unused result. We know it is 0 and dup()
can't fail in these circumstances, as we closed fd0 previously.
Using dup2() to do the same saves one line and shuts gcc up, bringing
us a clean build back.

9 years agoThe times of bad fonts are over.
Christoph Lohmann [Sat, 12 Sep 2015 14:43:32 +0000 (16:43 +0200)]
The times of bad fonts are over.

The antialiasing was false due to circumstances that do not exist anymore. We
need antialiasing on big screens with big fonts. Autohinting too.

9 years agoFix copy of line with len = 0
Roberto E. Vargas Caballero [Thu, 10 Sep 2015 09:53:11 +0000 (11:53 +0200)]
Fix copy of line with len = 0

When a line has no any character linelen is 0, so last = &term.line[y][MIN(lastx, linelen-1)]
generated a pointer to the end of the previous line. The best thing we can do in this case
is to add a newline, because we don't have a glyph to print (and consult its state of
wrapping).

9 years agoChange Pause to Break in shortcut for serial break
Roberto E. Vargas Caballero [Tue, 8 Sep 2015 15:00:20 +0000 (17:00 +0200)]
Change Pause to Break in shortcut for serial break

9 years agoExpose cursor shape in config.def.h
Jan Christoph Ebersbach [Tue, 8 Sep 2015 05:28:52 +0000 (07:28 +0200)]
Expose cursor shape in config.def.h

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoAdd key to send a break to the serial line
Roberto E. Vargas Caballero [Tue, 8 Sep 2015 10:10:11 +0000 (12:10 +0200)]
Add key to send a break to the serial line

9 years agoSet default values of stty according to the man page
Roberto E. Vargas Caballero [Tue, 8 Sep 2015 08:44:35 +0000 (10:44 +0200)]
Set default values of stty according to the man page

This configuration is basically 38400 8N1, without echo and
in raw mode. Kernel will not process any of the characters
sent by the user.

9 years agoMaking st.1 more descriptive about -l and fix -l in st.c.
Christoph Lohmann [Mon, 7 Sep 2015 20:59:05 +0000 (22:59 +0200)]
Making st.1 more descriptive about -l and fix -l in st.c.

9 years agoFix the st manpage for -l line.
Christoph Lohmann [Mon, 7 Sep 2015 18:00:49 +0000 (20:00 +0200)]
Fix the st manpage for -l line.

9 years agoReordering and adding control codes.
Christoph Lohmann [Mon, 31 Aug 2015 13:26:21 +0000 (15:26 +0200)]
Reordering and adding control codes.

For completeness and documentation add all C1 control codes.

9 years agoMerge branch 'master' of ssh://suckless.org/gitrepos/st
Christoph Lohmann [Sun, 30 Aug 2015 09:29:23 +0000 (11:29 +0200)]
Merge branch 'master' of ssh://suckless.org/gitrepos/st

9 years agoDon't read if we chunked the input data.
Christoph Lohmann [Sun, 30 Aug 2015 09:28:35 +0000 (11:28 +0200)]
Don't read if we chunked the input data.

9 years agoDo not mark as invalid UTF8 control codes
Roberto E. Vargas Caballero [Mon, 17 Aug 2015 09:25:38 +0000 (11:25 +0200)]
Do not mark as invalid UTF8 control codes

wcwidth() returns -1 for all the non visible characters, but it doesn't
necessarilly mean that they are incorrect. It only means that they are not
printable.

9 years agost.info: replace the acsc entry from xterm to urxvt
Quentin Rameau [Tue, 11 Aug 2015 15:47:12 +0000 (17:47 +0200)]
st.info: replace the acsc entry from xterm to urxvt

The current acsc entry, copied from xterm was not exposing capability to
display arrows.

9 years agoAdding mouse colour/shape settings
Alex Kozadaev [Tue, 28 Jul 2015 09:30:14 +0000 (10:30 +0100)]
Adding mouse colour/shape settings

9 years agoAdding -T to the usage too.
Christoph Lohmann [Fri, 24 Jul 2015 16:25:33 +0000 (18:25 +0200)]
Adding -T to the usage too.

9 years agoAdd -T, as recommended by Dmitrij D. Czarkoff
Christoph Lohmann [Fri, 24 Jul 2015 16:24:10 +0000 (18:24 +0200)]
Add -T, as recommended by Dmitrij D. Czarkoff

9 years agoFix type for write(2) return variable.
Quentin Rameau [Fri, 24 Jul 2015 09:52:17 +0000 (11:52 +0200)]
Fix type for write(2) return variable.

A little fix in xwrite().

>From 3727d2e3344b57128ab51c7839795204f1f839ff Mon Sep 17 00:00:00 2001
From: Quentin Rameau <quinq@fifth.space>
Date: Fri, 24 Jul 2015 11:40:46 +0200
Subject: [PATCH] Fix type for write(2) return variable.

The allocated lengh of s fits into an integer so we can safely use
ssize_t here.

9 years agoadded note about the low precedence of shell to config.def.h
Mytchel Hammond [Fri, 24 Jul 2015 05:58:18 +0000 (17:58 +1200)]
added note about the low precedence of shell to config.def.h

9 years agoFix style in execsh
Roberto E. Vargas Caballero [Fri, 24 Jul 2015 05:44:34 +0000 (07:44 +0200)]
Fix style in execsh

9 years agoMake the comment for the IM XFilter more understandable.
Christoph Lohmann [Fri, 10 Jul 2015 12:31:40 +0000 (14:31 +0200)]
Make the comment for the IM XFilter more understandable.

9 years agoReturn style unification.
Christoph Lohmann [Fri, 10 Jul 2015 12:30:37 +0000 (14:30 +0200)]
Return style unification.

9 years agoAligning the macros.
Christoph Lohmann [Fri, 10 Jul 2015 12:21:52 +0000 (14:21 +0200)]
Aligning the macros.

9 years agoUnix end of file.
Christoph Lohmann [Fri, 10 Jul 2015 12:19:52 +0000 (14:19 +0200)]
Unix end of file.

9 years agoNo inline declarations please.
Christoph Lohmann [Fri, 10 Jul 2015 12:19:31 +0000 (14:19 +0200)]
No inline declarations please.

9 years agoTypo and the missing incr atom from the patches.
Christoph Lohmann [Fri, 10 Jul 2015 12:17:51 +0000 (14:17 +0200)]
Typo and the missing incr atom from the patches.

9 years agoImplement chunked write to the cmdfd.
Christoph Lohmann [Fri, 10 Jul 2015 12:15:39 +0000 (14:15 +0200)]
Implement chunked write to the cmdfd.

This is needed so big input like a paste of several megabyte does not clog our
I/O.

9 years agoImplement INCR transfers in the clipboard.
Christoph Lohmann [Fri, 10 Jul 2015 12:10:17 +0000 (14:10 +0200)]
Implement INCR transfers in the clipboard.

9 years agoUpdate LICENSE
FRIGN [Fri, 10 Jul 2015 10:27:13 +0000 (12:27 +0200)]
Update LICENSE

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoDon't treat clauses like functions
FRIGN [Fri, 10 Jul 2015 08:29:53 +0000 (10:29 +0200)]
Don't treat clauses like functions

and add a space between the keyword and the parentheses.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoUse BSD-style function notation
FRIGN [Thu, 9 Jul 2015 21:59:50 +0000 (23:59 +0200)]
Use BSD-style function notation

Put the opening brace on a new line. This was already used for some
functions inside st.c.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoUnboolify st
FRIGN [Wed, 8 Jul 2015 21:56:55 +0000 (23:56 +0200)]
Unboolify st

This practice proved itself in sbase, ubase and a couple of other
projects.
Also remove the True and False defined in X11 and FcTrue and FcFalse
defined in Fontconfig.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoRemove insane *_FILENO and EXIT_* usage
FRIGN [Wed, 8 Jul 2015 21:49:25 +0000 (23:49 +0200)]
Remove insane *_FILENO and EXIT_* usage

Any system having different assignments than the usual 0, 1, 2 for
the standard file numbers and 0, 1 for the exit-statuses is broken
beyond repair.
Let's keep it simple and just use the numbers, no reason to fall
out of the window here and bend down for POSIX.
In one occasion, the ret-variable was not necessary. The check was
rewritten.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
9 years agoCommit to push the 0.6 release.
Christoph Lohmann [Tue, 7 Jul 2015 20:26:44 +0000 (22:26 +0200)]
Commit to push the 0.6 release.

9 years agoRevert "Remove unnecessary XFilterEvent call."
Weng Xuetian [Thu, 2 Jul 2015 06:31:12 +0000 (08:31 +0200)]
Revert "Remove unnecessary XFilterEvent call."

This reverts commit d2937b05aed9cee8d6651cd806d31682a853c773.

9 years agodo not truncate font size when zooming
Quentin Rameau [Sun, 31 May 2015 10:26:11 +0000 (12:26 +0200)]
do not truncate font size when zooming

9 years agoRevert "Optimize memory footprint of line buffers"
Roberto E. Vargas Caballero [Wed, 3 Jun 2015 06:07:55 +0000 (08:07 +0200)]
Revert "Optimize memory footprint of line buffers"

This reverts commit 7ab6c92e18d468968811256e808b02309c160a22.
We need 32 bits for real color support.

9 years agoSupport UTF-8 characters as word delimiters
Jan Christoph Ebersbach [Fri, 22 May 2015 14:06:57 +0000 (16:06 +0200)]
Support UTF-8 characters as word delimiters

For a higher usefulness of the utf8strchr function, the index of the
UTF-8 character could be returned in addition with a Rune instead of a
char*.  Since utf8strchr is currently only used by ISDELIM I didn't
bother to increase the complexity.

9 years agoMerge branch 'master' of ssh://suckless.org/gitrepos/st
Roberto E. Vargas Caballero [Fri, 15 May 2015 05:51:58 +0000 (07:51 +0200)]
Merge branch 'master' of ssh://suckless.org/gitrepos/st

9 years agoset selection to IDLE on clear
v4hn [Thu, 14 May 2015 13:46:07 +0000 (15:46 +0200)]
set selection to IDLE on clear

Otherwise a tangling bmotion event will consider
the selection still valid and selnormalize segfaults
because of an invalid sel.ob.y index.

9 years agoSmall bugfix for makeglyphfontspecs call in drawregion
suigin [Sat, 9 May 2015 22:22:40 +0000 (15:22 -0700)]
Small bugfix for makeglyphfontspecs call in drawregion

Here's a patch that fixes a bug when calling `makedrawglyphfontspecs'
in `drawregion'. Wasn't offseting the pointer into the input glyphs
array by `x1'. The bug isn't causing any problems currently, because
`drawregion' is always called with `x1' and `y1' values of 0, but if
this ever changes in the future, the bug would certainly cause some
problems.

9 years agoFix the new -e handling. An empty cmd has to work for backwards compatibility.
Christoph Lohmann [Sun, 10 May 2015 13:19:48 +0000 (15:19 +0200)]
Fix the new -e handling. An empty cmd has to work for backwards compatibility.

9 years agoClean up xdraws and optimize glyph drawing with non-unit kerning values
suigin [Wed, 6 May 2015 03:24:00 +0000 (20:24 -0700)]
Clean up xdraws and optimize glyph drawing with non-unit kerning values

I have another patch here for review that optimizes the performance of
glyph drawing, primarily when using non-unit kerning values, and fixes a
few other minor issues. It's dependent on the earlier patch from me that
stores unicode codepoints in a Rune type, typedef'd to uint_least32_t.

This patch is a pretty big change to xdraws so your scrutiny is
appreciated.

First, some performance numbers. I used Yu-Jie Lin termfps.sh shell
script to benchmark before and after, and you can find it in the
attachments. On my Kaveri A10 7850k machine, I get the following
results:

Before Patch
============

1) Font: "Liberation Mono:pixelsize=12:antialias=false:autohint=false"
   cwscale: 1.0, chscale: 1.0
   For 273x83 100 frames.
   Elapsed time :     1.553
   Frames/second:    64.352
   Chars /second: 1,458,159

2) Font: "Inconsolata:pixelsize=14:antialias=true:autohint=true"
   cwscale: 1.001, chscale: 1.001
   For 239x73 100 frames.
   Elapsed time :   159.286
   Frames/second:     0.627
   Chars /second:    10,953

After Patch
===========

3) Font: "Liberation Mono:pixelsize=12:antialias=false:autohint=false"
   cwscale: 1.0, chscale: 1.0
   For 273x83 100 frames.
   Elapsed time :     1.544
   Frames/second:    64.728
   Chars /second: 1,466,690

4) Font: "Inconsolata:pixelsize=14:antialias=true:autohint=true"
   cwscale: 1.001, chscale: 1.001
   For 239x73 100 frames.
   Elapsed time :     1.955
   Frames/second:    51.146
   Chars /second:   892,361

As you can see, while the improvements for fonts with unit-kerning is
marginal, there's a huge ~81x performance increase with the patch when
using kerning values other than 1.0.

So what does the patch do?

The `xdraws' function would render each glyph one at a time if non-unit
kerning values were configured, and this was the primary cause of the
slow down. Xft provides a handful of functions which allow you to render
multiple characters or glyphs at time, each with a unique <x,y> position,
so it was simply a matter of massaging the data into a format that would
allow us to use one of these functions.

I've split `xdraws' up into two functions. In the first pass with
`xmakeglyphfontspecs' it will iterate over all of the glyphs in a given
row and it will build up an array of corresponding XftGlyphFontSpec
records. Much of the old logic for resolving fonts for glyphs using Xft
and fontconfig went into this function.

The second pass is done with `xrenderglyphfontspecs' which contains the
old logic for determining colors, clearing the background, and finally
rendering the array of XftGlyphFontSpec records.

There's a couple of other things that have been improved by this patch.
For instance, the UTF-32 codepoints in the Line's were being re-encoded
back into UTF-8 strings to be passed to `xdraws' which in turn would then
decode back to UTF-32 to verify that the Font contained a matching glyph
for the code point. Next, the UTF-8 string was being passed to
`XftDrawStringUtf8' which internally mallocs a scratch buffer and decodes
back to UTF-32 and does the lookup of the glyphs all over again.

This patch gets rid of all of this redundant round-trip encoding and
decoding of characters to be rendered and only looks up the glyph index
once (per font) during the font resolution phase. So this is probably
what's responsible for the marginal improvements seen when kerning values
are kept to 1.0.

I imagine there are other performance improvements here too, not seen in
the above benchmarks, if the user has lots of non-ASCII code plane characters
on the screen, or several different fonts are being utilized during
screen redraw.

Anyway, if you see any problems, please let me know and I can fix them.

9 years agoChanged type for UTF-32 codepoints from long to uint_least32_t
suigin [Tue, 5 May 2015 20:13:21 +0000 (13:13 -0700)]
Changed type for UTF-32 codepoints from long to uint_least32_t

9 years agoFix empty selection highlighting bug.
noname [Sun, 3 May 2015 19:28:10 +0000 (19:28 +0000)]
Fix empty selection highlighting bug.

When user clicks LMB, one character is selected, but will not be copied
to selection until the user moves cursor a bit. Therefore, the character
should not be highlighted as selected yet.

Before the patch, the trick was not to mark line as dirty to avoid
highlighting it. However, if user has already selected something and
clicks in line that contains selection, selclear sets the line as dirty
and one character is highlighted when it should not.

This patch replaces dirty trick with explicit check for sel.mode inside
selected().

9 years agoFix indentation.
noname [Sun, 3 May 2015 02:49:23 +0000 (02:49 +0000)]
Fix indentation.

9 years agoAdd enumeration for sel.mode
noname [Fri, 1 May 2015 17:13:13 +0000 (17:13 +0000)]
Add enumeration for sel.mode

This patch also prevents sel.mode from increasing beyond 2. It is almost
impossible, but sel.mode may overflow if mouse is moved around for too
long while selecting.

9 years agoselnormalize: make special case explicit
noname [Thu, 30 Apr 2015 19:59:24 +0000 (19:59 +0000)]
selnormalize: make special case explicit

Special case is when regular selection spans multiple lines.
Otherwise, just sort sel.ob.x and sel.ob.y.

9 years agoselsnap: simplify SNAP_LINE case
noname [Fri, 1 May 2015 02:22:32 +0000 (02:22 +0000)]
selsnap: simplify SNAP_LINE case

Also make sure y never exceeds term.row-1 even if ATTR_WRAP is set for
some reason.

9 years agoRemove first argument of selsnap.
noname [Thu, 30 Apr 2015 20:51:35 +0000 (20:51 +0000)]
Remove first argument of selsnap.