R.Wieser wrote:
> VanguardLH,
>
>> No formatting in a text-only file.
>
> I don't quite agree with you there.
>
> I've seen enough textfiles and newsgroup messages with a some formatting.
> Like "*", "/" and "_" around words and phrases to indicate bold, italic and
> underscore respecivily.
That's not formatting in the *document*. Those are ASCII characters
that *might* be interpreted by a particular client to accent some
characters. Don't rely on them working in all NNTP clients. They're
just more text.
That's like putting the
https://www.intel.com *string* in a message, and
your client happening to parse on the URL string to make it clickable.
It is NOT a hyperlink, like <A>href="<urlstring>">comment</A>. Just
text. Some clients will parse out what looks like URL strings (they
don't always get it right), but don't expect others to be using clients
that will automatically make URL-like strings into clickable objects.
The text string is still just text, not a hyperlink.
> Also, the textfile could store its formatting in the first or last few
> lines. Have you seen Apd's ".LOG" thingy ?
Doesn't work in all versions of Notepad, so I've never relied on it. As
mentioned, it is a trigger that some versions of Notepad will honor.
>> No control codes in the content to regulate formatting.
>
> There are enough ones free/reusable below the space character to
> create quite a bit of formatting. Although it would create a
> problem for anyone viewing, or worse, editing, such a file with a
> plain text editor.
Don't know what you intended to say there. "Below the space character"?
Are you talking about the ASCII7 charset listed in a table? Those are
still text characters. Some are printable, some are not (in that
printers won't print them, not that don't exist in the file). You can
put NUL characters in a text file, too (and even in filenames and
registry entries which can be difficult for users to handle with text
editors of which regedit.exe is one to display the binary data in the
registry). Some ASCII characters are used to trigger formatting, but
they're still text, like CR (Carriage Return) and Linefeed (LF) which
were originally for teletype printers where CR was to move the printhead
back to the left end of the platen, and LF was to rotate the platen, so
both together were a newline (\n) although Linux only uses CR. Those
ASCII *characters* are not control codes within the document.
>> No file attributes to carry along a linewrap view mode.
>
> Depending on the drives storage format (FAT, NTFS, etc) there might be
> a few unused ones. I've been thinking of the Archive bit. Not
> perfect, but much better than nothing. Also depending on the drives
> storage format an Alternate Data Stream (ADS) solution might be used.
Guess I should've said file metadata, like EXIF. File attributes, like
read-only, hidden, system, and archive can be used, but they are
vulnerable. For example, the archive file attribute could get removed
for some backup programs that use the attribute as a trigger of which
files to include in a backup.
Notepad cannot read ADS. It can, however, display an ADS specified for
a filespec in the command line. You would have to use the primary ADS
for the text file without any hard line breaks (newlines) while a
secondary ADS could contain the text with hard line breaks (but those
will not linewrap how you want if the window is shrunk).
notepad.exe <filespec>:<adsstreamname>
like:
notepad.exe mytextfile.txt
or
notepad.exe mytextfile.txt:evil.txt:$DATA
ADS is only available with NTFS. If you format any drives with
something else, ADS is not available, and if you copy a file from an
NTFS partition to a non-NTFS partition then the ADS(es) get stripped off
the copy. Many USB flash drives are FAT32.
ADS is not a solution. No matter what content is in which stream in a
file under NTFS, there is still no formatting control. Whatever text is
in which stream, linewrapping will depending on window size, not content
of the file. There can be hard line breaks in the content, but that's
not part of linewrapping.
>> You could use Autohotkey to load Notepad to toggle the linewrap
>> view mode
>
> :-) That jogs memories. Yes, that would be a possibility. if it would be
> able to see if that entry is checked or not.
I was wrong that linewrap view mode is always on when you load Notepad.
It's a registry saved state, as I mentioned later. The Autohotkey
script would somehow know what is the state of the option when Notepad
loads. It is a toggle option, so no way to easily use a key combo to
set on and off.
>> Did you find a registry entry for linewrap view mode in Notepad?
>
> Yes. The one you mention a few lines down.
>
>> how are you going to trigger which view mode to use when you
>> load the file into Notepad?
>
> Thats the easy part : I just add another file extension. :-)
That would require another filetype association. You didn't mention you
wanted to add another filetype association, but that's doable. Similar
to my suggestion of adding a postfix to the filename, and using the
batch file to decide how to set linewrap view mode in Notepad via the
registry.
I suggested adding a substring to the filename to different when you
want Notepad in linewrap view mode, or not. The problem with a new
filetype is that anyone else viewing the file won't get it opened in
Notedpad, and instead get an error about no associated handler for the
.txtw filetype. I wasn't trying to contrive a setup that would only be
usable to you. If you leave it a .txt extension, anyone can use the
default filetype handler that's the same across all Windows versions
probably back to Windows 286. Having a solution only for your host
means there could be problems later when giving the file to someone
else.