[rkward-cvs] SF.net SVN: rkward:[3477] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Mar 14 08:48:58 UTC 2011


Revision: 3477
          http://rkward.svn.sourceforge.net/rkward/?rev=3477&view=rev
Author:   tfry
Date:     2011-03-14 08:48:58 +0000 (Mon, 14 Mar 2011)

Log Message:
-----------
Coerce the katepart's code completion to not try to be too smart (again).

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-03-13 16:38:51 UTC (rev 3476)
+++ trunk/rkward/ChangeLog	2011-03-14 08:48:58 UTC (rev 3477)
@@ -1,3 +1,4 @@
+- Fixed: Object name completion would abort early in the script editor with KDE 4.4
 - Support function argument hinting for R primitives
 - Support S4 slots in object name completion and workspace browser		TODO: more testing
 - More correct handling of quotes in object name completion

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2011-03-13 16:38:51 UTC (rev 3476)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2011-03-14 08:48:58 UTC (rev 3477)
@@ -534,6 +534,14 @@
 	return RKCommonFunctions::getCurrentSymbol (current_line, cursor_pos, false);
 }
 
+KTextEditor::Range RKCodeCompletionModel::completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position) {
+	QString current_line = view->document ()->line (position.line ());
+	int start;
+	int end;
+	RKCommonFunctions::getCurrentSymbolOffset (current_line, position.column (), false, &start, &end);
+	return KTextEditor::Range (position.line (), start, position.line (), end);
+}
+
 void RKCommandEditorWindow::tryCompletion () {
 	// TODO: merge this with RKConsole::doTabCompletion () somehow
 	RK_TRACE (COMMANDEDITOR);

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2011-03-13 16:38:51 UTC (rev 3476)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2011-03-14 08:48:58 UTC (rev 3477)
@@ -103,7 +103,31 @@
 };
 
 /** code completion model for RKCommandEditorWindow */
+#include <kdeversion.h>
+#if KDE_VERSION_MAJOR != 4
+#	error Adjust the versioning hack below!
+#endif
+// Unfortunately, MOC is not smart enough to understand the KDE_IS_VERSION macro
+#if KDE_VERSION_MINOR >= 2
+#	include <ktexteditor/codecompletionmodelcontrollerinterface.h>
+#	if KDE_VERSION_MINOR >= 5
+class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInferface3 {
+	Q_OBJECT
+	Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface3)
+public:
+	KTextEditor::Range completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position);
+	QString filterString (KTextEditor::View *, const KTextEditor::Range &, const KTextEditor::Cursor &) { return QString (); };
+#	else
+class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface {
+	Q_OBJECT
+	Q_INTERFACES(KTextEditor::CodeCompletionModelControllerInterface)
+public:
+	KTextEditor::Range completionRange (KTextEditor::View *view, const KTextEditor::Cursor &position);
+	QString filterString (KTextEditor::View *, const KTextEditor::SmartRange &, const KTextEditor::Cursor &) { return QString (); };
+#	endif
+#else
 class RKCodeCompletionModel : public KTextEditor::CodeCompletionModel {
+#endif
 public:
 	RKCodeCompletionModel (RKCommandEditorWindow* parent);
 	~RKCodeCompletionModel ();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list