Eric Auer - 2013-11-01

the BTTR forum says, EDIT "new file" would trash
data in IVT, 0:4 to 0:8 to be exact, by putting
the string "Untitled" at 0:0 and then restoring
only 0:0 to 0:3. Interestingly, because DEBUG
installs an int 1 vector and EDIT restores the
int 0 vector at exit, you do not notice in DEBUG
but it does show in dosemu + dosdebug for 0.7d:

Before starting EDIT:

d 0 10

00000000 DB 10 D3 00 A6 10 D3 00 02 C0 00 F0 A6 10 D3 00 [.S.&.S..@.p&.S.

EDIT running without text windows:

d 0 10

00000000 25 01 AD 03 A6 10 D3 00 02 C0 00 F0 A6 10 D3 00 %.-.&.S..@.p&.S.

Opened new file:

d 0 10

00000000 55 6E 74 69 74 6C 65 64 00 C0 00 F0 A6 10 D3 00 Untitled.@.p&.S.

After leaving edit:

d 0 10

00000000 DB 10 D3 00 74 6C 65 64 00 C0 00 F0 A6 10 D3 00 [.S.tled.@.p&.S.

So indeed there is a problem when opening a new file. Opening
existing files (command line or via menu) does not trigger it
nor does opening calendar or ascii table. Only the menu item
to make a new untitled text edit window triggers this.

The string shows at edit.c:
NewFile(WINDOW wnd, char *FileName) {
OpenPadWindow(wnd, Untitled, FileName); }

where Untitled is a global string:
static char Untitled[] = "Untitled";
(also at several strcmp in edit.c with Untitled as 2nd argument)

and in applicat.c,:
static char *WindowName(WINDOW wnd) {
... which returns the inlined string "Untitled" for non-
dialog, null-titled windows which is apparently used to
generate a list of open windows, copying the string to:

Menus[MenuNo]+4 with strncpy length 20
where Menus is a 9 element array with nine
"~1. "
style strings as initial content.

So... What is going wrong?

I would guess edit.c calling NewFile(wnd,NULL) for new files?
However, OpenPadWindow checks if the 3rd argument is null...

Maybe you can find out where this is going wrong? Thanks!