[rkward] rkward: Two small fixes to object name completion:
Thomas Friedrichsmeier
null at kde.org
Sat Jan 12 08:30:57 GMT 2019
Git commit e07074ce5994b5cabfecd2490d05e7565d926160 by Thomas Friedrichsmeier.
Committed on 12/01/2019 at 08:30.
Pushed by tfry into branch 'master'.
Two small fixes to object name completion:
- Use proper name for slots
- Somewhat sane completion for objects outside globalevn() but on the search path.
M +8 -0 rkward/core/rkpseudoobjects.cpp
M +1 -0 rkward/core/rkpseudoobjects.h
M +5 -1 rkward/rkconsole.cpp
https://commits.kde.org/rkward/e07074ce5994b5cabfecd2490d05e7565d926160
diff --git a/rkward/core/rkpseudoobjects.cpp b/rkward/core/rkpseudoobjects.cpp
index 4215464a..52b0d500 100644
--- a/rkward/core/rkpseudoobjects.cpp
+++ b/rkward/core/rkpseudoobjects.cpp
@@ -46,6 +46,14 @@ QString RSlotsPseudoObject::makeChildName (const QString &short_child_name, bool
return (parent->getFullName () + '@' + safe_name);
}
+QString RSlotsPseudoObject::makeChildBaseName (const QString &short_child_name) const {
+ RK_TRACE (OBJECTS);
+
+ QString safe_name = short_child_name;
+ if (irregularShortName (safe_name)) safe_name = rQuote (short_child_name);
+ return (parent->getBaseName () + '@' + safe_name);
+}
+
RKNamespaceObject::RKNamespaceObject (REnvironmentObject* package, const QString name) : REnvironmentObject (package, name.isNull () ? "NAMESPACE" : name) {
RK_TRACE (OBJECTS);
type |= PseudoObject;
diff --git a/rkward/core/rkpseudoobjects.h b/rkward/core/rkpseudoobjects.h
index f14d5f78..80a9f8b1 100644
--- a/rkward/core/rkpseudoobjects.h
+++ b/rkward/core/rkpseudoobjects.h
@@ -37,6 +37,7 @@ public:
QString getFullName () const override;
QString makeChildName (const QString &short_child_name, bool misplaced=false) const override;
+ QString makeChildBaseName (const QString &short_child_name) const override;
};
/**
diff --git a/rkward/rkconsole.cpp b/rkward/rkconsole.cpp
index 3b28f3ad..363f80d2 100644
--- a/rkward/rkconsole.cpp
+++ b/rkward/rkconsole.cpp
@@ -492,8 +492,12 @@ void RKConsole::doTabCompletion () {
} else if (!current_symbol.isEmpty ()) {
RObject::RObjectSearchMap map;
RObjectList::getObjectList ()->findObjectsMatching (current_symbol, &map);
+ QStringList completions;
+ for (RObject::RObjectSearchMap::const_iterator i = map.constBegin (); i != map.constEnd(); ++i) {
+ completions.append (i.value ()->getBaseName ());
+ }
- if (doTabCompletionHelper (current_line_num, current_line, word_start, word_end, map.keys ())) return;
+ if (doTabCompletionHelper (current_line_num, current_line, word_start, word_end, completions)) return;
}
// no completion was possible
More information about the rkward-tracker
mailing list