DevToys-app / DevToys

A Swiss Army knife for developers.
https://devtoys.app/
MIT License
26.94k stars 1.45k forks source link

Regex highlighter bug #427

Closed Neko7sora closed 2 years ago

Neko7sora commented 2 years ago

Description

https://user-images.githubusercontent.com/75793267/155695634-bbc1a3d1-0b3e-43e4-b3b6-2f904bc9d9fc.mp4

Steps To Reproduce

No response

Expected behavior

-

DevToys Version

Version 1.0.3.0 | X64 | RELEASE | 7c7c02a | 7c7c02a

Relevant Assets/Logs

- [02/25/2022 18:26:11]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyTextBoxSelectionToClipboard() + 0xc6

- [02/25/2022 18:32:13]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyTextBoxSelectionToClipboard() + 0xc6

- [02/25/2022 18:39:06]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyTextBoxSelectionToClipboard() + 0xc6

- [02/25/2022 18:40:47]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyRichEditBoxSelectionToClipboard() + 0xee

- [02/25/2022 18:40:48]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyRichEditBoxSelectionToClipboard() + 0xee

- [02/25/2022 18:41:02]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyTextBoxSelectionToClipboard() + 0xc6

- [02/25/2022 18:57:41]

Feature name: Failed to copy from custom text box Custom message: Exception message: OpenClipboard に失敗しました (Exception from HRESULT: 0x800401D0) Exception stack trace: at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21 at Interop.ComCallHelpers.Call(ComObject, RuntimeTypeHandle, Int32) + 0xb8 at __Interop.ForwardComStubs.Stub_17[TThis](__ComObject, Int32) + 0x24 at Windows.ApplicationModel.DataTransfer.Clipboard.Flush() + 0x2c at DevToys.UI.Controls.CustomTextBox.CopyRichEditBoxSelectionToClipboard() + 0xee

jamespack commented 2 years ago

This seems to be an issue with the highlighter and not the Regex. If you put a space after the string and add your letters and then delete the space it doesn't get highlighted. Only if you add letters/numbers directly to the end of the string you are searching does it break.

voidMike commented 2 years ago

It seems pretty easy to trigger this bug. For example, if I put by regex to be ab and type a string "ab", it will highlight it, but also any other letter I start typing at the end. So, for example, for that same regex a string "abcdefg" would get highlighted. Deleting the regex leaves those extra non-matching parts highlighted.

jamespack commented 2 years ago

I actually spent quite a bit of time looking at this one. I was never able to find where the actual issue is. I know for sure it’s not an issue with the Regex. But I also couldn’t really find a bug with the highlight logic. That leads me to believe it’s a framework bug. Could be totally wrong though 😀

Antorell commented 2 years ago

Same issue here. Top is Regex101. Sad.

Capture