3

I wan't to be able to copy-paste the contents of my screen scrollback buffer into various browser text fields, usually when pasting an excerpt from a log file. One way that works well is the following:

$ xsel -bi
<CTRL-A ]> Enter
<CTRL-d>

Then simply pasting into the browser with CTRL-v. This works well for short excerpts of text. The problem is that these log excerpts often exceed 4 kilobytes, perhaps reaching 16k or 32k at a maximum. This causes CTRL-v to hang in the browser, perhaps due to the issues raised in the following two questions:

I tried the solutions suggested in the answers to these questions to no avail. Is there any other way of getting around the 4k buffer limit?

2

If you don't mind using a temporary file, you could do:

C-a : writebuf filename
$ xsel -bi < filename
  • This is an interesting idea. It creates the file correctly, but pasting into the browser still hangs for around a 10k block of text that was selected using this approach. Incidentally, pasting into a file in the terminal using CTRL-Shift-v works (this works with the original approach I tried above as well). BTW, manually copying from the file via CTRL-c using TextEditor works, but isn't satisfactory as a complete solution because it involves too many steps. – jonderry Sep 15 '15 at 20:42
  • 1
    In that case, it's probably not related to the 4k-per-line limit in the line discipline, but is on the browser's end. In that case, there probably isn't that much you can do about it. If you're using a pastebin, you could use wgetpaste or similar, or might be able to improvise a command-line solution using curl, if you wanted to be really clever. – Tom Hunt Sep 15 '15 at 20:48
  • I don't think it's on the browser end, because I can't paste into other apps outside the terminal. Also, as I mentioned, I can copy-paste larger chunks of text into the browser as long as they were input into the clipboard in a different way, such as by sending the scrollback to a file, then opening it in an application outside the terminal and hitting C-a C-c to copy all. – jonderry Sep 15 '15 at 21:52
  • If that's the case, then it's maybe somehow xsel's fault? xsel -i has to hang around waiting for something to paste, since the selection is an IPC mechanism and not a dedicated buffer; maybe something is interfering with that process. I've used this method before, though, and never had any problem. – Tom Hunt Sep 15 '15 at 21:55
  • Accepting since this is part of the best solution I know of now (send to file per this answer, open in Text Editor, C-a C-c, then paste). Would be great to resolve the underlying xsel issue though to get a simpler solution. – jonderry Sep 15 '15 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.