Live data from Hacker News

Bug in Notepad Involving Asterisk in Title Bar

suszter.com

111–120 of 132 posts

Re: Bug in Notepad Involving Asterisk in Title Bar

#111
post #103

I just found another bug while testing this bug: 1. Open Notepad 2. Type then backspace. (asterisk shows in title bar - arguably a bug here, but ignoring that ...) 3. Open a new text file. Asterisk showing in the title bar (Expected: no asterisk) - Unless you move the mouse over the window (then the asterisk disappears). Windows 10 Enterprise v1909

The behaviour in (2) seems to be pretty standard across editors I've used: Typing a letter and deleting it does count as a modified file; typing a letter and ^Z to undo it does not make the file count as modified.

Re: Bug in Notepad Involving Asterisk in Title Bar

#112
post #77

Earlier quoted context omitted.

Ah, yes...that's what I was getting at. Notepad is mostly a wrapper around a rich edit control, and rich edit controls already emit "EN_CHANGE" when the content changes. So I suppose this must be some historical thing where an earlier version of notepad didn't have something like that to tee into.

Notepad is a wrapper around a plain text control. WordPad is a wrapper around a rich text control.

Ah, yes, thanks. Though it's still the same EN_CHANGE event.

Re: Bug in Notepad Involving Asterisk in Title Bar

#113
post #103

I just found another bug while testing this bug: 1. Open Notepad 2. Type then backspace. (asterisk shows in title bar - arguably a bug here, but ignoring that ...) 3. Open a new text file. Asterisk showing in the title bar (Expected: no asterisk) - Unless you move the mouse over the window (then the asterisk disappears). Windows 10 Enterprise v1909

The behaviour in (2) seems to be pretty standard across editors I've used: Typing a letter and deleting it does count as a modified file; typing a letter and ^Z to undo it does not make the file count as modified.

That's not how VS Code handles it - typing a letter and deleting it does NOT count as a modified file.

Re: Bug in Notepad Involving Asterisk in Title Bar

#114
post #5

I can reproduce this behavior. Though I noticed that removing a newline with does cause the asterisk to appear.

I think that's because the update occurs when the caret actually move not on keypress.

When removing a letter using delete the caret doesn't move, and when deleting a newline it does.

Just like in the case of moving the caret using arrow keys after a delete updates the title, but if you're at the end of a line after the delete and use the right arrow key the title doesn't change because the caret never moved.

Re: Bug in Notepad Involving Asterisk in Title Bar

#115

There's a bug in notepad that lets you turn your computer into a marquee. Making the text big and turning off wordwrap causes the text rendering to lag behind your typing. Here is a demo video I threw together. It's good to have in your pocket for if you're ever bored at fry's or something, that said the update speed is a bit jarring. https://www.youtube.com/watch?v=w-Y9oeCWeGc

About 20 or so years ago, I was working at Microsoft and decided to see if I could find a bug in Notepad. With a bit of playing around I actually got it to crash with an access violation by doing something like scaling the font to a gigantic size, then print(preview?)ing it. Coincidentally, around the same time I attended a small talk by the guy who was listed as the current dev owner for it, so I tapped him on the shoulder afterwards and told him about it. Before listening to the repro steps, he assured me with complete confidence it was not a notepad bug and that I should go step through it for another look. I did, and he was right, it was a bug in the user mode part of the printer driver.

Re: Bug in Notepad Involving Asterisk in Title Bar

#116
post #9

Earlier quoted context omitted.

Huh (confirmed), trying to imagine that code path. Edit: Played around a bit, it's odd. For example then click on a different window (release focus) does trigger the update.

It checks for updates when you press the arrow keys, but not delete?

As I commented somewhere else, I think it's related to the caret moving not the keypress.

Deleting a letter doesn't move the caret but using an arrow does, but not if you use, for example, the right arrow key while being at the end of a line, in that case the title doesn't update.

Somebody else commented that using delete on a newline changes the title and in that case the delete forces the caret to move.

Re: Bug in Notepad Involving Asterisk in Title Bar

#117
post #113

Earlier quoted context omitted.

The behaviour in (2) seems to be pretty standard across editors I've used: Typing a letter and deleting it does count as a modified file; typing a letter and ^Z to undo it does not make the file count as modified.

That's not how VS Code handles it - typing a letter and deleting it does NOT count as a modified file.

Typing a letter and deleting it still counts as a modified file for me with VSCode, unless there's some platform-specific behavior or setting I'm missing. (I tested on Linux.)

Re: Bug in Notepad Involving Asterisk in Title Bar

#118
post #75

Earlier quoted context omitted.

Notepad is indeed long established. But it's in active development. OK, that's an exaggeration, but it is occasionally developed, despite its appearance not changing much in 25 years. My favourite features it gained were support for Unix (LF) line endings, and support for normal UTF-8 (without a BOM).

My understanding of notepad.exe is that it's a very-few-loc wrapper around a fundamental windows UI element. That's why it can be fun to see that there are bugs in its implementation. It reminds me of this joke: Every program has at least one bug and can be shortened by at least one instruction — from which, by induction, every program can be reduced to one instruction which doesn't work.

It's a NOP.

Re: Bug in Notepad Involving Asterisk in Title Bar

#119
Talking mission critical software on Windows, I encountered two bugs in mspaint lately:

1) when resizing an image in >100% zoom from edge of the screen, it would cut more pixels than you tried to cut (although I don't repro anymore, seems fixed?)

2) sometimes when you press "shift" to draw a straight line, upon releasing shift, the line changes color (very rare repro, but happened to me many times; really curious what's the source of this one).

Post reply on HN