Linux clipboard character limitation (4000 characters)


I have 2 files:

  • filename “works” has 4000 characters
  • filename “no_work” has 4001 characters

[jliverman@centosvbox ~]$ wc -c works
4000 works

[jliverman@centosvbox ~]$ wc -c no_work
4001 no_work

If I copy the “works” file content to the Linux X11 clipboard using the “xsel -b” command and attempt to paste it into a document I have opened in Atom using Control+V (this is Atom 1.0.19 on CentOS 7.1 with xorg 1.15 and GNOME 3.8.4; see below) it works as expected.

[jliverman@centosvbox ~]$ xsel -b < works
[jliverman@centosvbox ~]$ 

However, if I do the same with the “no_work” file then Atom appears to freeze for several seconds. Atom eventually unfreezes but nothing is pasted into the open document.

[jliverman@centosvbox ~]$ xsel -b < no_work
[jliverman@centosvbox ~]$ 

This happens regardless of clipboard content (e.g. it can be a single line of “Lorem Ipsum”-style content). This behavior does NOT occur with other editors like gedit (Control+V), ScITE (Control+V), gvim ("+ register), etc.

So is the problem in Atom or is the problem in X11 or GTK? I’ve searched these forums and Google for answers related to any 4000-character limitation in X11, GTK, the ICCCM, etc. and have found nothing… So any help is greatly appreciated.

[jliverman@centosvbox ~]$ uname -a
Linux vboxjl2076 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

[jliverman@centosvbox ~]$ cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core) 

[jliverman@centosvbox ~]$ X -version

X.Org X Server 1.15.0
Release Date: 2013-12-27
X Protocol Version 11, Revision 0
Build Operating System:  2.6.32-220.17.1.el6.x86_64 
Current Operating System: Linux vboxjl2076 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Sep 15 15:05:51 UTC 2015 x86_64
Kernel command line: BOOT_IMAGE=/vmlinuz-3.10.0-229.14.1.el7.x86_64 root=UUID=d1079f78-f24d-4084-be8b-466bbdfed0f2 ro vconsole.keymap=us crashkernel=auto vconsole.font=latarcyrheb-sun16 rhgb quiet LANG=en_US.UTF-8
Build Date: 10 April 2015  11:44:42AM
Build ID: xorg-x11-server 1.15.0-33.el7_1 
Current version of pixman: 0.32.4
        Before reporting problems, check
        to make sure that you have the latest version.

[jliverman@centosvbox ~]$ gnome-shell --version
GNOME Shell 3.8.4


I believe that the clipboard integration is provided by Electron. You may want to post an Issue on about this. If you do, please post a link to the Issue here on this topic.


OK, I opened a topic on the Electron Github issues board here:

Atom + Linux clipboard character limitation (4000 characters)

We’ll see what happens…


FYI: The Electron team pointed me to the Chromium (upstream) issue tracker since I was able to reproduce the issue in Google Chrome/Chromium. But the Chromium issue tracker already had a thread for this issue:

I added a short post about my experience with the issue in case it helps them to solve it. In any event, since this is an upstream issue one of the mods can close/lock or mark this thread as needed.



I’ll leave it open since it is an open issue in case anyone has questions about it. Thanks for keeping us updated! :grinning:


A user named “ebiggers” figured this out for us. It is a problem in xsel, not Atom/Electron/Chromium. Check out for the details, but the TLDR version is “replace your use of xsel with xclip” e.g.

BEFORE: command | xsel -b (or xsel -b < filename)
 AFTER: command | xclip -selection clipboard (or xclip -selection clipboard < filename)

And that should allow pasting of 4001+ characters into Atom/Electron/Chromium.

I believe this issue can be closed. Thanks!