Bug #58649 SQL Editor: "Replace all" does not work
Submitted: 2 Dec 2010 7:55 Modified: 2 Dec 2010 15:52
Reporter: Valeriy Yuferov Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.30 OS:Microsoft Windows (7 home premium 64-bit)
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D2 (Serious)

[2 Dec 2010 7:55] Valeriy Yuferov
Description:
"Replace all" does not work

It shows number of replacement, but not really do action.
See stack trace below:
===
Exception = System.ArgumentOutOfRangeException
Message = Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: length
FullText = System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: length
   at System.String.ToCharArray(Int32 startIndex, Int32 length)
   at ScintillaNet.Scintilla.ScintillaNet.INativeScintilla.SendMessageDirectWithLength(UInt32 msg, Int32 wParam, String lParam)
   at ScintillaNet.Scintilla.ScintillaNet.INativeScintilla.ReplaceTarget(Int32 length, String text)
   at ScintillaNet.Range.set_Text(String value)
   at ScintillaNet.FindReplace.ReplaceAll(Int32 startPos, Int32 endPos, String searchString, String replaceString, SearchFlags flags)
   at ScintillaNet.FindReplace.ReplaceAll(String searchString, String replaceString, SearchFlags flags)
   at ScintillaNet.FindReplaceDialog.btnReplaceAll_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

How to repeat:
create any multi-string text with a few identical substring (for examle: "kjh"), press ctrl+h and try to replace your substing by another string (for examle: "hjk").
[2 Dec 2010 7:57] Valeriy Yuferov
"Find and Replace" window exapmle

Attachment: scr.jpg (image/pjpeg, text), 43.34 KiB.

[2 Dec 2010 8:41] Valeriy Yuferov
"Replace previous" does not work also... :(

(Is it really work under Oracle supervision ???)
[2 Dec 2010 11:04] Valeriy Kravchuk
On 32-bit XP I've got error message. Stack trace looks the same:

Exception = System.ArgumentOutOfRangeException
Message = Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: length
FullText = System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: length
   at System.String.ToCharArray(Int32 startIndex, Int32 length)
   at ScintillaNet.Scintilla.ScintillaNet.INativeScintilla.SendMessageDirectWithLength(UInt32 msg, Int32 wParam, String lParam)
   at ScintillaNet.Scintilla.ScintillaNet.INativeScintilla.ReplaceTarget(Int32 length, String text)
   at ScintillaNet.Range.set_Text(String value)
   at ScintillaNet.FindReplace.ReplaceAll(Int32 startPos, Int32 endPos, String searchString, String replaceString, SearchFlags flags)
   at ScintillaNet.FindReplace.ReplaceAll(String searchString, String replaceString, SearchFlags flags)
   at ScintillaNet.FindReplaceDialog.btnReplaceAll_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
[2 Dec 2010 15:52] Mike Lischke
Duplicate of Bug #56898