dump_selections.sh: print more details about the owner
[experiments/x-selection-debug.git] / README.txt
1 Some simple tools to analyze X selection buffers to understand what is going
2 on when text is selected with the mouse in X11.
3
4
5 BACK STORY
6 ==========
7
8 When vim is compiled with the +clipboad and +xterm_clipboard functionalities,
9 and setmouse=a is set, using vim in combination with xterm allows this
10 workflow:
11
12  1. Select something with the mouse;
13  2. exit vim;
14  3. paste the previously selected text with the middle mouse click.
15
16 Moving from xterm to gnome-terminal this workflow is not possible by default.
17
18 It turns out this is not a missing feature of vte or gtk, but rather some
19 extra functionality offered only by the combination of vim and xterm.
20
21 Vim copies to the CUT_BUFFER0 selection when it exits and xterm is able to
22 paste from CUT_BUFFER0 when it receives a middle click.
23
24 To make the workflow from above possible again it is possible to have vim
25 preserve the PRIMARY selection when it exits with a command like the following
26 in ~/.vimrc:
27
28   autocmd VimLeave * call system("xsel -ip", getreg('*'))
29
30 All the details of how the issue have been debugged can be found at
31 https://bugzilla.gnome.org/show_bug.cgi?id=783828
32
33
34 REFERENCES
35 ==========
36
37 https://www.jwz.org/doc/x-cut-and-paste.html
38 https://www.uninformativ.de/blog/postings/2017-04-02/0/POSTING-en.html
39 https://stackoverflow.com/questions/6453595/prevent-vim-from-clearing-the-clipboard-on-exit
40 https://vi.stackexchange.com/questions/3769/can-vim-add-to-the-x11-clipboard-or-primary-buffers-without-an-external-utility#comment5354_3769
41 https://groups.google.com/forum/#!topic/vim_dev/nlyA7AN9mfQ
42 https://groups.google.com/forum/#!topic/vim_use/NtprNch2ZkQ