st.git
6 years agoMove terminal-related selection logic into st.c
Devin J. Pohly [Thu, 22 Feb 2018 05:29:41 +0000 (23:29 -0600)]
Move terminal-related selection logic into st.c

The front-end determines information about mouse clicks and motion, and
the terminal handles the actual selection start/extend/dirty logic by
row and column.

While we're in the neighborhood, we'll also rename getbuttoninfo() to
mousesel() which is, at least, less wrong.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove X-specific selection info into XSelection
Devin J. Pohly [Thu, 22 Feb 2018 04:56:02 +0000 (22:56 -0600)]
Move X-specific selection info into XSelection

Data about PRIMARY/CLIPBOARD and clicks are part of the front-end, not
the terminal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoHave selected() check whether selection exists
Devin J. Pohly [Thu, 22 Feb 2018 04:48:28 +0000 (22:48 -0600)]
Have selected() check whether selection exists

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoRely on ttyresize to set tty size
Devin J. Pohly [Thu, 22 Feb 2018 04:28:41 +0000 (22:28 -0600)]
Rely on ttyresize to set tty size

This removes ttynew's dependency on cresize being called first, and then
allows us to absorb the ttyresize call into cresize (which always
precedes it).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoRemove X and fontconfig from st.c
Devin J. Pohly [Tue, 7 Nov 2017 00:30:45 +0000 (18:30 -0600)]
Remove X and fontconfig from st.c

None of the X-related includes are needed any longer.  In addition, move
the X modifier defines into x.c, as they are not used outside.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoRemove Time argument from xsetsel
Devin J. Pohly [Tue, 7 Nov 2017 00:25:58 +0000 (18:25 -0600)]
Remove Time argument from xsetsel

This is an X type and should be internal to x.c.

The selcopy() function was a single line and only used in one place, so
it was inlined to reduce LOC.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMake win variable internal to x.c
Devin J. Pohly [Mon, 6 Nov 2017 23:57:45 +0000 (17:57 -0600)]
Make win variable internal to x.c

There was only a single reference to the `win` variable in st.c, so
exporting that to x.c allows us to rid ourselves of another extern.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove X-related config.h types into x.c
Devin J. Pohly [Tue, 17 Oct 2017 21:46:26 +0000 (16:46 -0500)]
Move X-related config.h types into x.c

No need to expose Shortcut, MouseShortcut, and Key anymore.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoRemove unneeded array-length variables
Devin J. Pohly [Tue, 17 Oct 2017 20:46:31 +0000 (15:46 -0500)]
Remove unneeded array-length variables

These were only used in x.c, which now has direct visibility of the
config.h arrays.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoInline clipboard functions
Devin J. Pohly [Tue, 17 Oct 2017 20:43:32 +0000 (15:43 -0500)]
Inline clipboard functions

No need to keep a function that only calls another function in the same
file.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove config.h include from st.c to x.c
Devin J. Pohly [Tue, 17 Oct 2017 20:21:04 +0000 (15:21 -0500)]
Move config.h include from st.c to x.c

config.h includes references to KeySyms and other X stuff.  Until we
come up with a cleaner way to separate configuration, it is simpler
(leads to more code removal) to have this here.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoFactor out equivalent code from ttyread/ttysend
Devin J. Pohly [Mon, 16 Oct 2017 01:35:48 +0000 (20:35 -0500)]
Factor out equivalent code from ttyread/ttysend

The echo-to-terminal portions of ttyread and ttysend were actually doing
the same thing.  New function twrite() now handles this.  The parameter
show_ctrl determines whether control characters are shown as "^A".  This
was the only difference between tputc and techo, and techo is now unused
and removed.

(This commit should not change st's behaviour.)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove opt_* into same file as main()/run()
Devin J. Pohly [Fri, 13 Oct 2017 03:25:49 +0000 (22:25 -0500)]
Move opt_* into same file as main()/run()

This commit is purely about reducing externs and LOC.  If the main and
run functions ever move elsewhere (which will probably make sense
eventually), these should come along with them.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove key-matching functions into x.c
Devin J. Pohly [Wed, 11 Oct 2017 13:47:14 +0000 (08:47 -0500)]
Move key-matching functions into x.c

Modifiers and keysyms are specific to X, and the functions match and
kmap are only used in x.c.  Needed to global-ize the key arrays and
lengths from config.h (for now).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoPass new dimensions into ttyresize
Devin J. Pohly [Tue, 10 Oct 2017 20:51:23 +0000 (15:51 -0500)]
Pass new dimensions into ttyresize

This removes another reference to TermWindow from st.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove window-manipulating functions into x.c
Devin J. Pohly [Tue, 10 Oct 2017 17:46:53 +0000 (12:46 -0500)]
Move window-manipulating functions into x.c

xresize is now internal to x.c

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove font/fontspec variables into x.c and XWindow
Devin J. Pohly [Tue, 10 Oct 2017 17:17:25 +0000 (12:17 -0500)]
Move font/fontspec variables into x.c and XWindow

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove window urgency handling entirely into x.c
Devin J. Pohly [Tue, 10 Oct 2017 17:01:18 +0000 (12:01 -0500)]
Move window urgency handling entirely into x.c

This allows us to make xseturgency internal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove zoom functions into x.c
Devin J. Pohly [Tue, 10 Oct 2017 16:30:36 +0000 (11:30 -0500)]
Move zoom functions into x.c

This makes x(un)loadfonts internal to x.c.  Needed to reorder includes
and move a typedef to keep the compiler happy.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoMove usage() to be with run() in x.c
Devin J. Pohly [Tue, 10 Oct 2017 16:11:27 +0000 (11:11 -0500)]
Move usage() to be with run() in x.c

run/usage/xinit are now all internal to x.c

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoCall xsetenv() in main process instead of child
Devin J. Pohly [Tue, 10 Oct 2017 15:30:23 +0000 (10:30 -0500)]
Call xsetenv() in main process instead of child

This makes xsetenv internal to x.c, and allows iso14755's external
command to use $WINDOWID instead of having to snprintf it again.  (The
same benefit will apply to the externalpipe patch.)  The xwinid function
is no longer needed.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
6 years agoFix color with FAINT attribute
Benno Fünfstück [Tue, 26 Dec 2017 15:23:24 +0000 (16:23 +0100)]
Fix color with FAINT attribute

The alpha value needs to be initialized as well.

6 years agoApply ATTR_REVERSE after ATTR_FAINT
Benno Fünfstück [Tue, 26 Dec 2017 15:38:27 +0000 (16:38 +0100)]
Apply ATTR_REVERSE after ATTR_FAINT

An example where the new behaviour makes more sense:

Suppose some text is formatted with ATTR_FAINT for red for the foreground, so it
is rendered in a dark red. In that case, when selected with the mouse, the
intended behaviour is that foreground and background color are swapped: so the
selection should be rendered in dark red and the text in the default background
color.

Before this patch, what happened was that the selection would be in normal red
and the text in the darkened background color, making it almost unreadable.

For an example application that uses the FAINT attribute, try dmesg from
util-linux with color support, it uses FAINT for segfault messages.

6 years agoFix FAQ typo
George Ornbo [Wed, 20 Dec 2017 09:05:32 +0000 (09:05 +0000)]
Fix FAQ typo

7 years agoFix manpage typo
Paride Legovini [Tue, 10 Oct 2017 15:49:38 +0000 (17:49 +0200)]
Fix manpage typo

Signed-off-by: Paride Legovini <pl@ninthfloor.org>
7 years agoAdd an error for XftFontOpenPattern failure.
Gary Allen Vollink [Thu, 14 Sep 2017 19:30:02 +0000 (15:30 -0400)]
Add an error for XftFontOpenPattern failure.

7 years agoRevert "Revert "fixed STLDFLAG order in broken st Makefile""
Hiltjo Posthuma [Fri, 15 Sep 2017 09:16:37 +0000 (11:16 +0200)]
Revert "Revert "fixed STLDFLAG order in broken st Makefile""

This reverts commit 274d46ace00003d1df718b974d17642cbce167d5.

Sorry, the original commit was correct after all. It allows has the
correct link order and supports static-linking also.

Just a reminder: it is important to give a (brief) rationale of the
patch intentions.

7 years agobase64dec: skip non-printable characters like \r\n
Suraj N. Kurapati [Fri, 18 Aug 2017 06:00:10 +0000 (23:00 -0700)]
base64dec: skip non-printable characters like \r\n

Non-printable characters, such as line breaks, in a base64 encoded
string violate the "string length must be a multiple of four" rule.

This patch pads the result buffer by one extra unit of four bytes,
and skips over non-printable characters found in the input string.

7 years agoRevert "fixed STLDFLAG order in broken st Makefile"
Hiltjo Posthuma [Wed, 13 Sep 2017 20:40:36 +0000 (22:40 +0200)]
Revert "fixed STLDFLAG order in broken st Makefile"

This reverts commit 7f990328e4fec8dfaaad311cb8af2304b58c872e.

this was wrong as pointed out by k0ga:
"STLDFLAGS is about flags to the linker, for example -L
not about -l for that reason it must go before the object list".

7 years agoRevert "make clipboard patch obsolete"
Hiltjo Posthuma [Sat, 2 Sep 2017 11:52:33 +0000 (13:52 +0200)]
Revert "make clipboard patch obsolete"

This reverts commit 77c51c5a6b16387f1792e23acbcf2080f790aa25.

Having multiple clipboards are useful, for example for plumber scripts.
I've discussed this on IRC and it is useful to have.

7 years agomake clipboard patch obsolete
Anselm R Garbe [Fri, 1 Sep 2017 07:48:24 +0000 (09:48 +0200)]
make clipboard patch obsolete

7 years agofixed STLDFLAG order in broken st Makefile
Anselm R Garbe [Sun, 23 Jul 2017 09:17:26 +0000 (11:17 +0200)]
fixed STLDFLAG order in broken st Makefile

7 years agoRevert "Add bold off SGR"
Quentin Rameau [Tue, 11 Jul 2017 21:16:25 +0000 (23:16 +0200)]
Revert "Add bold off SGR"

This reverts commit 6cb6d61525931c88971cce323f63e40451a6d365.
This wasn't a useful thing after all.

7 years agoAdd dim/smxx/rmxx to terminfo, remove duplicate kich1
Quentin Rameau [Tue, 11 Jul 2017 21:03:27 +0000 (23:03 +0200)]
Add dim/smxx/rmxx to terminfo, remove duplicate kich1

7 years agoLet the user specify C and LD FLAGS
Quentin Rameau [Tue, 11 Jul 2017 22:26:35 +0000 (00:26 +0200)]
Let the user specify C and LD FLAGS

7 years agoDo not obfuscate what make is doing.
Quentin Rameau [Tue, 11 Jul 2017 22:24:51 +0000 (00:24 +0200)]
Do not obfuscate what make is doing.

Change some styling too while we're at it.

7 years agoAdd color change terminfo capabilities
Marc André Tanner [Mon, 15 May 2017 10:45:41 +0000 (12:45 +0200)]
Add color change terminfo capabilities

7 years agoAdd bold off SGR
Quentin Rameau [Sun, 28 May 2017 07:56:57 +0000 (09:56 +0200)]
Add bold off SGR

7 years agost.1: modify man page to accurately reflect default keybindings
greg.reagle@umbc.edu [Mon, 10 Apr 2017 16:24:03 +0000 (18:24 +0200)]
st.1: modify man page to accurately reflect default keybindings

Attached.

===> 2/ (text/x-patch) [file]
cp /mail/fs/mbox/298/2/body /usr/k0ga/0001-st.1-modify-man-page-to-accurately-reflect-default-k.patch

From 265db94b1eca5850d484f86b7db4af8e57822cfe Mon Sep 17 00:00:00 2001
From: Greg Reagle <greg.reagle@umbc.edu>
Date: Sun, 9 Apr 2017 23:05:47 -0400
Subject: [PATCH] st.1: modify man page to accurately reflect default
 keybindings

7 years agoSimplify how we keep ATTRs under cursor
Quentin Rameau [Tue, 4 Apr 2017 15:20:55 +0000 (17:20 +0200)]
Simplify how we keep ATTRs under cursor

Thanks to tarug0 for the suggestion/patch.

7 years agoFix commented out code
Alexander Krotov [Sat, 25 Mar 2017 20:02:42 +0000 (23:02 +0300)]
Fix commented out code

7 years agokeep some glyph modes for the cursor
Nils Reuße [Wed, 29 Mar 2017 16:34:12 +0000 (18:34 +0200)]
keep some glyph modes for the cursor

st currently does not keep any mode for the cursor that was active
in the underlying glyph (e.g. italic text), the mode is always
ATTR_NULL [1].  At [2] you can find a screenshot that shows the
implications.  Other terminals (at least vte-based, such as
XFCE-terminal) keep some modes for the cursor.  I find the current
behaviour very disruptive, so here is a patch that keeps a few
(arbitrarily chosen) modes for the cursor.

[1] http://git.suckless.org/st/tree/st.c#n3963
[2] http://i.imgur.com/R2yCEaC.png

7 years agoSupport xterm Ms feature to set clipboard
osandov@osandov.com [Sat, 18 Mar 2017 10:55:04 +0000 (11:55 +0100)]
Support xterm Ms feature to set clipboard

This is used by, e.g., tmux.

7 years agoChange default keybindings
Roberto E. Vargas Caballero [Wed, 25 Jan 2017 18:17:38 +0000 (19:17 +0100)]
Change default keybindings

CTRL+SHIFT is an impossible combination in the terminal world
(0x20 | x & 0x1F), so it is perfect to be used for internals
shortcuts of terminals, and being a double combination
reduces the prossibility of having comflicts.

7 years agoSplit X-specific code into x.c
Michael Forney [Fri, 20 Jan 2017 08:06:39 +0000 (00:06 -0800)]
Split X-specific code into x.c

7 years agoMove column and row default numbers into config.h
fpqc [Wed, 14 Dec 2016 06:51:27 +0000 (06:51 +0000)]
Move column and row default numbers into config.h

8 years agoRevert "Initial font size issue."
Roberto E. Vargas Caballero [Thu, 24 Nov 2016 19:21:19 +0000 (20:21 +0100)]
Revert "Initial font size issue."

This reverts commit 424202798b02554092ba84dd59fb7b79b59b7b75.

8 years agoFixed 'missing glyph doesn't use fontconfig config substitutions' bug
Spencer Phippen [Wed, 23 Nov 2016 18:17:59 +0000 (19:17 +0100)]
Fixed 'missing glyph doesn't use fontconfig config substitutions' bug

XftFontMatch does display-specific font configuration (commit 528241a).
Nice. Unfortunately, when we switched from FcFontMatch, we also stopped
storing the post-Fc{Config,Default}Substitute FcPattern for future
lookups. The result is that if a glyph isn't found in the primary font,
secondary font lookups use the original FcPattern, not the configured
one. If you have custom fontconfig rules (like me), this can be
disappointing.

I basically just copied the guts out of XftFontMatch[1] and saved
the intermediate configured FcPattern. Could be related to the bug that
inspired commit 4242027.

[1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftfont.c

8 years agomake the various combinations of arrow keys and shift/control/meta work
Manuel Tobias Schiller [Mon, 14 Nov 2016 17:25:51 +0000 (18:25 +0100)]
make the various combinations of arrow keys and shift/control/meta work

When using st with screen, I've bound next, prev, new screen to
combinations like Ctrl-Alt-Right,Left,Down; xterm and (u)rxvt work fine
when this combination of modifiers is pressed, st does not seem to
transport all of them; a single modifier key is fine (e.g. Ctrl-Up,
Alt-Down etc., but combinations are not). While I'm not terribly
familiar with this, I have tried to hack config.h in a more or less
systematic way to generate the expected sequences.

8 years agoInitial font size issue.
ian@remmler.org [Fri, 11 Nov 2016 16:52:07 +0000 (17:52 +0100)]
Initial font size issue.

Hi,

When I specify a font by point size (I'm using "Inconsolata:size=12"),
characters that are substituted from another font because they are not in the
main one appear too small.  Doing a zoom reset fixes it.  For example:

Before: http://i.imgur.com/G4Mfv4X.png
After:  http://i.imgur.com/PMDhfQA.png

I found that adding the pixel size (acquired from the initial font load) to the
pattern then reloading the font fixes the problem.  I'm not sure if this is a
proper fix, though.

8 years agotic -s -> tic -sx (Treat unknown capabilities as user-defined.)
pl@ninthfloor.org [Fri, 11 Nov 2016 16:45:45 +0000 (17:45 +0100)]
tic -s -> tic -sx (Treat unknown capabilities as user-defined.)

8 years agoAdd tmux capabilities to st.info
pl@ninthfloor.org [Fri, 11 Nov 2016 16:45:46 +0000 (17:45 +0100)]
Add tmux capabilities to st.info

8 years agoMake strdump(), csidump(), print to stderr
pl@ninthfloor.org [Fri, 11 Nov 2016 16:45:52 +0000 (17:45 +0100)]
Make strdump(), csidump(), print to stderr

The two functions strdump(), csidump() are called to show errors and
their output is introduced by a message printed to stderr. Thus, it it
more consistent to have them print to stderr.

Moreover stderr is unbuffered (at least on Linux), making problems
immediately visible.

8 years agoDo not use color when font attributes are supported
Quentin Rameau [Sat, 22 Oct 2016 14:36:10 +0000 (16:36 +0200)]
Do not use color when font attributes are supported

If fontconfig gives us a font without the attributes we asked for,
display an alternative color instead.

8 years agost.1: add an entry for ISO-14755 shortcut
Quentin Rameau [Sat, 22 Oct 2016 08:42:46 +0000 (10:42 +0200)]
st.1: add an entry for ISO-14755 shortcut

8 years agoAdd support for iso14755
Quentin Rameau [Sat, 8 Oct 2016 14:22:18 +0000 (16:22 +0200)]
Add support for iso14755

We launch dmenu for getting a codepoint, then convert it and send it to
the terminal.

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.