summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-04-19Update XIM cursor position only if changedIvan Tham
Updating XIM cursor position is expensive, so only update it when cursor position changed.
2020-04-11just remove the EOF messageHiltjo Posthuma
2020-04-11Add st-mono terminfo entryRoberto E. Vargas Caballero
This entry is intended for monocolor display and it is very helpful for color haters.
2020-04-11config.def.h: add a comment for the scroll variableHiltjo Posthuma
2020-04-11Fix small typosHiltjo Posthuma
2020-04-11Launch scroll program with the default shellQuentin Rameau
2020-04-11Update FAQ with the last modificationsRoberto E. Vargas Caballero
2020-04-11Add terminfo entries for backspace modeRoberto E. Vargas Caballero
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.
2020-04-11Fix style issueRoberto E. Vargas Caballero
2020-04-11ttyread: test for EOF while reading ttyRoberto E. Vargas Caballero
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.
2020-04-11Add support for scroll(1)Roberto E. Vargas Caballero
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.
2020-04-10make argv0 not static, fixes a warning with tccHiltjo Posthuma
Reported by Aajonus, thanks!
2020-04-02mouseshortcuts: fix custom modifier on releaseAvi Halachmi (:avih)
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.
2020-02-19Remove explicit XNFocusWindowIvan Tham
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.
2020-02-02x: fix XIM handlingQuentin Rameau
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.
2020-02-02x: check we still have an XIC context before accessing itQuentin Rameau
2020-02-02x: do not instantiate a new nested list on each cursor moveQuentin Rameau
2020-02-02x: move IME variables into XWindow ime embedded structQuentin Rameau
2020-01-18Increase XmbLookupString bufferIvan Tham
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) あなたは家のように感じる
2019-11-17update FAQHiltjo Posthuma
- add common question about the w3m image drawing hack. - remove some bad advise about $TERM. - change some links to https.
2019-11-10OSC 52 - copy to clipboard: don't limit to 382 bytesAvi Halachmi (:avih)
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.
2019-11-10CSIEscape, STREscape: use size_t for buffer lengthHiltjo Posthuma
2019-11-10STREscape: don't trim prematurelyAvi Halachmi (:avih)
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.
2019-11-10base64dec: don't read out of boundsAvi Halachmi (:avih)
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).
2019-11-05Fix tmux terminfo extensions Se and SsSebastian J. Bronner
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.
2019-10-26apply hints before initial mapping (ICCCM)Ingo Lohmar
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.
2019-10-24mouse shortcuts: allow using forcemousemod (e.g. shift)Avi Halachmi (:avih)
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.
2019-10-13mouse shortcuts: don't hardcode selpasteAvi Halachmi (:avih)
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.
2019-10-13mouse shortcuts: allow override for all shortcutsAvi Halachmi (:avih)
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.
2019-10-13mouse shortcuts: allow same functions as kb shortcutsAvi Halachmi (:avih)
Previously mouse shortcuts supported only ttywrite. This required adding an "Arg" function ttysend - which does what the original mouse shortcuts did.
2019-08-26config.def.h: remove crlf value sectionHiltjo Posthuma
this is not used anymore. patch sent as an ed script using RFC2549 by k0ga.
2019-05-17FAQ: add entry about color emoji Xft bugHiltjo Posthuma
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.
2019-04-14selection: fix view to match actual selection on first cellAvi Halachmi (:avih)
2019-03-15revert part of commit add0211522737b79dad990ccd65c8af63b5cc1ddHiltjo Posthuma
"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.
2019-03-15dont print color warning on color reset OSC 104 without parameterHiltjo Posthuma
also print explicitly "(null)" when printf "%s" p=NULL. noticed when exiting mutt: printf '\x1b]104\x07'
2019-03-15minor code-style, initialize var at the top of functionHiltjo Posthuma
2019-03-15config.def.h: tweak extra worddelimitersHiltjo Posthuma
This changes the selection more like xterm. To test try: "find /" and select a path.
2019-03-15use iswspace()/iswpunct() to find word delimitersLauri Tirkkonen
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.
2019-03-15replace utf8strchr with wcschrLauri Tirkkonen
2019-03-13be silent about explicitly unhandled mouse modesLauri Tirkkonen
2019-03-03simplify (greedy) font caching allocating a bitHiltjo Posthuma
POSIX says: "If ptr is a null pointer, realloc() shall be equivalent to malloc() for the specified size."
2019-03-03style: remove double empty newlinesHiltjo Posthuma
2019-03-03fix use after free in font caching algorithmmagras
Current font caching algorithm contains a use after free error. A font removed from `frc` might be still listed in `wx.specbuf`. It will lead to a crash inside `XftDrawGlyphFontSpec()`. Steps to reproduce: $ st -f 'Misc Tamsyn:scalable=false' $ curl https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt Of course, result depends on fonts installed on a system and fontconfig. In my case, I'm getting consistent segfaults with different fonts. I replaced a fixed array with a simple unbounded buffer with a constant growth rate. Cache starts with a capacity of 0, gets increments by 16, and never shrinks. On my machine after `cat UTF-8-demo.txt` buffer reaches a capacity of 192. During casual use capacity stays at 0.
2019-02-12better Input Method Editor (IME) supportIvan Tham
Features: - Allow input methods swap with hotkey (E.g. left ctrl + left shift). - Over-the-spot pre-editing style, pre-edit data placed over insertion point. - Restart IME without segmentation fault. TODO: - Automatically pickup IME if st started before IME
2019-02-09bump version to 0.8.2Hiltjo Posthuma
2019-01-10config: add Shift+Insert as selpaste() againHiltjo Posthuma
This was changed before in: commit 20f713548de451b67db3306cf8cf7b2f38fee05c on Wed Jan 25 19:17:38 2017
2019-01-10Let the user specify CPPFLAGSParide Legovini
This complements the work done in d4928ed, allowing the user to specify the preprocessor flags with the CPPFLAGS environment variable. This is useful for example to specify preprocessor macros with -D. CFLAGS could be used instead, but CPPFLAGS is more correct and is expected to be honored in some cases. For example, the helper scripts to build Debian packages make use of CPPFLAGS, but the variable is currently being ignored unless manually appended to CFLAGS.
2019-01-04Set the path of pkg-config in a variable instead of hardcoding itParide Legovini
In this way the path of pkg-config can be overridden from the command line. This is useful for example when cross-compiling.
2019-01-04Makefile: fix dependencies on config.hHiltjo Posthuma
patch by Younes Khoudli (changed slightly). Thanks
2018-12-11output child WEXITSTATUS/WTERMSIG on abnormal terminationLauri Tirkkonen