Exemple #1
0
        void CaretPositionChanged(object sender, EventArgs e)
        {
            int offset = this.TextArea.Caret.Offset;

            if (offset == this.StartOffset)
            {
                if (CloseAutomatically && CloseWhenCaretAtBeginning)
                {
                    Close();
                }
                else
                {
                    completionList.SelectItem(string.Empty);
                }
                return;
            }
            if (offset < this.StartOffset || offset > this.EndOffset)
            {
                if (CloseAutomatically)
                {
                    Close();
                }
            }
            else
            {
                TextDocument document = this.TextArea.Document;
                if (document != null)
                {
                    completionList.SelectItem(document.GetText(this.StartOffset, offset - this.StartOffset));
                }
            }
        }
        private void CaretPositionChanged(object sender, EventArgs e)
        {
            int offset = TextArea.Caret.Offset;

            if (offset == StartOffset)
            {
                if (CloseAutomatically && CloseWhenCaretAtBeginning)
                {
                    Close();
                }
                else
                {
                    completionList.SelectItem(string.Empty);
                }
                return;
            }
            else
            {
                TextDocument document = TextArea.Document;
                if (document != null)
                {
                    completionList.SelectItem(textEditor.CurrentWordToCursor);
                }
            }
        }
Exemple #3
0
 protected override void OnSourceInitialized(EventArgs e)
 {
     base.OnSourceInitialized(e);
     if (itemList.PreselectionLength > 0 && itemList.SuggestedItem == null)
     {
         string preselection = TextArea.Document.GetText(StartOffset, EndOffset - StartOffset);
         CompletionList.SelectItem(preselection);
     }
 }
Exemple #4
0
        private void CaretPositionChanged(object sender, EventArgs e)
        {
            CloseWhenCaretAtBeginning = false;

            int offset = this.TextArea.Caret.Offset;
            //if (offset == this.StartOffset) {
            //	if (CloseAutomatically && CloseWhenCaretAtBeginning) {
            //                 if (this.Visibility == Visibility.Visible)
            //                 {
            //                     this.Visibility = Visibility.Hidden;
            //                     MakeVisible(false);
            //                 }
            //                         //Close();
            //	} else {
            //		completionList.SelectItem(string.Empty);
            //	}
            //	return;
            //}
            //if (offset < this.StartOffset || offset > this.EndOffset) {
            //		if (CloseAutomatically) {
            //                  if (this.Visibility == Visibility.Visible)
            //                  {
            //                      this.Visibility = Visibility.Hidden;
            //                      MakeVisible(false);
            //                  }
            //                          //Close();
            //              }
            //	} else {
            TextDocument document = this.TextArea.Document;

            if (document != null)
            {
                if (offset - this.StartOffset <= 0)
                {
                    this.Visibility = Visibility.Hidden;
                    MakeVisible(false);
                }
                else
                {
                    completionList.SelectItem(document.GetText(this.StartOffset, offset - this.StartOffset));
                    if (completionList.ListBox.Items.Count <= 0)
                    {
                        this.Visibility = Visibility.Hidden;
                        MakeVisible(false);
                    }
                }
            }
        }