Click here to Skip to main content
15,799,017 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Using WinXP and Visual Studio 2008...
When I change the HideSelection or WordWrap properties in a RichTextBox, the Undo buffer is cleared (CanUndo becomes False). I was unsure if this was normal behavior or a bug in my own system, since MS Notepad and Fookes NoteTab also exhibit this behavior when I toggle WordWrap on or off.

Either I've not been paying attention all this time, or XP has developed a bug.
Sergey Alexandrovich Kryukov 13-Nov-11 20:10pm    
First of all, tag you UI library (WPF, Forms, what?) or provide fully qualified name for your classes.

1 solution

I tested it, observe it on my old native-windows application, but not on WPF where the undo is preserved after changing of WordWrap. I tested it on XP. So, hard to say where the problem is, but this is a kind of bug: Undo should not depends on properties related only to view.

Share this answer
Alan Burkhart 13-Nov-11 22:17pm    
I got a buddy of mine to try it on his Win7 machine. Notepad's word wrap still wipes the undo memory in 7. No clue why, but that's how it works. Since I can't change it I won't worry about it. Thanks for taking the time. :-)
Sergey Alexandrovich Kryukov 13-Nov-11 22:39pm    
No problem. I'll pay attention to this matter. If I collect some other facts I'll let you know.
To me, it looks like Windows API bug, the problem is the scope of it.
Alan Burkhart 14-Nov-11 9:12am    
The project in question is just a text editor for my own use. I may switch from the RichTextBox to ScintillaNet. I also dislike the oddball way the RTB handles lines (turning on WordWrap can change the line count).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900