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

Case-Change Bug Workaround



A while back someone (Harry B., I think) pointed out a bug in Xy4
whereby changes made via one of the case-change commands (LC|UC|CC)
aren't detected as modifications to the file. The error occurs
erratically, in my experience, but when it does happen and a SAve
command is issued, the case modifications, treacherously, are
not written to disk. When SAve is issued, XyWrite simply prompts the
user to "Proceed", so that if the file is later ABorted, the
modifications will be lost. The workaround is to force a modification
before SAving; typically this is done by inserting a single character
in the text then immediately back-deleting it. The keyboard
assignment would look something like:


nn=GTSI, ,BDSA

It's a kludge, and a messy one, especially for "public" programming:
Unbidden changes to user text, however ephemeral, should be a last
resort. Ditto changes to hardware states (like Insert/Overstrike
mode) which can't be restored to their original value.

Today I tumbled to a way of forcing XyWrite to detect a modification
without actually modifying the file. Assign the null string to a
Save/Get, then insert the contents of the Save/Get (i.e., nothing)
into text. Even though the file contents haven't changed,  is
set to 1 and the file will be written to disk when SAved. This is
done most economically with a wee bit of XPL -- GT SA --
but, if an ordinary alpha Save/Get is available, it can also be
accomplished with a keyboard file macro (here, using Save/Get 1):

nn=YDDFDFSV,1,GT@1

This uses the antediluvian func SV to save a zero-length DeFine block
("DFDF") to the chosen Save/Get, then inserts it in text with "GT@1".
 Note that the func GT is mandatory in both the XPL and KBDfile
versions. In Xy4  or @X will write the contents of Save/Get X at
the cursor position, whether on the CMline or in text. (This can be
quite handy.) But the file is deemed "modified" only when the cursor
is in text.






--------------
Carl Distefano * * *  CLDistefano@xxxxxxxx
--------------