Commit graph

1394 commits

Author SHA1 Message Date
Avi Halachmi (:avih)
28ad288399 mouseshortcuts: fix custom modifier on release
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-04-02 14:41:03 +02:00
Luke Smith
689add8aad
middle click pastes selection again 2020-04-01 09:40:53 -04:00
Luke Smith
e7db668a0a
Merge branch 'master' of github.com:LukeSmithxyz/st 2020-04-01 09:28:28 -04:00
Luke Smith
e248ef8c33
Merge pull request #183 from Fogapod/master
Do not copy text to clipboard after selecting
2020-04-01 09:24:32 -04:00
Eugene
7917ec930a Do not copy text to clipboard after selecting
This behaviour was introduced in 6833411400
Resolves: #177
2020-04-01 13:37:57 +03:00
georg3tom
9ce69b377a Changed flag to -z 2020-03-27 22:36:12 +05:30
georg3tom
26b57c7300 FIX bug in error and copy link
Apparently read only reads a single line so only one url was
    fed to dmenu.
2020-03-27 21:29:53 +05:30
georg3tom
8ba5325adb dmenu prompt is only shown if there's atleast one link 2020-03-25 15:06:03 +05:30
Luke Smith
72c555f605
Merge branch 'master' of github.com:LukeSmithxyz/st 2020-03-20 08:40:22 -04:00
Luke Smith
ec72bbe23e
adding @ to regex 2020-03-11 09:59:02 -04:00
Luke Smith
6725a2fde0
Merge pull request #85 from jbenden/xim_interval
Add interval timer to XIM spot updates
2020-03-11 09:43:27 -04:00
Ivan Tham
51e19ea11d Remove explicit XNFocusWindow
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-19 00:46:20 +01:00
Luke Smith
e2a59d5521
backend color number changes 2020-02-09 15:48:07 -05:00
Luke Smith
66780d00e4
middle click pastes selection again 2020-02-09 15:46:13 -05:00
Luke Smith
4c05d1cef3
font display fixes 2020-02-07 22:44:19 -05:00
Luke Smith
f0b7aeeb53
minor regex improvement 2020-02-07 18:46:24 -05:00
Luke Smith
cd28e535f8
link 2020-02-07 18:46:12 -05:00
Quentin Rameau
26cdfebf31 x: fix XIM handling
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-02 22:56:51 +01:00
Quentin Rameau
cd785755f2 x: check we still have an XIC context before accessing it 2020-02-02 22:56:51 +01:00
Quentin Rameau
2cb539142b x: do not instantiate a new nested list on each cursor move 2020-02-02 22:56:51 +01:00
Quentin Rameau
99de333951 x: move IME variables into XWindow ime embedded struct 2020-02-02 22:56:51 +01:00
Luke Smith
6852d5ecfc
note on crashing error 2020-02-01 18:33:22 -05:00
Ivan Tham
895e5b50a8 Increase XmbLookupString buffer
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)
あなたは家のように感じる
2020-01-18 14:21:50 +01:00
Hiltjo Posthuma
384830110b update FAQ
- add common question about the w3m image drawing hack.
- remove some bad advise about $TERM.
- change some links to https.
2019-11-17 20:04:52 +01:00
Avi Halachmi (:avih)
2e54a21b5a OSC 52 - copy to clipboard: don't limit to 382 bytes
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-10 22:45:54 +01:00
Hiltjo Posthuma
289c52b7aa CSIEscape, STREscape: use size_t for buffer length 2019-11-10 22:45:54 +01:00
Avi Halachmi (:avih)
7ceb3d1f72 STREscape: don't trim prematurely
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-10 22:45:54 +01:00
Avi Halachmi (:avih)
ea4d933ed9 base64dec: don't read out of bounds
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-10 22:45:54 +01:00
Sebastian J. Bronner
83866428de Fix tmux terminfo extensions Se and Ss
The tmux terminfo extensions Ss and Se are currently specified as
booleans in `st.info`. They should be strings. See
eeedb43ae8/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-11-05 19:51:35 +01:00
Ingo Lohmar
1f09f0b0bb apply hints before initial mapping (ICCCM)
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-26 11:47:24 +02:00
Avi Halachmi (:avih)
a2c479c4c8 mouse shortcuts: allow using forcemousemod (e.g. shift)
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-24 15:34:25 +02:00
Avi Halachmi (:avih)
d2b75db8d7 mouse shortcuts: don't hardcode selpaste
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-13 21:46:31 +02:00
Avi Halachmi (:avih)
b6d280de6d mouse shortcuts: allow override for all shortcuts
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-13 21:46:31 +02:00
Avi Halachmi (:avih)
ba7f4d69af mouse shortcuts: allow same functions as kb shortcuts
Previously mouse shortcuts supported only ttywrite.

This required adding an "Arg" function ttysend - which does what the
original mouse shortcuts did.
2019-10-13 21:46:31 +02:00
Luke Smith
131bdf67fd
Merge pull request #126 from jcapiitao/handle_hash_based_urls
Add hash symbol in openurlcmd and copyurlcmd regexp
2019-09-10 07:26:18 -04:00
Joel Capitao
63849e346b Add hash symbol in openurlcmd and copyurlcmd regexp
This enables hash-based urls support.
2019-09-10 11:15:33 +02:00
Hiltjo Posthuma
2b8333f553 config.def.h: remove crlf value section
this is not used anymore.

patch sent as an ed script using RFC2549 by k0ga.
2019-08-26 17:58:47 +02:00
Luke Smith
4a9b405ab0
Merge pull request #109 from sarpik/patch-1
Add background, foreground, cursor color example
2019-07-01 08:43:47 -04:00
Kipras Melnikovas
7150fd6b35
Add background, foreground, cursor color example
You might want to update every theme with different colors - I just didn't knew which ones to put there

(or maybe just mimic `color0` as `background` & `color15` as `foreground` and `cursorColor` (see the diff @ #108))

Fixes #108 and #97
2019-06-29 15:21:00 +03:00
Luke Smith
cad53235df
Merge pull request #102 from undx/undx/pr-fix-promtp-w-space
fix excessive slurping when prompt starts w/ space(s)
2019-06-21 14:48:05 -04:00
undx
1264ad0515 fix excessive slurping when prompt starts w/ space(s) 2019-06-21 20:35:04 +02:00
Luke Smith
7d5e65282e
Merge pull request #101 from undx/pr
fix prompt starting with space(s)
2019-06-21 12:02:07 -04:00
undx
bf29538fdd fix prompt starting with space(s) 2019-06-21 17:39:52 +02:00
Luke Smith
5c49ff8012
Merge pull request #99 from rjl6789/stluke-pull
additional Xresources item compatible with font2 patch
2019-06-18 09:01:24 -04:00
rjl6789
fb95bcb8a6 additional Xresources item compatible with font2 patch 2019-06-18 09:08:41 +01:00
Luke Smith
261652b42f
case insensitivity 2019-06-06 11:38:47 -04:00
Luke Smith
60506bfc82
Merge pull request #96 from jonbulica99/patch-font2
Apply font2 patch
2019-06-04 16:22:50 -04:00
Jon Bulica
5728d045eb apply font2 patch 2019-06-03 23:58:12 +02:00
Luke Smith
3c0a2e8d30
Merge pull request #95 from jonbulica99/master
Apply anysize patch so that the window size is not dependent of text size
2019-06-02 16:41:56 -04:00
Jon Bulica
9449c5787f apply anysize patch 2019-06-02 22:29:00 +02:00