Example #1
0
 /// <summary>
 /// Opens a modal editor in order to edit the text.
 /// </summary>
 /// <param name="args">Arguments.</param>
 /// <returns>The result text.</returns>
 public abstract string EditText(EditTextArgs args);
Example #2
0
 /// <summary>
 /// Opens a modal editor in order to edit the text.
 /// </summary>
 /// <param name="args">Arguments.</param>
 /// <returns>The result text.</returns>
 public abstract string EditText(EditTextArgs args);
Example #3
0
 void OnKey(object sender, KeyPressedEventArgs e)
 {
     switch (e.Key.VirtualKeyCode)
     {
         case KeyCode.Escape:
             if (_Edit.Line.Length > 0)
             {
                 e.Ignore = true;
                 _Edit.Text = "";
             }
             break;
         case KeyCode.Tab:
             if (e.Key.Is())
             {
                 e.Ignore = true;
                 EditorKit.ExpandCode(_Edit.Line, null);
             }
             break;
         case KeyCode.UpArrow:
             goto case KeyCode.DownArrow;
         case KeyCode.DownArrow:
             if (e.Key.Is())
             {
                 e.Ignore = true;
                 _Edit.Text = History.GetNextCommand(e.Key.VirtualKeyCode == KeyCode.UpArrow, _Edit.Text);
                 _Edit.Line.Caret = -1;
             }
             break;
         case KeyCode.F1:
             e.Ignore = true;
             Help.ShowHelpForContext("CommandConsoleDialog");
             break;
         case KeyCode.F4:
             e.Ignore = true;
             var args = new EditTextArgs() { Text = _Edit.Text, Title = "Input code", Extension = "psm1" };
             var text = Far.Api.AnyEditor.EditText(args);
             if (text != args.Text)
             {
                 _TextFromEditor = text;
                 _Dialog.Close();
             }
             break;
         case KeyCode.F7:
             e.Ignore = true;
             A.Psf.ShowHistory();
             break;
     }
 }
Example #4
0
 /// <summary>
 /// Opens a non-modal editor in order to edit the text.
 /// </summary>
 /// <param name="args">Arguments.</param>
 /// <returns>The result text task.</returns>
 public abstract Task <string> EditTextAsync(EditTextArgs args);
Example #5
0
 void OnKey(object sender, KeyPressedEventArgs e)
 {
     switch (e.Key.VirtualKeyCode)
     {
         case KeyCode.Escape:
             if (_Edit.Line.Length > 0)
             {
                 e.Ignore = true;
                 _Edit.Text = "";
             }
             break;
         case KeyCode.F4:
             e.Ignore = true;
             var args = new EditTextArgs() { Text = _Edit.Text, Title = "Input text" };
             var text = Far.Api.AnyEditor.EditText(args);
             if (text != args.Text)
             {
                 _Text2 = text;
                 _Dialog.Close();
             }
             break;
         case KeyCode.F1:
             e.Ignore = true;
             if (!string.IsNullOrEmpty(HelpMessage))
                 Far.Api.Message(HelpMessage);
             break;
     }
 }