Daniel Eklöf
2f475d7b44
selection: optimize \r\n -> \n when receiving clipboard data
...
Instead of first memmoving, possibly lots of data lots of times, the
received buffer, and _then_ calling the callback, simply call the
callback multiple times, and just skip the \r character(s).
2019-12-15 12:11:12 +01:00
Daniel Eklöf
198529525c
selection: break out isword() to a new file
2019-12-03 19:16:58 +01:00
Daniel Eklöf
2208f4304b
term: add term_mouse_grabbed()
...
When this returns true, it means we have keyboard focus and are
grabbing the mouse (for e.g. selections), regardless of whether the
client has enabled mouse tracking or not.
2019-11-30 17:06:15 +01:00
Daniel Eklöf
edb78575c7
selection: forced selection requires keyboard focus
...
Up the requirements for enabling "forced" selection (that is, allowing
selections even though mouse tracking has been disabled).
* Require keyboard focus (if we don't have it, then the shift-key
isn't is for us)
* Don't just require shift being pressed, but that all other modifiers
are *not* pressed.
2019-11-30 11:59:47 +01:00
Daniel Eklöf
903581b7eb
async: first synchronous write may succeed partially
...
When trying to write (to e.g. the slave, or to a clipboard receiver),
we first try to send the data synchronously, and only if that fails do
we switch to asynchronous mode.
However, the first synchronous may (in fact, is likely to) succeed
partially.
2019-11-28 19:20:25 +01:00
Daniel Eklöf
fc7069e1a6
selection: text_to_clipboard: assert the clipboard serial is not 0
2019-11-22 21:55:47 +01:00
Daniel Eklöf
f9e7ae8a89
selection: selection_to_clipboard: exit early on no-selection
...
When there's no selection, exit early to avoid trying to get grid data
from row -1.
2019-11-22 21:55:47 +01:00
Daniel Eklöf
da92abef31
selection: we already have a direct pointer to the clipboard struct
2019-11-22 21:55:46 +01:00
Daniel Eklöf
b31c18c741
selection: buffer may be empty if only empty cells where selected
2019-11-16 10:56:10 +01:00
Daniel Eklöf
15b12f45c6
scan-build: fix a couple of minor warnings from a scan-build run
2019-11-05 10:39:36 +01:00
Daniel Eklöf
b17358bd0a
selection: make text_from_{clipboard,primary} async
2019-11-05 09:09:51 +01:00
Daniel Eklöf
dd57418494
selection: initialize 'ctx' before jumping into its scope
2019-11-05 08:51:10 +01:00
Daniel Eklöf
b15032d223
selection: text_from_{clipboard,primary}: add 'done' callback
...
This callback is *always* called, including when there has been an
error.
This is in preparation for making text_from_{clipboard,primary}
asynchronous.
2019-11-05 08:49:32 +01:00
Daniel Eklöf
9cd22dc398
selection: async send: handle POLLHUP
2019-11-05 08:40:39 +01:00
Daniel Eklöf
1207ad1502
selection: free strdup:ed clipboard data on fdm failure
2019-11-05 08:40:24 +01:00
Daniel Eklöf
8824e3823e
selection: remove debug assert
2019-11-05 08:40:01 +01:00
Daniel Eklöf
bb9dad18f4
selection: typedef not needed here (copy-paste from fdm.h)
2019-11-05 08:39:39 +01:00
Daniel Eklöf
dbb51ed4c9
selection: we don't set user data on primary/clipboard data sources
2019-11-04 14:11:18 +01:00
Daniel Eklöf
cebeb390e4
selection: try to write selection data synchronously first
...
Only if we fail to write everything do we switch to asynchronous mode.
2019-11-04 14:00:51 +01:00
Daniel Eklöf
60c3ff8737
selection: send primary/clipboard data asynchronously
...
TODO: try writing synchronously first
2019-11-04 13:11:15 +01:00
Daniel Eklöf
9f1525aef7
Rename: vt_to_slave() -> term_to_slave()
2019-11-03 00:52:24 +01:00
Daniel Eklöf
1adab32906
term: wayland struct is now not a part of the terminal struct
...
We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
2019-10-27 18:51:14 +01:00
Daniel Eklöf
9f0b1f94c2
wayland: change all wayland callbacks to take a wayland pointer
...
Instead of passing the terminal to the wayland callbacks, pass a
'struct wayland' pointer.
2019-10-27 18:43:07 +01:00
Daniel Eklöf
c9455d5f21
kbd: move into wayland
2019-10-27 17:10:32 +01:00
Daniel Eklöf
5ca1ee701b
wayland: move clipboard/primary structs into the wayland struct
...
These are application global and very wayland specific
2019-10-27 16:15:32 +01:00
Daniel Eklöf
3ca6f9fe0b
selection: replace \r\n with \n in pasted text
2019-10-16 21:14:45 +02:00
Daniel Eklöf
16f15d1a36
selection: primary: don't require compositor to implement it
2019-09-25 19:26:55 +02:00
Daniel Eklöf
58d0657a97
selection: allow selections while searching scrollback
2019-08-27 20:57:58 +02:00
Daniel Eklöf
75830ba016
selection: regression: last cell wasn't included in copied text
2019-08-10 20:22:02 +02:00
Daniel Eklöf
15afd26716
osc: implement copy/paste to/from primary
2019-08-09 21:27:51 +02:00
Daniel Eklöf
70b6d9d7d2
input: don't paste from primary if client is mouse tracking
2019-08-09 21:26:34 +02:00
Daniel Eklöf
28a8b18c5e
selection: allow selection when mouse tracking is enabled *if* shift is pressed
2019-08-08 17:58:24 +02:00
Daniel Eklöf
481a1cd678
selection/input: triple click selects an entire row
2019-08-06 19:32:06 +02:00
Daniel Eklöf
c06f141189
term: cancel selection when scrolling wraps
...
If we scroll enough, we'll eventually end up wrapping around the
entire scrollback buffer. At this point, a selection is no longer
valid, so cancel it.
Note: this was very obvious when scrolling in the alt screen, since
its scrollback buffer is what you see on the screen (i.e. it has no
scrollback).
2019-08-05 20:16:17 +02:00
Daniel Eklöf
1e08d93528
selection: ensure start < end in finalize
...
When the selection is finalized, swap start/end if necessary, to make
sure start <= end.
2019-08-05 20:15:18 +02:00
Daniel Eklöf
c62ce72778
selection: mark-word using spaces only as word separator
...
When the user double-clicks with ctrl pressed, we now select the word
under the cursor using spaces only as word separator.
2019-08-05 19:02:27 +02:00
Daniel Eklöf
3ae210d4c5
selection: only disable selection when mouse drag/motion is on
...
This allows us to select text in e.g. man/less while still being able
to use LESS=--MOUSE (i.e. enable scrolling with mouse).
2019-08-04 19:15:50 +02:00
Daniel Eklöf
8deead14e8
selection: insert newlines only when last column is empty
2019-08-04 13:07:54 +02:00
Daniel Eklöf
4d7993b36f
cell: pack more efficiently and store glyph as a wchar
...
The 'attributes' struct is now 8 bytes and naturally packed (used to
be 9 bytes, artificially packed).
'cell' struct is now 12 bytes, naturally packed (used to be 13 bytes,
artificially packed).
Furthermore, the glyph is stored as a wchar instead of a char*. This
makes it easier (faster) to do glyph lookup when rendering.
2019-08-02 18:19:07 +02:00
Daniel Eklöf
b82dc02505
selection: add a couple of word-breaking characters
...
When "auto-selecting" a word, we used to only break on space
characters. Now we break on a number of other characters as
well.
2019-07-30 21:57:48 +02:00
Daniel Eklöf
ebf0a11fa0
render: add render_refresh()
2019-07-24 20:11:41 +02:00
Daniel Eklöf
793c37923e
selection: add text_from_clipboard()
...
This function reads data from the clipboard, and calls a user-provided
callback for each chunk of clipboard data.
2019-07-19 14:20:00 +02:00
Daniel Eklöf
167036ccbe
selection: add text_to_clipboard()
...
This function takes a string and makes it available to the clipboard.
2019-07-19 11:12:14 +02:00
Daniel Eklöf
8bd969262b
selection: implement double-click-to-select-word
2019-07-17 21:30:57 +02:00
Daniel Eklöf
f669cce5b9
selection: bug: apply grid's view offset when starting a selection
2019-07-17 12:59:12 +02:00
Daniel Eklöf
7379198f4a
Use vt_to_slave() instead of calling write(term->ptmx, ...) everywhere
2019-07-15 15:42:21 +02:00
Daniel Eklöf
6cd23654cc
selection: disable source listeners, since we don't currently use them
2019-07-11 17:38:03 +02:00
Daniel Eklöf
66e067082b
selection: implement copy *to* primary
2019-07-11 17:38:03 +02:00
Daniel Eklöf
703aeecb95
selection: add support for pasting *from* primary
2019-07-11 17:38:03 +02:00
Daniel Eklöf
e56066feef
selection: add selection_from_primary() API (stub for now)
2019-07-11 17:38:03 +02:00