/// <summary>
        /// Handles changes of the caret position.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected override void CaretOffsetChanged(object sender, EventArgs e)
        {
            int caretOffset = TextEditorControl.ActiveTextAreaControl.Caret.Offset;

            if (caretOffset == _startOffset)
            {
                _completionListView.SelectItemWithStart(String.Empty);
                return;
            }
            if (caretOffset < _startOffset || caretOffset > _endOffset)
            {
                Close();
            }
            else
            {
                _completionListView.SelectItemWithStart(TextEditorControl.Document.GetText(_startOffset, caretOffset - _startOffset));
                if (_closeAutomatically && _completionListView.SelectedItem == null)
                {
                    // Text typed in the document does not match any entry of the completion window.
                    // -> Automatically close window.
                    Close();
                }
            }
        }