notepad and/or wordpad - set wordwrap on a per-document basis ?

6 views
Skip to first unread message

R.Wieser

unread,
Jun 12, 2022, 2:59:59 AMJun 12
to
Hello all,

I've got some documents that work best with word-wrapping, and others that
work best without. Alas, the wordwrap setting seems to be a global one.
Although I could hack something together that would change the associated
registry setting before loading a document, but it would be just that, a
hack.

I've also tried to google for a way to add it as a commandline argument, but
didn't find anything in that regard (if anyone knows about such a setting
please do post).

While thinking about wordpad and how it can display RTF documents I realized
that there just might be a way to store the above setting in the documents
themselves.

So, my question : does know if such thing exists for either or both notepad
and wordpad ?

Regards,
Rudy Wieser


Mayayana

unread,
Jun 12, 2022, 8:32:42 AMJun 12
to
"R.Wieser" <add...@not.available> wrote

| So, my question : does know if such thing exists for either or both
notepad
| and wordpad ?
|

Definitely not for Notepad. ANSI text is 1 byte per character.
No other data. Unicode may have a 2 byte prepended marker but
aside from that there's no spec for anything but character
encoding.

You can look up the RTF spec. I don't think it includes wordwrap.
It has wrap specs around objects, but I find no wrap spec. I've never
seen it operate in any way except as a window property.

With RTF, too, you have to consider the RTF version, which
varies by Windows and Office versions, according to the RichEdit
version. (I once ran into that with VB6, which has a control that
wraps RichEdit v. 1 and can't adapt to wrap later versions. Each
version added new features. So I finally ended up needing to
use a system richedit. You can also look up the specs for each
of those. As I recall, the header doesn't include much. Text colors
used, encoding, etc. The rest is inline markers.


Apd

unread,
Jun 12, 2022, 10:22:02 AMJun 12
to
"Mayayana" wrote:
> Unicode may have a 2 byte prepended marker

In Notepad you can have 2 or more byte UTF-8 chars anywhere and it
will see most of them as such (even without a BOM) if you have the
right font.

> but aside from that there's no spec for anything but character
> encoding.

Apart from this little oddity - If you create a file containing ".LOG"
(no quotes) as the first four chars, next time it's opened the current
date and time will be appended.


Mayayana

unread,
Jun 12, 2022, 10:38:42 AMJun 12
to
"Apd" <n...@all.invalid> wrote

| In Notepad you can have 2 or more byte UTF-8 chars anywhere and it
| will see most of them as such (even without a BOM) if you have the
| right font.
|

Yes, I've noticed it sniffs. I often copy webpage text of
articles and Notepad warns me about saving as ANSI because
there are unicode characters embedded. Then I have to say,
"Who asked you? Just save the damn thing! I don't want UTF-8
crap all over my disk." :)

Typically it's just angled quotes, which translate perfectly
well as chr 147/148 in English ANSI codepage. Other times it's
UTF-8 space characters, which don't get translated.

| Apart from this little oddity - If you create a file containing ".LOG"
| (no quotes) as the first four chars, next time it's opened the current
| date and time will be appended.
|

Weird. And the file doesn't even need to be named with .log extension.


R.Wieser

unread,
Jun 12, 2022, 12:03:16 PMJun 12
to
Mayayana,

> | So, my question : does know if such thing exists for either or
> | both notepad and wordpad ?
>
> Definitely not for Notepad. ANSI text is 1 byte per character.
> No other data. Unicode may have a 2 byte prepended marker but
> aside from that there's no spec for anything but character
> encoding.

Well, in the case of notepad (ASCII only) I was thinking of something
simpler : maybe a certain specific header line. And reading Apd's response
my idea doesn't seem to be all that weird. :-)

In regard to Worpad and RTF formatted text, thanks for the response. I knew
it was a long shot, but had to ask anyway.

Regards,
Rudy Wieser


Herbert Kleebauer

unread,
Jun 12, 2022, 1:23:26 PMJun 12
to
On 12.06.2022 18:00, R.Wieser wrote:
> Mayayana,
>
>> | So, my question : does know if such thing exists for either or
>> | both notepad and wordpad ?
>>
>> Definitely not for Notepad. ANSI text is 1 byte per character.
>> No other data. Unicode may have a 2 byte prepended marker but
>> aside from that there's no spec for anything but character
>> encoding.
>
> Well, in the case of notepad (ASCII only) I was thinking of something
> simpler : maybe a certain specific header line.

To change wordwrap in Notepad you need either 2 mouse clicks or
3 key strokes (<ALT>o<RETURN>. I think, anything else would be
more complicated.

R.Wieser

unread,
Jun 12, 2022, 2:44:17 PMJun 12
to
Herbert,

> To change wordwrap in Notepad you need either 2 mouse clicks or
> 3 key strokes (<ALT>o<RETURN>. I think, anything else would be
> more complicated.

I know. The thing is that when opening all kinds of text files I keep
switching back and forth between the two modes, something I could well do
without. :-\

As for complexity, I've got no problem with that. Its just that I'm looking
for the simpelest, preferrably already existing one.

One option would be to create a launcer program which would change the
current registry-stored word-wrap before starting the editor itself. The
launcher could than take the preferred word-wrap setting from a number of
places.

Regards,
Rudy Wieser


VanguardLH

unread,
Jun 12, 2022, 4:59:06 PMJun 12
to
No formatting in a text-only file. No control codes in the content to
regulate formatting. No file attributes to carry along a linewrap view
mode.

You could use Autohotkey to load Notepad to toggle the linewrap view
mode (it's not document formatting, just a view mode by the program).
Linewrap view mode is always on when Notepad loads, so an Autohotkey
script to issue the Alt+O W key presses if it detects the file is named
specially, like mytextfile.txt leave linewrap view mode alone (so it is
on) when the script loads Notepad, or toggle the linewrap view mode off
if, say, the filename has a postfile, like mytextfileNW.txt.

Did you find a registry entry for linewrap view mode in Notepad? There
must be something saved somewhere. Whatever state was linewrap view
mode when you exited Notepad is the state used when you next load
Notepad, so something has be tracking state.

I found the following registry key for Notepad:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Notepad

Looks like the data item "fWrap" tracks the linewrap view mode state.
You could use:

reg.exe HKCU\Software\Microsoft\Notepad" "fWrap" <num>

before you call notepad.exe in a batch file to set the wrap state;
however, how are you going to trigger which view mode to use when you
load the file into Notepad?

You could have a batch file named:

npad.bat

that runs:

@echo off
if /i "%1" == "wrap" goto Wrap
goto NoWrap
:Wrap
reg.exe add HKCU\Software\Microsoft\Notepad /v fWrap /d 1 /f
shift
notepad "%*"
goto End
:NoWrap
reg.exe add HKCU\Software\Microsoft\Notepad /v fWrap /d 0 /f
shift
notepad "%*"
:End

You could call the batch file as:

npad wrap myfile.txt

to get the batch file to enable linewrap view mode in Notepad, and then
have Notepad load the file(s) on the rest of the line. Or:

npad myfile.txt

to get the batch file to disable linewrap view mode in Notepad, and then
have Notepad load the file on the command line.

Presumably you will never have a file named "wrap" (sans quotes, with no
extension) to confuse the parsing, like you're trying to open a file
named "wrap" in Notepad. If you might have a file named wrap, I would
change the parameter to !wrap (or preface with some character you're not
likely to ever use when naming a file). Of course, visually !wrap means
"not wrap", so you could use "wrap!", or whatever flag you want for the
optional command-line parameter.

I assume you will not call the batch via:

npad "my text file.txt"

using quotes to encompass the filename having spaces; else, my inclusion
of the quotes would confuse the parser. Because filenames can have
spaces is why I use %* to capture all substrings in the command line as
the filename. If I used %1, and you ran npad my text file.txt then the
batch using %1 would only grab "my". You can modify the batch file
however you like based on your expected syntax for calling it.

The batch file won't be called when you double-click on a .txt file,
because the filetype association will be used. I suppose you could
alter the filetype association for .txt from using notepad.exe to using
npad.bat. I created a \Batch folder where I keep all my batch files,
and C:\Batch is the first node in the system PATH environment variable
to make sure those get used instead of, say, a same-named .exe file.
Instead you might want to add another file object context menu entry
with registry editing to have both "Open with Notepad" and "Open with
Notepad wrapped". There are tools to assist in adding context menu
entries.

JJ

unread,
Jun 13, 2022, 12:34:21 PMJun 13
to
There's no feature built in any the applications for that.

But it can be implemented by changing the .txt/.rtf file associations to run
e.g. a VBScript that launches Notepad or Wordpad depending on the file
association.

Before launching Notepad/Wordpad, if any, the script would use either a
separate file which contains Notepad/Wordpad settings (e.g. with `.cfg` file
extension), or an NTFS stream of the document file itself (if the file is in
an NTFS drive). The script would change the Notepad/Wordpad settings in the
registry, then launch Notepad/Wordpad with the given document file. Once the
application is launched and is ready for use, restore the registry settings
back to their previous values.

R.Wieser

unread,
Jun 13, 2022, 1:01:13 PMJun 13
to
JJ,

> There's no feature built in any the applications for that.

I was already afraid of that. Had to ask though.

> But it can be implemented by changing the .txt/.rtf file associations
> to run e.g. a VBScript that launches Notepad or Wordpad depending on
> the file association.

I was thinking of the same thing (possibly using another language).


Though this morning I took a peek at notepad, end its quite easy to patch it
to either always start in a wordwrap/non-wordwrap mode, or just change where
it stores its configuration (a single byte change).

And did you see Apd mention that ".LOG" thingy ? I've found its code and
might try to repurpose it ("WRAP").

Hmm... choices, choices. :-)

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 13, 2022, 1:45:20 PMJun 13
to
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.

Also, the textfile could store its formatting in the first or last few
lines. Have you seen Apd's ".LOG" thingy ?

> 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.

> 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.

> 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.

> Linewrap view mode is always on when Notepad loads
...
> Whatever state was linewrap view mode when you exited Notepad is
> the state used when you next load Notepad.

The above two lines do not match.

> 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. :-)

An even simpler way is to put the batchfile/vbscript/program into the "Send
To" folder.

> before you call notepad.exe in a batch file to set the wrap
> state;

To keep the whole thing silent (no DOS windows popping up) I would probably
use either VBScript, or write a small program for it.

Thank you for the batchfile and further explanation though.

Regards,
Rudy Wieser


Mayayana

unread,
Jun 13, 2022, 8:59:07 PMJun 13
to
"R.Wieser" <add...@not.available> wrote

| 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.
|

TXT has no formatting. what you're talking about is
symbols that people agree mean something. Look at any TXT in
a hex editor. There is no header. Of course you could make
up your own file type, as a txt file with a header. But you'll
need to program that recognizes it.


VanguardLH

unread,
Jun 13, 2022, 9:03:27 PMJun 13
to
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.

JJ

unread,
Jun 13, 2022, 11:36:35 PMJun 13
to
On Mon, 13 Jun 2022 19:00:38 +0200, R.Wieser wrote:
>
> I was thinking of the same thing (possibly using another language).
>
> Though this morning I took a peek at notepad, end its quite easy to patch it
> to either always start in a wordwrap/non-wordwrap mode, or just change where
> it stores its configuration (a single byte change).
>
> And did you see Apd mention that ".LOG" thingy ? I've found its code and
> might try to repurpose it ("WRAP").

Yes, I've just noticed it. I didn't realize Notepad has such feature even
though it exists since Win3.

With AutoHotkey, a custom keyword can be used to trigger application
customizings.

J. P. Gilliver (John)

unread,
Jun 14, 2022, 4:34:57 AMJun 14
to
On Mon, 13 Jun 2022 at 20:58:55, Mayayana <maya...@invalid.nospam>
wrote (my responses usually FOLLOW):
Indeed.
>
Having said that, the above three conventions have been agreed for a
very long time, and quite a few softwares - in particular, some
news/email clients - recognise them and even (in some case optionally)
make the relevant modifications when displaying them. YouTube comments,
for example, turn _this_ into italic (though I don't think they do the
other two). Some Word processors (and similar) also convert them (again,
usually optionally).

When I read the post that started this thread, I assumed the OP was
wondering about a _specific_ line-length wrap for each document; from
subsequent posts, I see some have interpreted it as meaning just can it
be turned on or off (presumably at current window width) for each
document. (And of course the answer is it can't for either based on the
basic notepad and the basic text format; the nearest that could be
achieved being a batch or similar that recognised something about the
filename, such as a different extension.)
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Sometimes you win, sometimes you learn.

R.Wieser

unread,
Jun 14, 2022, 5:15:57 AMJun 14
to
Mayayana,

> what you're talking about is symbols that people agree
> mean something.

Isn't that how all written language works ? Starting with glyphs like "a"
and "b", upto all the interpunction symbols and others ?

Worse, we even have them have different meanings depending where they are
used or how they are grouped.

Just take the ">" symbols at the start of the line here. Or how ":", "-"
and ")" grouped together indicate a certain feeling. Or how double-quotes
nowerdays are sometimes used as "air quotes", negating the meaning of a
word.

> Of course you could make up your own file type, as a txt
> file with a header. But you'll need to program that recognizes
> it.

You mean as for email, newsgroup, RTF and HTML files - which are all pure
ASCII text ?

> Look at any TXT in a hex editor. There is no header.

See the above email and newsgroup messages. They both have very
recognisable headers.

> But you'll need to program that recognizes it.

:-) I'm sure that the next thing you are going to tell me that water is wet.

The whole thing is that even those "special" files can be read and displayed
by a non-enhanced plain text editor or viewer.


But in relation to my question I could look for such a (single or
multi-line) header in the file and edit the related registry entries before
launching notepad itself.

Granted, having such a header visible is not the most beautiful thing ever,
but its a trade-off with the benefits of it.

Hmmm.... Makes me think back to the times of DOS (8.3 filename era) where
I made a simple textfile browser which read the first line outof all the
encountered textfiles, checked if it started with a hash character and if so
displayed that as the "name" for the file.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 14, 2022, 5:15:57 AMJun 14
to
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*.

I disagree. Both (can) change the appearance of the text in whatever you
use to view the document with.

> Those are ASCII characters that *might* be interpreted by a particular
> client to accent some characters.

... or interpreted by the wetware running in a persons brain to get the same
effect.

> Don't rely on them working in all NNTP clients. They're just more text.

:-) How do you think I became aware of them ? My ancient OE6 just
displays those symbols as they are. Though IIRC I first saw them used in
plain textfiles - as a kind of "poor mans" RTF.

>> 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.

Thats not the point. What is is that even notepad shows you can have
"special" behaviour on stuff thats /inside/ the document itself.

> Don't know what you intended to say there. "Below the space
> character"? Are you talking about the ASCII7 charset listed
> in a table?

Yes, and no.

Just character codes in the range 0x01 ... 0x1F. Regardless of the used
ASCII set (base of extended).

As for that table ? I have no idea how yours is oriented, but in mine the
character below the space char is the digit "0". Which is definitily /not/
what I ment. :-)

>>> No file attributes to carry along a linewrap view mode.
...
> Guess I should've said file metadata, like EXIF.

In that case:

Besides EXIF being binary data, the only difference is that a few lines at
the top of a textfile (the "header") would be visible, while an image
viewer/editor will hide the EXIF block from you (but often still display
certain data outof it).

Similar to how an email/newsgroup program will hide the header, while a
plain text file editor/viewer will not.

> Notepad cannot read ADS.

I never said it would/should. The launcher program could though.

> ADS is only available with NTFS.

I started that paragraph with mentioning it would be dependant on the drives
storage format (bleh. I should said "filesystem")

> 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.

While reading that the solution just jumped out to me : Read the
registry-stored setting, and only send the toggle-sequence when it doesn't
match the wanted one.

>> Thats the easy part : I just add another file extension. :-)
>
> That would require another filetype association.

Yes, that is what I ment with that.

> That would require another filetype association. You didn't mention
> you wanted to add another filetype association,

Who's talking about *wanting* ? I was/am going thru options. This is one
of them. A possibility when I cannot store the setting anywhere else in/to
the textfile itself.

> I suggested adding a substring to the filename to different when
> you want Notepad in linewrap view mode, or not.

:-) /Where/ to get the wanted setting from has become the larger part of
this thread.

To be honest, I did not quite catch it that you wanted to prefix the
filename itself with the word "wrap". I took it as a batchfile argument to
be applied in the registry.

What I think would work is to put the setting directly before the files
extension. Like "textfile.w.txt". A bit of VBScript (or a true program)
should have no problem with isolating it.

> 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.

Indeed. Keeping it compatible is a good thing to aim for. Thats the nice
thing of going thru and than having options : you can pick the one best
suited to your needs - whatever they are.

Regards,
Rudy Wieser



J. P. Gilliver (John)

unread,
Jun 14, 2022, 5:17:03 AMJun 14
to
On Mon, 13 Jun 2022 at 20:03:21, VanguardLH <V...@nguard.LH> wrote (my
responses usually FOLLOW):
>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.

Agreed.
>
>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

Yes - in particular, many softwares - the YouTube comment displayer is
one - see any . not followed by a space or newline as a URL.

>that will automatically make URL-like strings into clickable objects.
>The text string is still just text, not a hyperlink.
[]
>>> 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

Yes, I think he's talking about the first 32 ASCII codes.

>still text characters. Some are printable, some are not (in that

To be fair, I think it _is_ valid to refer to them as control characters
- whether they are also text characters is a moot point. (I would say
those relating to text - VT, HT, CR, LF, and some others are, or at
least that those relating to communication control are not.) I'd
definitely accept the term "control characters" for them, as they
control things - just not, in most cases, text formatting! Also, they're
the original reason the Ctrl or Control key is _called_ that: before
Windows and other software started intercepting some of them for their
own uses, Ctrl+letter used to generate them.

>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

I remember decades ago encountering files with the BEL character - ^G -
in them!

>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

(And much argument about whether it should be CRLF or LFCR - or just one
of them [my contention is that both are needed, otherwise you get either
overprinting or
this, but of course you didn't get overprinting with
early "glass teletypes"]. I contend CR then LF as CR mechanically takes
longer - but thinking about that now, I can't see why that's relevant!)

>ASCII *characters* are not control codes within the document.

See above.
[]
>> 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.

Though equally, any substring in the filename might _in theory_ occur by
someone not knowing about your convention, although the probability
could be vanishingly small if you choose a weird enough substring. (Just
-wrap or _wrap wouldn't be sufficient - those might turn up in anyone
whose business/hobby uses the word, such as food preparation, or anyone
in anything that involves [non-text!] wrapping, including the
metaphorical "that's a wrap"!).

Basically, I think we're all in agreement: basic text files do not
contain text formatting controls, other than the newline (even the tab
character, though it may be present, can be interpreted in more than one
way). Trying to introduce something new needs either a batch file or
other software, triggered by either a different filetype, a substring in
the name, or insertion of extra characters in the file (which to me
sounds like more bother than it's worth, though I admire the ingenuity
of several in this thread). (In particular, I'd say anything that tries
to redefine the low ASCII codes is not a good idea: since you'd need
special software to parse the resultant files, you might as well use one
of the many formats that _do_ include formatting already: much as I hate
to endorse Microsoft, I'd say .doc is probably the most universal if you
want it editable [PDF otherwise].)
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Santa's elves are just a bunch of subordinate Clauses.

R.Wieser

unread,
Jun 14, 2022, 5:28:46 AMJun 14
to
John,

> And of course the answer is it can't for either based on the basic notepad
> and the basic text format

You might have noticed that I disagree with you there. There is nothing
stopping anyone from putting a line of two at the top or bottom that, when
having a certain formatting, have a special meaning.

> the nearest that could be achieved being a batch or similar that
> recognised something about the filename, such as a different extension

VanguardLH suggested the word "wrap" prefixing the filename. Personally
I'd rather have the indicator just before the files extension
("filename.w.txt").

Other possibilities in relation to the file itself have been mentioned -
depending on what the filesystem allows.

Regards,
Rudy Wieser


Mayayana

unread,
Jun 14, 2022, 7:04:48 AMJun 14
to
"R.Wieser" <add...@not.available> wrote

| > what you're talking about is symbols that people agree
| > mean something.
|
| Isn't that how all written language works ? Starting with glyphs like
"a"
| and "b", upto all the interpunction symbols and others ?
|
| Worse, we even have them have different meanings depending where they are
| used or how they are grouped.
|
| Just take the ">" symbols at the start of the line here. Or how ":", "-"
| and ")" grouped together indicate a certain feeling. Or how double-quotes
| nowerdays are sometimes used as "air quotes", negating the meaning of a
| word.
|
Yes. Plain text. Very clever analysis, Rudy. It sounds
like you have the basics for literacy. :) But none of those
characters means anything *in the context of the file format*.

If I create an RTF file in Write/Wordpad and make some text
red, I get this in the file header: {\colortbl ;\red255\green0\blue0;}

Then, within the text is this: \cf1 red text

In this newsgroup post those characters represent themselves.
In an RTF file they're markers, not displayed directly. If you look
at a TXT file in a hex editor it might have a unicode marker of
2 bytes, but there's no header defined for the file format.

|
| :-) I'm sure that the next thing you are going to tell me that water is
wet.
|
Maybe. Do you need me to tell you that?

| The whole thing is that even those "special" files can be read and
displayed
| by a non-enhanced plain text editor or viewer.
|

RTF and HTML? Sure. But they're displayed as plain text.

| Hmmm.... Makes me think back to the times of DOS (8.3 filename era)
where
| I made a simple textfile browser which read the first line outof all the
| encountered textfiles, checked if it started with a hash character and if
so
| displayed that as the "name" for the file.
|
And age hasn't mellowed you one bit. :)
That sounds to me like your best bet. You can use the MS
style, calling the file extension TXX. Then write yourself a
simple editor that recognizes a header. Then you can rest
in supreme bliss for the rest of the summer, opening file after
file, showing your chosen wordwrap setting, without ever having
to move your mouse up to the Format or Edit menu. You can call
it The Rube Goldberg Memorial Panfunctional Text Editor.

https://www.illustrationhistory.org/images/uploads/Rube3.jpg


R.Wieser

unread,
Jun 14, 2022, 8:21:24 AMJun 14
to
Mayayana,

> Yes. Plain text. Very clever analysis, Rudy.
> It sounds like you have the basics for literacy. :)

:-p

> But none of those characters means anything *in the context
> of the file format*.

*What* file format ? Plain text isn't one.

> If I create an RTF file
[snip]

What you've done is showing that the displayed effect of a certain textfiles
contents can differ on the program its loaded in. I'm currently not even
sure which point you are trying to make with it.

> | :-) I'm sure that the next thing you are going to tell me that
> | water is wet.
> |
> Maybe. Do you need me to tell you that?

Well, perhaps. Quite recently someone tried to convince me that there is
water that isn't wet. I didn't agree with him as he cheated (droplets of
water coated with some silica stuff).

> | The whole thing is that even those "special" files can be read
> | and displayed by a non-enhanced plain text editor or viewer.
>
> RTF and HTML? Sure. But they're displayed as plain text.

Thats the whole point : although their contents /can/ be interpreted (by an
apropriate program) and by it give them a quite different representation,
those contents are just still plain text.

What I really do not understand is how the addition of a few plain text
"header" lines (in a "plain text file") influencing what the contents are
going to look like is regard as some kind of a problem.

> And age hasn't mellowed you one bit. :)

Thats what /you/ think! You should have seen me just last week. You would
not have liked me /at all/. :-)

But now you mention it, I recently realized that I consiously try to sound
less adversarial (editing what I've written). If that is not "mellowing
out" I don't know what is.

> That sounds to me like your best bet. You can use the MS
> style, calling the file extension TXX. Then write yourself
> a simple editor that recognizes a header.

I'm still thinking of a simple launcher program - although I don't really
like the fumbling with the settings in the registry.

But yes, I've thought of that too. But decided against it because of all
features notepad already has (some of which I would need to copy. And just
last week I found that OE6 has a "TreeList" which is only available thru one
of MS'es programming languages - not to a "bare bones" programmer like
myself).

I do have a bit of experience with memory-patching programs though, and may
go that way. That would give me the best of both worlds : a full-featured
editor, just with a smidgen of different behavior.

Regards,
Rudy Wieser


VanguardLH

unread,
Jun 14, 2022, 9:54:50 PMJun 14
to
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*.
>
> I disagree. Both (can) change the appearance of the text in whatever you
> use to view the document with.

Really. Open Notepad, and enter some text. Now bracket some text with
asterisks, slashes, and underscores. Did Notepad show the bracketed
text as bolded, italics, and underlined? Nope. Those were just more
text characters.

>> Those are ASCII characters that *might* be interpreted by a particular
>> client to accent some characters.
>
> ... or interpreted by the wetware running in a persons brain to get the same
> effect.

Well, then you could use any ASCII character to effect any formatting if
you think your brain could do that without effort. So, bracket a bunch
of text with <wrap> and </wrap> and surely you'll see the text as
wrapped to match the window size despite what really happens. Try using
- to bracket text, and let your mind, not the program, see it as
strikethrough. I'm sure there's a huge variety of mental formatting
schemes that could be accomplished.

>> Don't rely on them working in all NNTP clients. They're just more text.
>
> :-) How do you think I became aware of them ? My ancient OE6 just
> displays those symbols as they are. Though IIRC I first saw them used in
> plain textfiles - as a kind of "poor mans" RTF.

There are still console-mode NNTP clients. Does Pan show text as
bolded, italic, or underlined using *, /, and _?

I wouldn't extol Outlook Express as the epitome of NNTP clients. Sure
didn't see that coming.

>>> 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.
>
> Thats not the point. What is is that even notepad shows you can have
> "special" behaviour on stuff thats /inside/ the document itself.

Okay, it has a feature, but that won't help you in your endeavor to
somehow toggle linewrap view mode other than using Alt+O W. As you
mentioned, you could use a hex editor to usurp the code section that
acts on the first line having .LOG starting in column 1 to define the
linewrap view mode, but the effort involved would be disappointing on
the returns.

In addition, you have to pollute the first line to get the special
behavior. A bunch of text files, especially short ones, would look
noisy with the extraneous line.

Rather than recode Notepad, I'd hunt around for a text editor that might
have the feature you're looking for. That I don't know any doesn't mean
there aren't any. Or create a batch or VBscript to modify the registry
entry to set the linewrap view mode before loading Notepad. The latter
would a lot easier than recoding Notepad. Adding a filetype definition
would also let you double-click on the .txt file, but anyone else
getting your text file won't have a handler assigned to the filetype.

> Indeed. Keeping it compatible is a good thing to aim for. Thats the nice
> thing of going thru and than having options : you can pick the one best
> suited to your needs - whatever they are.

That's why I think going the file extension route is a bad idea;
however, using file.w.txt wouldn't require a new filetype. While a
batch or VB script would help as a shell extension (add to the context
menu) that wouldn't require a filetype or post/prefix, it would be just
your solution; however, anyone reading the .txt file wouldn't care about
having to toggle the linewrap view mode. It would be a normal thing to
them.

In fact, now that I mention adding a context menu entry (that you'd see
in File Explorer when right-clicking on a .txt file), you could add 2:
Open in Notepad (wrap off), and Open in Notepad (wrap on).
Alternatively, I suppose you could define a couple of SendTo entries to
do the same, and I think you mentioned that method. You wouldn't need
to recode Notepad. No hunting around for alternative text editors with
a command-line arg to choose linewrap view mode. No defining a new
filetype. And no substring in the filename to indicate which view mode
to use for a file by default. Each SendTo entry would point to a batch
or VB script that simply uses the reg.exe to set the fWrap registry
entry to 0 (no wrap) or 1 (wrap), and then run notepad.exe "%1" (I
suspect the file would be sent as a replaceable parameter in the Send To
entry). 2 script files with 2 commands (reg.exe and notepad.exe) which
could be used via Send To, or from the command line.

In Windows 10, go to shell:sendto to see the Send To folder. Then
create shortcuts in that folder pointing to the 2 script files, or 1
script file but each Send To entry would add a command-line parameter
specifying wrap on or off.

Send To is pervasive. Besides available in the right-click context menu
in File Explorer, Send To is available in Search Everything, and many
other programs. I'm starting to more like that suggestion of yours (I
think you mentioned it). Probably the easiest to setup and use.
That'll work if you making the decision when opening the file is okay
rather than trying to carry something along with the file (its name,
extension, first-line behavior flag, etc). Making it automatic is the
hard part, but there may be times when you want to open a file in
no-wrap mode and other times when you want to open the same file in wrap
mode.

R.Wieser

unread,
Jun 15, 2022, 5:33:04 AMJun 15
to
VanguardLH,

>> I disagree. Both (can) change the appearance of the text in
>> whatever you use to view the document with.
>
> Really. Open Notepad, and enter some text.

:-) A few lines down you mentioned that I should not "extol Outlook
Express". In the same way you should not do the same with any particular
text editor.

Also, notice the word "can", and my further "... or interpreted by the
wetware running in a persons brain".

IOW, I was not talking about what/who is interpreting it, just about that we
have been using "plain text" to say a more than just words.


To be honest, I do not get why you and several others here have such a
problem with the idea of a header (containing formatting options) that will
be visible in a plain text editor.

In my case I've got a number of plain text files which start with a line
containing the URL where the origional information came from. Who
says/determines if that is permissable or not ?

> Okay, it has a feature, but that won't help you in your endeavor
> to somehow toggle linewrap view mode other than using Alt+O W.

That was not the point. I mentioned it to show that even notepad has got
something plain text contents that are interpreted by it to do something
with the text itself. If it is allowed to do so than what is the problem
with me adding something of the same ?

> In addition, you have to pollute the first line to get the
> special behavior.

:-) And there you have it. "pollution". You (and others here) don't like
the idea of being able to *see* it. As long as its hidden from view by the
program its loaded in its OK, but being able to /see/ it somehow causes a
problem.

People are weird ...

>> Indeed. Keeping it compatible is a good thing to aim for.
...
> That's why I think going the file extension route is a bad idea;

As mentioned, its something to /aim/ for, *for the others convenience* sake.

> In fact, now that I mention adding a context menu entry (that you'd
> see in File Explorer when right-clicking on a .txt file), you could
> add 2: Open in Notepad (wrap off), and Open in Notepad (wrap on).

:-) That would replace about the same ammount of work as you would need to
do in notepad itself. As such its not something I would think of adding.

> Alternatively, I suppose you could define a couple of SendTo entries
> to do the same, and I think you mentioned that method.

Although I did mention that last one myself, both will be rather low on my
list of possibilities - as it would mean to make the same choice
over-and-over again, instead of just once (and after it just double-click to
open the file).

Regards,
Rudy Wieser


VanguardLH

unread,
Jun 15, 2022, 1:43:17 PMJun 15
to
R.Wieser wrote:

> Although I did mention [SentTo] myself, both will be rather low on my
> list of possibilities - as it would mean to make the same choice
> over-and-over again, instead of just once (and after it just
> double-click to open the file).

That's what I figured, but I was trying to come up with something easier
than creating new filetypes, build parser scripts on filenames, or
recode Notepad. Personally I'd discard the project and just suffer the
occasional Alt+O W key combo. The time spent defining new filetypes and
writing the handler scripts, or recoding Notepad, or somehow
incorporating a script that parses the filename looking for a substring
trigger seem more effort than using the key toggle, but I guess you're
bored and want a project to work on. It's become a challenge.

I can't come up with any more ideas on how to automate the linewrap view
mode in Notepad. I haven't used many text editors (just Notepad and
Notepad++, don't remember trialing any others) to know if some have a
command-line argument to specify linewrap mode, and then replace Notepad
as the default handler (filetype association) for .txt files.

Aside (future use warning):
I just thought of something: Microsoft has protected some filetype
associations in Windows 10 to prevent malware from usurping the
legitimate handlers for the common filetypes. There is a hHash
registry entry (UserChoice) associated with a filetype definition.
You cannot just delete it nor can you create just any value for the
hash. Windows has to create the filetype association, or it has to be
user-initiated through Windows wizards, to get Windows to assign a
valid hash value to the filetype association. Doesn't mean anything
to you in Windows XP, but something to think about going forward. I'd
have to do some research to see if Microsoft protected the
.txt/textfile association since it seems a basic filetype for lots of
documents. For me,
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html
has a UserChoice registry key under WIndows 10, so malware cannot
easily redefine the .html filetype association. Similarly, under
Windows 10,
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt
has a UserChoice entry. Those filetype definitions are protected.
You, and malware, don't have any restrictions on redefining filetype
handlers under Windows XP, but whatever you may do regarding a
filetype trick could bite you should you ever move forward to Windows
10/11. Microsoft added protection on filetype handlers.

Maybe others might jump in with more suggestions on an automatic-only
solution that you'd like, but you might have to wait a bit longer for
them to show up. It's only been 3 days since you started this
discussion. Also possible is I think of something later, too, but since
I won't be working on it anymore it'd be one of those ideas that pop
into my head when I'm not thinking on it.

R.Wieser

unread,
Jun 15, 2022, 2:31:15 PMJun 15
to
VanguardLH,

> Personally I'd discard the project and just suffer the
> occasional Alt+O W key combo.

I may still decide to just that. My initial question was aimed at finding
out if I was unaware of an buildin solution. I do apriciate the mentioning
of alternative solutions though, as it gives me options (stuff to think
about and perhaps try out).

> I just thought of something: Microsoft has protected some
> filetype associations in Windows 10 to prevent malware from
> usurping the legitimate handlers for the common filetypes.

Thanks for the warning, will try to remember it.

> Maybe others might jump in with more suggestions on an automatic-
> only solution that you'd like, but you might have to wait a bit
> longer for them to show up.

I regulary visit the newsgroup so I'm sure I will notice them.

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 21, 2022, 4:50:26 AMJun 21
to
Steve,

>>So, my question : does know if such thing exists for either or both
>>notepad and wordpad ?
>
> I don't know about WordPad, but in most editors I've used, both
> plain text and RTF, they do wordwrap, and if you don't want it
> you press the Enter key and it puts in a CR/LF character.

So do note- and wordpad.

But that means I have to go over all of the text, inserting those /by hand/
everywhere they are needed.

It also means that that width is fixed, and can't be easily adjusted
depending on the situation (by changing the width of the editors window).

It would also need to be done for every new document that gets generated or
I download which uses such one-line paragraphs.

IOW, wordwrap is handy to have. Just not for /all/ the documents. :-)

Regards,
Rudy Wieser


R.Wieser

unread,
Jun 23, 2022, 6:17:07 AMJun 23
to
Steve,

> For that I use XyWrite, an ancient word processor that still
> processes words better than the latest ones

I've also got an ancient one : Norton Editor (35 years old). Though its
drawback is that it only does a per-paragraph formatting.

The thing is that I have no problem with the automatic word-wrapping either
note- or wordpad uses. Its just that some documents work better with it
off, and others with it on.


A few days ago I finished my first version of a wrapper program for notepad,
with which I can select, using a commandline argument, a configuration
and/or locking it (notepad than doesn't write it back to the registry). In
the document itself I can override the wordwrap mode as well as the dialogs
width and height (which than do not get written back to the registry).

I've set the wrapper as default for a few file extensions to see if it works
as well as I imagined.

Regards,
Rudy Wieser


Reply all
Reply to author
Forward
0 new messages