Skip to main content

Bug fixes around undo/redo and copy/paste

I found a report of a case recently where Regex Hero would sporadically cause Chrome to crash. It was in a comment on StackOverflow, and I'm lucky to have found it. I didn't have much to go on, but I take reports like this seriously.

First of all, I had never seen this actually happen before. But I began by banging on things trying to make anything and everything break that I possibly could. My method is perhaps a bit crude and it simply takes time and some knowledge of what's going on in the code to get anywhere.

Here's what I managed to fix, in order of discovery:
  1. There was a layout problem involving the minimum vertical height of Regex Hero. After you shrink the window beyond a certain point a scroll bar appears so as not to fold the UI on top of itself. Well there was a logic problem in this calculation which could actually throw an error in certain circumstances. The error was being trapped though, and couldn't have caused the crash.
  2. The expand/collapse options button along the right hand side of the app had an unusual bug where, after clicking, the tooltip would be reused for other UI elements. I fixed it by using just one button rather than hiding/showing two different ones. Again, this was a weird bug but not one that could've caused the crash.
  3. Whenever you right click text and choose Cut/Copy/Paste, Regex Hero accesses the clipboard programmatically. On first use, this will throw a security warning from Silverlight (there's no way around that). The trouble is that if you choose not to allow Regex Hero access to the clipboard, Regex Hero would kind of fall on its face and not handle that condition gracefully. Again, an exception would be thrown, but it was caught and couldn't have caused anything to crash. I improved this process a bit and I now provide a follow up dialog.
  4. I took a couple days and came back to this. And just yesterday I finally reproduced the problem. The problem, it turns out, comes from another bug in the RichTextBox. And it's not isolated to Chrome. The same behavior occurs in IE9. Regex Hero was programmatically replacing line feeds with carriage returns when loading your previously stored text from isolated storage. I do this to ensure consistent behavior within the app. A separate string variable assigned to the text value of each textbox is then reshaped as necessary depending on if you have the CrLf option checked within Regex Hero. However, if you have more than 10 lines of text, then cut the top 9, then hit undo, the built-in undo functionality fails. The RichTextBox undo system seems to have a serious problem with carriage returns. It can't seem to fully restore from its history, only actually rendering 3 lines of text. The rendering pipeline then seems to be out of sync with what the text value actually equals. It's odd. And it causes Silverlight to freeze, sometimes bringing the whole browser down. I'm reporting this to Microsoft. My solution is to now replace all carriage returns with line feeds instead. Behind the scenes we have the same effect and the app works as it should, but it effectively avoids this bug.

Comments

Popular posts from this blog

Installer for Desktop version of Regex Hero

As Firefox just dropped support for Silverlight I really needed a solution for Regex Hero. So I created an installer for it. It's still Silverlight, but by using the installer you can install it directly to your computer and never need to open it in a browser. If you visit regexhero.net/tester and don't have a browser that supports Silverlight (IE is the only one left), then you'll see download links for 64-bit and 32-bit versions of the installer. When you install it you'll see a link over on the right hand side that says "Activate Regex Hero". This process connects your desktop version of Regex Hero with your online account. So if you're a licensed user this is how you'll gain access to all of those licensed features. Note: Currently there will be a security warning when you try to run either one of these installers. I'm in the process of obtaining a code signing certificate and will update them as soon as possible. You may be wondering a...

Regex Hero for Windows 10 is Underway

Awhile back I began working on an HTML5 / JavaScript version of Regex Hero . However, it was a huge undertaking essentially requiring a complete rewrite of the entire application. I have not had enough time to dedicate to this lately. So I've begun again, this time rewriting Regex Hero to work in WPF. It'll be usable in Windows 10 and downloadable from the Microsoft Store. This is a much easier task that also has the advantage of running the .NET regex library from the application itself. This will allow for the same speedy experience of testing your regular expressions and getting instant feedback that Regex Hero users have always enjoyed. I expect the first release to be ready in Q4 of 2019.

Regex Hero Super Speed, Super Intelligence, and Ultimate

 Last week version 2.0 of Regex Hero landed in the Microsoft Store . What's new in Regex Hero 2.0? You can still use the basic functionality of Regex Hero for free. But there are now 3 paid products within Regex Hero: Super Speed Pack: Benchmarking and regex performance recommendations. Super Intelligence Pack: Local saving and regex explanations. Ultimate: Contains all features of Super Speed and Super Intelligence Packs. I hope you enjoy these new features.