[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: accessing the Linux clipboard...



Reply to note from Paul Lagasse  Fri, 06 Feb
2009 23:09:59 -0500

> I could not get consistently accurate copying from Xy4 using
> SAD to save defined text to a file; sometimes I'd lose some
> text at the beginning of the highlighting and pick up a
> corresponding quantity of text after the end of the
> highlighting.

Occasionally in Xy4 you get a mismatch between the DeFined block
displayed on the screen and the text that is actually DeFined. This
happens in non-eXPanded views; when you switch to eXPanded view, the
actual DeFined block is revealed. It's a rare occurrence under
DOS/Windows; maybe it happens more frequently under Dosemu. I've never
really tried to figure out what triggers it, but you might be able to
avoid it by massaging your DeFine key assignment, perhaps like this:

nn=BX(,e,s,),DOFFDF

If that worked, then you could use SaveDef to send DeFined text to the
clipboard, changing the end-of-line character to Ascii-10 before doing
so, then restoring CrLfs to the DeFined block immediately afterwards
(the following code examples are XYENCoded, and are repeated in
XPLeNCODE further below):

',*',_SaveDef_method'^
'DZ~>0~>
'BXes_1'Q2
'DB'BXch/s_/;~[/~J/'Q2
'BXsad/nv_\xy4\clip\frxy'Q2
'BXch/s_/~J/;~[/'Q2
'BXdo/nv_system_xytonix.sh'Q2~
~~~'^

But if SaveDef isn't salvageable, you could still streamline your
routine. In particular, avoid XyWrite's "clipboard". It's nothing more
than a Save/Get (S/G 1816); if you stuff more than a few KB of text
into it, you'll break the memory bank. Since you're opening your file
"frxy" in the adjacent window, you can use func CP to CoPy the DF
block into the file. Also, rather than CAll... IF... NEw, I'd
simply ERNV (ERase No Verify) the file and use NEw/100 every time (the
"/100" switch forces eXPanded view). It's faster than DeFining
everything and rubbing it out. I'd also add a GOFILE check, so that,
if the file is already open in another window, you can ABort it:

',*',_CoPy_method'^
'DZ~>0~>
'BXes_1'Q2
~
'BXgofile_~'Q2
~)~>'BXab'Q2~
'BXernv_~'Q2
'BXne/100_~'Q2
'CP'TF
'BXch_/;~[/~J/'Q2
'BXst/nv_~'Q2
'BXdo/nv_system_xytonix.sh'Q2'GT~
~~~'^

Here are the two routines again:

XPLeNCODE v2.0
b-gin [UNTITLED]
;*; SaveDef method[cr|lf]
[DZ_]{<}IF{<}VA$DE{>}>0{>}
[BX_]es 1[Q2_]
[DB_][BX_]ch/s /[wC]/{010}/[Q2_]
[BX_]sad/nv \xy4\clip\frxy[Q2_]
[BX_]ch/s /{010}/[wC]/[Q2_]
[BX_]do/nv system xytonix.sh[Q2_]
{<}EX{>}{<}EI{>}{<}PRNothing DeFined{>}{<}EX{>}
[cr|lf]
[cr|lf]
;*; CoPy method[cr|lf]
[DZ_]{<}IF{<}VA$DE{>}>0{>}
[BX_]es 1[Q2_]
[BX_]ernv \xy4\clip\frxy[Q2_]
[BX_]ne/100 \xy4\clip\frxy[Q2_]
[CP_][TF_]
[BX_]ch /[wC]/{010}/[Q2_]
[BX_]st/nv \xy4\clip\frxy[Q2_]
[BX_]do/nv system xytonix.sh[Q2_][GT_]{<}EX{>}
{<}EI{>}{<}PRNothing DeFined{>}{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

P.S. I wonder if the xytonix.sh script can be tweaked so that input
from "frxy" stops when the EOF char is encountered?

--
Carl Distefano
cld@xxxxxxxx