Ignoring hard wrapping when doing copy and paste.

Linux for blind general discussion blinux-list at redhat.com
Sun Dec 12 01:11:24 UTC 2021


Hello,

Here is a script 'oneline' that converts a hard-wrapped file
to a one-line-per-paragraph, separated where there are two
newlines. 

oneline wrapped.txt > one-line-per-para.txt

oneline wrapped | xsel -b  # copy to paste buffer

'onel' is a helper script so you can say

onel wrapped

Then paste where you want with Ctrl-V

#!/usr/bin/perl
$mark = '@!@&@';  # unlikely to occur in input text
$/ = undef;
$text = <>;
$text =~ s/\s*\n\s*\n/$mark/og;
$text =~ s/\s*\n/ /og;
$text =~ s/$mark/\n\n/og;
print $text;

#!/bin/sh
oneline $1 | xsel -b

> Okay, so my text editing environment of choice is Nano running in the
> Linux Console, and I'm constantly using the justify function to hard
> wrap text because lines wider than the screen are difficult to work
> with.
> 
> If I need to post something I wrote in nano online, but can't just
> upload the .txt, I'll save, close nano, switch to tty1 where I usually
> have Firefox running in a stripped down xserver, open the text file in
> Firefox, and copy and paste into the text box.
> 
> >From my perspective, everything works fine, but I've gotten complaints
> from sighted users about the extra line breaks from the hardwrapping
> making text posted in this manner hard to read.
> 
> Is there a way to make Firefox ignore the hard wrapping when copying
> text from a hardwrapped text file to a web form, or failing that, an
> easy means of copying a hardwrapped text file to an unwrapped text
> file?
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list
> 

-- 
Joel Roth




More information about the Blinux-list mailing list