Esempio n. 1
0
 /// <summary>
 /// Checks the dialog key to see if the incremental search
 /// should be cancelled.
 /// </summary>
 /// <remarks>
 /// If the user presses the escape or enter key then the
 /// incremental search is aborted. If the user executes any
 /// edit action via the keyboard the incremental search is aborted
 /// and the edit action is allowed to execute.
 /// </remarks>
 bool TextAreaProcessDialogKey(Keys keys)
 {
     if (keys == Keys.Escape ||
         keys == Keys.Enter)
     {
         StopIncrementalSearch();
         return(true);
     }
     else if (keys == Keys.Back)
     {
         // Remove last search char and try search again.
         int length = searchText.ToString().Length;
         if (length > 0)
         {
             searchText.Remove(length - 1, 1);
             // Run search back at original starting point.
             startIndex          = originalStartIndex;
             passedEndOfDocument = false;
             RunSearch();
             return(true);
         }
         else
         {
             StopIncrementalSearch();
             return(false);
         }
     }
     else if (textEditor.IsEditAction(keys))
     {
         StopIncrementalSearch();
         return(false);
     }
     return(false);
 }