[rkward] /: Do not attempt object name completion on empty quotes and spaces.

Thomas Friedrichsmeier null at kde.org
Fri May 11 16:02:09 UTC 2018


Git commit 356d71cdfae8a4c933e78efc3e2b16a339944ae9 by Thomas Friedrichsmeier.
Committed on 11/05/2018 at 16:02.
Pushed by tfry into branch 'master'.

Do not attempt object name completion on empty quotes and spaces.

M  +1    -0    ChangeLog
M  +1    -1    rkward/misc/rkcommonfunctions.cpp
M  +4    -1    rkward/windows/rkcommandeditorwindow.cpp

https://commits.kde.org/rkward/356d71cdfae8a4c933e78efc3e2b16a339944ae9

diff --git a/ChangeLog b/ChangeLog
index cee7bb2e..b84317af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.7.1 - UNRELEASED
+- Do not attempt object name hinting behind empty quoted strings or spaces.
 - rk.show.message() gains a parameter to allow setting a default button other than "yes"
 - Compile in ui definitions, instead of providing them as separate files
 - Fix printing of strings with R 3.5.0 on Windows in the console
diff --git a/rkward/misc/rkcommonfunctions.cpp b/rkward/misc/rkcommonfunctions.cpp
index 8fe8f036..d65c9241 100644
--- a/rkward/misc/rkcommonfunctions.cpp
+++ b/rkward/misc/rkcommonfunctions.cpp
@@ -148,7 +148,7 @@ namespace RKCommonFunctions {
 			}
 
 			// if we did not hit a continue, yet, that means we are on a potential symbol boundary
-			if (i < cursor_pos) *start = i+1;
+			if (i <= cursor_pos) *start = i+1;
 			else {
 				*end = i;
 				break;
diff --git a/rkward/windows/rkcommandeditorwindow.cpp b/rkward/windows/rkcommandeditorwindow.cpp
index 60ade4ab..76d1bd72 100644
--- a/rkward/windows/rkcommandeditorwindow.cpp
+++ b/rkward/windows/rkcommandeditorwindow.cpp
@@ -1070,7 +1070,10 @@ void RKCodeCompletionModel::updateCompletionList (const QString& symbol) {
 	beginResetModel ();
 
 	RObject::RObjectSearchMap map;
-	RObjectList::getObjectList ()->findObjectsMatching (symbol, &map);
+	QStringList objectpath = RObject::parseObjectPath (symbol);
+	if (!objectpath.isEmpty () && !objectpath[0].isEmpty ()) {  // Skip completion, if the current symbol is '""' (or another empty quote), for instance
+		RObjectList::getObjectList ()->findObjectsMatching (symbol, &map);
+	}
 
 	int count = map.size ();
 	icons.clear ();



More information about the rkward-tracker mailing list