aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Call xsetcursor to set win.cursor in mainSteve Ward2020-05-241-5/+4
| | | | | In xsetcursor, remove "DEFAULT(cursor, 1)" because 0 is a valid value. Increase max allowed value of cursor from 6 to 7 (st extension).
* Revert "support REP (repeat) escape sequence"Hiltjo Posthuma2020-05-162-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e8392b282c2eaa28725241a9612804fb55113da4. There is currently a bug in older ncurses versions (like on OpenBSD) where a fix for a bug with REP is not backported yet. Most likely in tty/tty_update.c: Noticed while using lynx (which uses ncurses/curses). To reproduce using lynx: echo "Z0000000" | lynx -stdin or using the program: int main(void) { WINDOW *win; win = initscr(); printw("Z0000000"); refresh(); sleep(5); return 0; } This prints "ZZZZZZZ" (incorrectly).
* support REP (repeat) escape sequenceAvi Halachmi (:avih)2020-05-162-0/+11
| | | | | | | | | | | | | | | | The sequence \e[Nb prints the last printed char N (more) times if it's printable, and it's ignored after newline or other control chars. This is Ecma-048/ANSI-X3.6 sequence and not DEC VT. It's supported by xterm, and ncurses uses it when possible, e.g. when TERM is xterm* (and with this commit also st*). xterm supports only codepoints<=255, possibly due to internal limits. We support any value/codepoint which was placed in a cell. To test: - tput rep 65 4 -> prints 'AAAA' - printf "\342\225\246\033[4b" -> prints U+2566 1+4 times.
* Add rin terminfo capabilityRoberto E. Vargas2020-05-161-0/+1
| | | | Tianlin Qu discovered that st is missing rin (scroll back #1 lines).
* Make shift+wheel behaves as shift+Prev/Nextk0ga2020-05-161-0/+2
| | | | | | | | | | | | | | | St uses a very good hack where mouse wheel genereates ^Y and ^E, that are the same keys that less and vi uses for backward and fordward scrolling. Scroll, as many terminal emulators, use shift+Prev/Next for scrolling, but it is also using ^E and ^Y for scroling, characters that are reserved in the POSIX shell in emacs mode for end of line and yanking, making scroll unsable in st. This patch adds a new hack, making shift+wheel returning the same sequences than shift+Prev/Next, meaning that scroll or any other similar program will not be able to differentiate between them.
* Fix selection: selscrollJakub Leszczak2020-05-121-18/+8
|
* Fix selection: ignore ATTR_WRAP when rectangular selection in getselJakub Leszczak2020-05-121-1/+2
|
* Fix selection: selclear in tputcJakub Leszczak2020-05-121-1/+1
|
* code-style: add fallthrough commentHiltjo Posthuma2020-05-092-0/+2
| | | | Patch by Steve Ward, thanks.
* optimize column width calculation and utf-8 encode for ASCIIHiltjo Posthuma2020-05-091-1/+1
| | | | | In particular on OpenBSD and on glibc wcwidth() is quite expensive. On musl there is little difference.
* fix for incorrect (partial) written sequences when libc wcwidth() == -1Hiltjo Posthuma2020-05-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix an issue with incorrect (partial) written sequences when libc wcwidth() == -1. The sequence is updated to on wcwidth(u) == -1: c = "\357\277\275" but len isn't. A way to reproduce in practise: * st -o dump.txt * In the terminal: printf '\xcd\xb8' - This is codepoint 888, on OpenBSD it reports wcwidth() == -1. - Quit the terminal. - Look in dump.txt (partial written sequence of "UTF_INVALID"). This was introduced in: " commit 11625c7166b7e4dad414606227acec2de1c36464 Author: czarkoff@gmail.com <czarkoff@gmail.com> Date: Tue Oct 28 12:55:28 2014 +0100 Replace character with U+FFFD if wcwidth() is -1 Helpful when new Unicode codepoints are not recognized by libc." Change: Remove setting the sequence. If this happens to break something, another solution could be setting len = 3 for the sequence.
* tiny code-style and typo-fix in commentHiltjo Posthuma2020-05-092-4/+4
|
* auto-sync: draw on idle to avoid flicker/tearingAvi Halachmi (:avih)2020-05-092-66/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | st could easily tear/flicker with animation or other unattended output. This commit eliminates most of the tear/flicker. Before this commit, the display timing had two "modes": - Interactively, st was waiting fixed `1000/xfps` ms after forwarding the kb/mouse event to the application and before drawing. - Unattended, and specifically with animations, the draw frequency was throttled to `actionfps`. Animation at a higher rate would throttle and likely tear, and at lower rates it was tearing big frames (specifically, when one `read` didn't get a full "frame"). The interactive behavior was decent, but it was impossible to get good unattended-draw behavior even with carefully chosen configuration. This commit changes the behavior such that it draws on idle instead of using fixed latency/frequency. This means that it tries to draw only when it's very likely that the application has completed its output (or after some duration without idle), so it mostly succeeds to avoid tear, flicker, and partial drawing. The config values minlatency/maxlatency replace xfps/actionfps and define the range which the algorithm is allowed to wait from the initial draw-trigger until the actual draw. The range enables the flexibility to choose when to draw - when least likely to flicker. It also unifies the interactive and unattended behavior and config values, which makes the code simpler as well - without sacrificing latency during interactive use, because typically interactively idle arrives very quickly, so the wait is typically minlatency. While it only slighly improves interactive behavior, for animations and other unattended-drawing it improves greatly, as it effectively adapts to any [animation] output rate without tearing, throttling, redundant drawing, or unnecessary delays (sounds impossible, but it works).
* replace exit(3) by _exit(2) in signal handler sigchld()Jan Klemkow2020-04-301-1/+1
| | | | | exit(3) is not async-signal-safe but, _exit(2) is. This change prevents st to crash and dump core.
* bump version to 0.8.3Hiltjo Posthuma2020-04-271-1/+1
|
* Update XIM cursor position only if changedIvan Tham2020-04-191-3/+6
| | | | | Updating XIM cursor position is expensive, so only update it when cursor position changed.
* just remove the EOF messageHiltjo Posthuma2020-04-111-1/+0
|
* Add st-mono terminfo entryRoberto E. Vargas Caballero2020-04-111-8/+12
| | | | | This entry is intended for monocolor display and it is very helpful for color haters.
* config.def.h: add a comment for the scroll variableHiltjo Posthuma2020-04-111-0/+1
|
* Fix small typosHiltjo Posthuma2020-04-111-4/+3
|
* Launch scroll program with the default shellQuentin Rameau2020-04-111-3/+6
|
* Update FAQ with the last modificationsRoberto E. Vargas Caballero2020-04-111-3/+9
|
* Add terminfo entries for backspace modeRoberto E. Vargas Caballero2020-04-111-0/+10
| | | | | | | | | | | | | | | | | | St used to use backspace as BS until the commit 230d0c8, but due to general lack of knowledge of lusers, we moved to the most common configuration in linux to avoid answering the same question 3 times per month. With the most common configuration we have a backspace that returns a DEL, and we have a Delete key that doesn't return a DEL character neither a BS. When dealing with devices connected using a serial line (or even with Plan9) it is more common Backspace as BS and Delete as DEL. For this reason, st is not always the best tool when you talk with a serial device. This patch adds new terminfo entries for Backspace as BS and Delete as DEL. A patch for confg.h is also added, to make easier switch between both configurations.
* Fix style issueRoberto E. Vargas Caballero2020-04-111-1/+2
|
* ttyread: test for EOF while reading ttyRoberto E. Vargas Caballero2020-04-111-9/+16
| | | | | | When a read operation returns 0 then it means that we arrived to the end of the file, and new reads will return 0 unless you do some other operation such as lseek(). This case happens with USB-232 adapters when they are unplugged.
* Add support for scroll(1)Roberto E. Vargas Caballero2020-04-114-8/+15
| | | | | | | | | Scroll is a program that stores all the lines of its child and be used in st as a way of implementing scrollback. This solution is much better than implementing the scrollback in st itself because having a different program allows to use it in any other program without doing modifications to those programs.
* make argv0 not static, fixes a warning with tccHiltjo Posthuma2020-04-101-1/+1
| | | | Reported by Aajonus, thanks!
* mouseshortcuts: fix custom modifier on releaseAvi Halachmi (:avih)2020-04-021-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | This line didn't work at mshortcuts at config.h: /* mask button function arg release */ { ShiftMask, Button2, selpaste, {.i = 0}, 1 }, and now it does work. The issue was that XButtonEvent.state is "the logical state ... just prior to the event", which means that on release the state has the Button2Mask bit set because button2 was down just before it was released. The issue didn't manifest with the default shift + middle-click on release (to override mouse mode) because its specified modifier is XK_ANY_MOD, at which case match(...) ignores any specific bits and simply returns true. The issue also doesn't manifest on press, because prior to the event Button<N> was not down and its mask bit is not set. Fix by filtering out the mask of the button which we're currently matching. We could have said "well, that's how button events behave, you should use ShiftMask|Button2Mask for release", but this both not obvious to figure out, and specifically here always filtering does not prevent configuring any useful modifiers combination. So it's a win-win.
* Remove explicit XNFocusWindowIvan Tham2020-02-191-1/+0
| | | | | | | | | | | | | | | | | XCreateIC ICValues default XNFocusWindow to XNClientWindow if not specified, it can be omitted since it is the same. From the documentation https://www.x.org/releases/current/doc/libX11/libX11/libX11.html > Focus Window > > The XNFocusWindow argument specifies the focus window. The primary > purpose of the XNFocusWindow is to identify the window that will receive > the key event when input is composed. > > When this XIC value is left unspecified, the input method will use the > client window as the default focus window.
* x: fix XIM handlingQuentin Rameau2020-02-021-24/+44
| | | | | | | | | | | Do not try to set specific IM method, let the user specify it with XMODIFIERS. If the requested method is not available or opening fails, fallback to the default input handler and register a handler on the new IM server availability signal. Do the same when the input server is closed and (re)started.
* x: check we still have an XIC context before accessing itQuentin Rameau2020-02-021-2/+5
|
* x: do not instantiate a new nested list on each cursor moveQuentin Rameau2020-02-021-4/+12
|
* x: move IME variables into XWindow ime embedded structQuentin Rameau2020-02-021-12/+14
|
* Increase XmbLookupString bufferIvan Tham2020-01-181-1/+1
| | | | | | | | | | | | Current buffer is too short to input medium to long sentences from IME. Input with longer text will show the wrong input, taking 64 instead of 32 bytes should be enough for most of the cases. Broken cases before, Chinese (taken from song 也可以) 可不可以轻轻的松开自己 Japanese (taken from bootleggers rom quote) あなたは家のように感じる
* update FAQHiltjo Posthuma2019-11-171-10/+11
| | | | | | - add common question about the w3m image drawing hack. - remove some bad advise about $TERM. - change some links to https.
* OSC 52 - copy to clipboard: don't limit to 382 bytesAvi Halachmi (:avih)2019-11-101-4/+11
| | | | | | | | | | | | | | | | | | Strings which an application sends to the terminal in OSC, DCS, etc are typically small (title, colors, etc) but one exception is OSC 52 which copies text to the clipboard, and is used for instance by tmux. Previously st cropped these strings at 512 bytes, which for OSC 52 limited the copied text to 382 bytes (remaining buffer space before base64). This made it less useful than it can be. Now it's a dynamic growing buffer. It remains allocated after use, resets to 512 when a new string starts, or leaked on exit. Resetting/deallocating the buffer right after use (at strhandle) is possible with some more code, however, it doesn't always end up used, and to cover those cases too will require even more code, so resetting only on new string is good enough for now.
* CSIEscape, STREscape: use size_t for buffer lengthHiltjo Posthuma2019-11-101-4/+4
|
* STREscape: don't trim prematurelyAvi Halachmi (:avih)2019-11-101-1/+1
| | | | | | | | | | | STRescape holds strings in escape sequences such as OSC and DCS, and its buffer is 512 bytes. If the input is too big then trailing chars are ignored, but the test was off-by-1 such that it took 510 chars instead of 511 (before a terminating NULL is added). Now the full size can be utilized.
* base64dec: don't read out of boundsAvi Halachmi (:avih)2019-11-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, base64dec checked terminating input '\0' every 4 calls to base64dec_getc, where the latter progressed one or more chars on each call, and could read past '\0' in the way it was used. The input to base64dec currently comes only from OSC 52 escape seq (copy to clipboard), and reading past '\0' or even past the buffer boundary was easy to trigger. Also, even if we could trust external input to be valid base64, there are different base64 standards, and not all of them require padding to 4 bytes blocks (using trailing '=' chars). It didn't affect short OSC 52 strings because the buffer is initialized to 0's, so typically it did stop within the buffer, but if the string was trimmed to fit (the buffer is 512 bytes) then it did also read past the end of the buffer, and the decoded suffix ended up arbitrary. This patch makes base64dec_getc not progress past '\0', and instead produce fake trailing padding of '='. Additionally, at base64dec, if padding is detected at the first or second byte of a quartet, then we identify it as invalid and abort (a valid quartet has at least two leading non-padding bytes).
* Fix tmux terminfo extensions Se and SsSebastian J. Bronner2019-11-051-2/+2
| | | | | | | | | | | The tmux terminfo extensions Ss and Se are currently specified as booleans in `st.info`. They should be strings. See https://github.com/tmux/tmux/blob/eeedb43ae847a0a692ceea965f7556e84bca4fd0/tty-term.c lines 254 and 265. I have used the values from https://invisible-island.net/ncurses/terminfo.src.html#toc-_S_I_M_P_L_E_T_E_R_M for this patch.
* apply hints before initial mapping (ICCCM)Ingo Lohmar2019-10-261-1/+1
| | | | | | | | | For WM_CLASS this is mentioned in the ICCCM docs https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.5 (third sentence). When changing the WM_CLASS from the command line, this is necessary for window managers to pick it up before applying class-based rules.
* mouse shortcuts: allow using forcemousemod (e.g. shift)Avi Halachmi (:avih)2019-10-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent mouse shurtcuts commits allow customization, but ignore forcemousemod mask (default: shift) as a modifier, for no good reason other than following the behavior of the KB shortcuts. Allow using forcemousemod too, which now can be used to invoke different shortcuts, though the automatic effect of forcemousemod will be lost for buttons which use mask with forcemousemod. E.g. the default is: static uint forcemousemod = ShiftMask; ... { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, ... where ttysend will be invoked for button4 with any mod when not in mouse mode, and with shift when in mouse mode. Now it's possible to do this: { ShiftMask, Button4, ttysend, {.s = "foo"} }, { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, Which will invoke ttysend("foo") while shift is held and ttysend("\031") otherwise. Shift still overrides mouse mode, but will now send "foo". Previously with this setup the second binding was always invoked because the forceousemod mask was always removed from the event. Buttons which don't use forcemousemod behave the same as before. This is useful e.g. for the scrollback mouse patch, which wants to configure shift+wheel for scrollback, while keeping the normal behavior without shift.
* mouse shortcuts: don't hardcode selpasteAvi Halachmi (:avih)2019-10-132-12/+26
| | | | | | | | Because selpaste is activated on release, a release flag was added to mouse shortcuts which controls whether activation is on press/release, and selpaste binding to button2 was moved to config.h . button1 remains the only hardcoded mouse button - for selection + copy.
* mouse shortcuts: allow override for all shortcutsAvi Halachmi (:avih)2019-10-132-13/+13
| | | | | | | | | | | | | | | Allow forceselmod to override all mouse shortcuts rather than only selection, and rename it to forcemousemod as it's now more appropriate. This will affect mouse shortcuts which use mask other than XK_ANY_MOD. This does not affect the default behavior because the default mouse shortcuts (wheel) use XK_ANY_MOD, where forceselmod already activated the override also before this change. Previously, if a mouse shortcut was configured with a specific mod and forceselmod was held, then the shortcut did not execute unless the configured mod included forceselmod.
* mouse shortcuts: allow same functions as kb shortcutsAvi Halachmi (:avih)2019-10-133-9/+18
| | | | | | | Previously mouse shortcuts supported only ttywrite. This required adding an "Arg" function ttysend - which does what the original mouse shortcuts did.
* config.def.h: remove crlf value sectionHiltjo Posthuma2019-08-261-4/+0
| | | | | | this is not used anymore. patch sent as an ed script using RFC2549 by k0ga.
* FAQ: add entry about color emoji Xft bugHiltjo Posthuma2019-05-171-0/+27
| | | | | This has been asked many times on IRC and the mailinglist. Make it easier to find information about this particular Xft issue by adding it to the FAQ.
* selection: fix view to match actual selection on first cellAvi Halachmi (:avih)2019-04-141-1/+1
|
* revert part of commit add0211522737b79dad990ccd65c8af63b5cc1ddHiltjo Posthuma2019-03-153-7/+5
| | | | | | | | | | "use iswspace()/iswpunct() to find word delimiters this inverts the configuration logic: you no longer provide a list of delimiters -- all space and punctuation characters are considered delimiters, unless listed in extrawordchars." Feedback from IRC and personal preference.
* dont print color warning on color reset OSC 104 without parameterHiltjo Posthuma2019-03-151-1/+4
| | | | | | also print explicitly "(null)" when printf "%s" p=NULL. noticed when exiting mutt: printf '\x1b]104\x07'