1414using PluginCore . Managers ;
1515using PluginCore . Utilities ;
1616using PluginCore . Controls ;
17+ using PluginCore . Helpers ;
1718using ScintillaNet . Configuration ;
1819using ScintillaNet ;
1920using PluginCore ;
20- using PluginCore . Helpers ;
2121
2222namespace FlashDevelop . Controls
2323{
@@ -382,10 +382,8 @@ private void FindTextBoxKeyPress(Object sender, KeyPressEventArgs e)
382382 if ( e . KeyChar == ( Char ) Keys . Return && this . findTextBox . Text . Trim ( ) != "" )
383383 {
384384 e . Handled = true ;
385- if ( ( ModifierKeys & Keys . Shift ) == Keys . Shift )
386- FindPrev ( findTextBox . Text , false ) ;
387- else
388- FindNext ( findTextBox . Text , false ) ;
385+ if ( ( ModifierKeys & Keys . Shift ) == Keys . Shift ) FindPrev ( findTextBox . Text , false ) ;
386+ else FindNext ( findTextBox . Text , false ) ;
389387 }
390388 }
391389
@@ -422,12 +420,12 @@ private void HighlightAllCheckBoxClick(Object sender, EventArgs e)
422420 List < SearchMatch > matches = this . GetResults ( sci , this . findTextBox . Text ) ;
423421 if ( matches != null && matches . Count != 0 )
424422 {
425- this . RemoveHighlights ( sci ) ;
423+ sci . RemoveHighlights ( ) ;
426424 if ( this . highlightTimer . Enabled ) this . highlightTimer . Stop ( ) ;
427425 if ( this . highlightCheckBox . Checked ) this . AddHighlights ( sci , matches ) ;
428426 }
429427 }
430- else this . RemoveHighlights ( sci ) ;
428+ else sci . RemoveHighlights ( ) ;
431429 }
432430
433431 /// <summary>
@@ -547,7 +545,7 @@ private void CloseButtonClick(Object sender, EventArgs e)
547545 private void MoreButtonClick ( Object sender , EventArgs e )
548546 {
549547 this . CloseButtonClick ( null , null ) ;
550- PluginBase . MainForm . CallCommand ( "FindAndReplaceFrom " , this . findTextBox . Text ) ;
548+ PluginBase . MainForm . CallCommand ( "FindAndReplace " , null ) ;
551549 }
552550
553551 /// <summary>
@@ -557,31 +555,15 @@ private void AddHighlights(ScintillaControl sci, List<SearchMatch> matches)
557555 {
558556 ITabbedDocument doc = DocumentManager . FindDocument ( sci ) ;
559557 Language language = MainForm . Instance . SciConfig . GetLanguage ( sci . ConfigurationLanguage ) ;
560- foreach ( SearchMatch match in matches )
561- {
562- Int32 start = sci . MBSafePosition ( match . Index ) ;
563- Int32 end = start + sci . MBSafeTextLength ( match . Value ) ;
564- Int32 line = sci . LineFromPosition ( start ) ;
565- Int32 position = start ;
566- Int32 es = sci . EndStyled ;
567- Int32 mask = 1 << sci . StyleBits ;
568- // Define indics in both controls...
569- doc . SplitSci1 . SetIndicStyle ( 0 , ( Int32 ) ScintillaNet . Enums . IndicatorStyle . RoundBox ) ;
570- doc . SplitSci1 . SetIndicFore ( 0 , language . editorstyle . HighlightBackColor ) ;
571- doc . SplitSci2 . SetIndicStyle ( 0 , ( Int32 ) ScintillaNet . Enums . IndicatorStyle . RoundBox ) ;
572- doc . SplitSci2 . SetIndicFore ( 0 , language . editorstyle . HighlightBackColor ) ;
573- sci . StartStyling ( position , mask ) ;
574- sci . SetStyling ( end - start , mask ) ;
575- sci . StartStyling ( es , mask - 1 ) ;
576- }
558+ sci . AddHighlights ( matches , language . editorstyle . HighlightBackColor ) ;
577559 }
578560
579561 /// <summary>
580562 /// Refreshes the highlights
581563 /// </summary>
582564 private void RefreshHighlights ( ScintillaControl sci , List < SearchMatch > matches )
583565 {
584- this . RemoveHighlights ( sci ) ;
566+ sci . RemoveHighlights ( ) ;
585567 if ( this . highlightTimer . Enabled ) this . highlightTimer . Stop ( ) ;
586568 Hashtable table = new Hashtable ( ) ;
587569 table [ "sci" ] = sci ;
@@ -590,19 +572,6 @@ private void RefreshHighlights(ScintillaControl sci, List<SearchMatch> matches)
590572 this . highlightTimer . Start ( ) ;
591573 }
592574
593- /// <summary>
594- /// Removes the highlights from the correct sci control
595- /// </summary>
596- private void RemoveHighlights ( ScintillaControl sci )
597- {
598- Int32 es = sci . EndStyled ;
599- Int32 mask = ( 1 << sci . StyleBits ) ;
600- sci . StartStyling ( 0 , mask ) ;
601- sci . SetStyling ( sci . TextLength , 0 ) ;
602- sci . StartStyling ( es , mask - 1 ) ;
603- }
604-
605- /// <summary>
606575 /// Gets search results for a sci control
607576 /// </summary>
608577 private List < SearchMatch > GetResults ( ScintillaControl sci , String text )
0 commit comments