1016 Commits (a3beb626d2dae9d4d0883c7c8cb6ba58b0609105)
 

Author SHA1 Message Date
Devin J. Pohly a3beb626d2 Remove x.c dependency on term
The xinit function only needs to the rows/cols, so pass those in rather
than accessing term directly.  With a bit of arithmetic, we are able to
avoid the need for term.row and term.col in x2col, y2row, and
xdrawglyphfontspecs as well, completing the removal.

Term is now fully internal to st.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly a5dc1b4697 Pull term references out of xdrawcursor
Gradually reducing x.c dependency on Term object.  Old and new cursor
glyph/position are passed to xdrawcursor.  (There may be an opportunity
to refactor further if we can unify "clear old cursor" and "draw new
cursor" functionality.)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly 88d8293fb4 Move win-agnostic parts of draw/drawregion to st.c
Introduces three functions to encapsulate X-specific behavior:
 * xdrawline: draws a portion of a single line (used by drawregion)
 * xbegindraw: called to prepare for drawing (will be useful for e.g.
   Wayland) and returns true if drawing should happen
 * xfinishdraw: called to finish drawing (used by draw)

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly 05c66cb37d Split mode bits between Term and TermWindow
Moves the mode bits used by x.c from Term to TermWindow, absorbing
UI/input-related mode bits (visible/focused/numlock) along the way.

This is gradually reducing external references to Term.  Since
TermWindow is already internal to x.c, we add xsetmode() to allow st to
modify window bits in accordance with escape sequences.

IS_SET() is redefined accordingly (term.mode in st.c, win.mode in x.c).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly 33201ac65f Move CRLF input processing into ttywrite
This also allows us to remove the crlf field from the Key struct, since
the only difference it made was converting "\r" to "\r\n" (which is now
done automatically in ttywrite).  In addition, MODE_CRLF is no longer
referenced from x.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly 52d6fb1ab1 Move terminal echo logic into st.c
The only thing differentiating ttywrite and ttysend was the potential
for echo; make this a parameter and remove ttysend.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly cfc7acdfd9 Move remaining selection mode logic into selextend
The "done" parameter indicates a change which finalizes the selection
(e.g. a mouse button release as opposed to motion).

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly bcb5d3adbe 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>
7 years ago
Devin J. Pohly 5683b1f80c 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>
7 years ago
Devin J. Pohly 138caf294e Have selected() check whether selection exists
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly d84f3f4bd1 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>
7 years ago
Devin J. Pohly 8b564c1a3f 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>
7 years ago
Devin J. Pohly 3bb900cd6c 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>
7 years ago
Devin J. Pohly 323d38da20 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>
7 years ago
Devin J. Pohly 416dd25727 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>
7 years ago
Devin J. Pohly 75c9a0ee1d 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>
7 years ago
Devin J. Pohly 428f01969a 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>
7 years ago
Devin J. Pohly 65976c1a29 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>
7 years ago
Devin J. Pohly 32d3b1d00f 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>
7 years ago
Devin J. Pohly 69e32a61df 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>
7 years ago
Devin J. Pohly ed132e1127 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>
7 years ago
Devin J. Pohly dbe8676d7d Pass new dimensions into ttyresize
This removes another reference to TermWindow from st.c.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly a8314643b1 Move window-manipulating functions into x.c
xresize is now internal to x.c

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly a09138afa5 Move font/fontspec variables into x.c and XWindow
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly 626b0ae40c Move window urgency handling entirely into x.c
This allows us to make xseturgency internal.

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
7 years ago
Devin J. Pohly d5275012b4 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>
7 years ago
Devin J. Pohly 3518dba2a5 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>
7 years ago
Devin J. Pohly 3e44ee5569 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>
7 years ago
Benno Fünfstück 1f24bde82b Fix color with FAINT attribute
The alpha value needs to be initialized as well.
7 years ago
Benno Fünfstück e829e13bb1 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.
7 years ago
George Ornbo c1d23afa9c Fix FAQ typo 7 years ago
Paride Legovini 0ac685fc01 Fix manpage typo
Signed-off-by: Paride Legovini <pl@ninthfloor.org>
7 years ago
Gary Allen Vollink b1338e91ed Add an error for XftFontOpenPattern failure. 7 years ago
Hiltjo Posthuma b2ac917753 Revert "Revert "fixed STLDFLAG order in broken st Makefile""
This reverts commit 274d46ace0.

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 ago
Suraj N. Kurapati ee5cc8e903 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 ago
Hiltjo Posthuma 274d46ace0 Revert "fixed STLDFLAG order in broken st Makefile"
This reverts commit 7f990328e4.

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 ago
Hiltjo Posthuma 9c61f29bb7 Revert "make clipboard patch obsolete"
This reverts commit 77c51c5a6b.

Having multiple clipboards are useful, for example for plumber scripts.
I've discussed this on IRC and it is useful to have.
7 years ago
Anselm R Garbe 77c51c5a6b make clipboard patch obsolete 7 years ago
Anselm R Garbe 7f990328e4 fixed STLDFLAG order in broken st Makefile 7 years ago
Quentin Rameau 8dacdfbab1 Revert "Add bold off SGR"
This reverts commit 6cb6d61525.
This wasn't a useful thing after all.
7 years ago
Quentin Rameau c0882f2ed1 Add dim/smxx/rmxx to terminfo, remove duplicate kich1 7 years ago
Quentin Rameau d4928edba0 Let the user specify C and LD FLAGS 7 years ago
Quentin Rameau fabd4602b3 Do not obfuscate what make is doing.
Change some styling too while we're at it.
7 years ago
Marc André Tanner b331da550b Add color change terminfo capabilities 7 years ago
Quentin Rameau 6cb6d61525 Add bold off SGR 7 years ago
greg.reagle@umbc.edu 5a10aca702 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
8 years ago
Quentin Rameau 745c40f8b0 Simplify how we keep ATTRs under cursor
Thanks to tarug0 for the suggestion/patch.
8 years ago
Alexander Krotov 149c0d3aed Fix commented out code 8 years ago
Nils Reuße f2bfd513b1 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
8 years ago
osandov@osandov.com e7ed326d2e Support xterm Ms feature to set clipboard
This is used by, e.g., tmux.
8 years ago