[PATCH] fixing selection problem in editor when CodeCompletion is enabled (PHP part)
Sebastian Gutweiler
sebastian at gutweiler.net
Wed Aug 13 17:35:05 UTC 2003
Hi,
when the user selected some text (for example to copy/paste sth.) and the
cursor came,while selecting, to a position where an argument hint or a code completion box
was usually displayed, the box was displayed, and so it was not possible to do any further
selection.
This Patch adds a check, so that no code completion boxes / Argument
hints are displayed when the user is selecting text. For this the patch
uses KTextEditor::SelectionInterface.
Sebastian
-------------- next part --------------
diff -u --recursive --new-file kdevelop_orig/parts/phpsupport/phpcodecompletion.cpp kdevelop_change/parts/phpsupport/phpcodecompletion.cpp
--- kdevelop_orig/parts/phpsupport/phpcodecompletion.cpp Sat Aug 9 15:12:09 2003
+++ kdevelop_change/parts/phpsupport/phpcodecompletion.cpp Wed Aug 13 14:37:10 2003
@@ -115,6 +115,13 @@
return;
}
+ m_selectionInterface = dynamic_cast<KTextEditor::SelectionInterface*>(part);
+ if(!m_selectionInterface) {
+ kdDebug(9018) << "editor doesn't support the SelectionInterface" << endl;
+ return;
+ }
+
+
disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice
connect(part->widget(), SIGNAL(cursorPositionChanged()),
this, SLOT(cursorPositionChanged()));
@@ -137,6 +144,10 @@
// lineStr.replace(QRegExp("\t"),"_");
// kdDebug(9018) << "ZEILEohneTAB:" << lineStr <<":" << endl;
+ if(m_selectionInterface->hasSelection()){
+ kdDebug(9018) << "No CodeCompletion/ArgHinting at the moment, because text is selected" << endl;
+ return;
+ }
if(m_config->getCodeHinting()){
if(checkForNewInstanceArgHint(lineStr,col,line)){
diff -u --recursive --new-file kdevelop_orig/parts/phpsupport/phpcodecompletion.h kdevelop_change/parts/phpsupport/phpcodecompletion.h
--- kdevelop_orig/parts/phpsupport/phpcodecompletion.h Sat Aug 9 15:12:09 2003
+++ kdevelop_change/parts/phpsupport/phpcodecompletion.h Wed Aug 13 16:41:58 2003
@@ -27,6 +27,7 @@
#include <ktexteditor/editinterface.h>
#include <ktexteditor/viewcursorinterface.h>
#include <ktexteditor/codecompletioninterface.h>
+#include <ktexteditor/selectioninterface.h>
class KDevCore;
@@ -81,6 +82,7 @@
KTextEditor::EditInterface *m_editInterface;
KTextEditor::CodeCompletionInterface *m_codeInterface;
KTextEditor::ViewCursorInterface *m_cursorInterface;
+ KTextEditor::SelectionInterface *m_selectionInterface;
PHPConfigData* m_config;
};
More information about the KDevelop-devel
mailing list