MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / canTabComplete

Function canTabComplete

Engine/source/console/consoleInternal.cpp:63–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61std::unordered_map<std::pair<StringTableEntry, StringTableEntry>, Namespace*> gNamespaceCache;
62
63bool canTabComplete(const char *prevText, const char *bestMatch,
64 const char *newText, S32 baseLen, bool fForward)
65{
66 // test if it matches the first baseLen chars:
67 if (dStrnicmp(newText, prevText, baseLen))
68 return false;
69
70 if (fForward)
71 {
72 if (!bestMatch)
73 return dStricmp(newText, prevText) > 0;
74 else
75 return (dStricmp(newText, prevText) > 0) &&
76 (dStricmp(newText, bestMatch) < 0);
77 }
78 else
79 {
80 if (dStrlen(prevText) == (U32)baseLen)
81 {
82 // look for the 'worst match'
83 if (!bestMatch)
84 return dStricmp(newText, prevText) > 0;
85 else
86 return dStricmp(newText, bestMatch) > 0;
87 }
88 else
89 {
90 if (!bestMatch)
91 return (dStricmp(newText, prevText) < 0);
92 else
93 return (dStricmp(newText, prevText) < 0) &&
94 (dStricmp(newText, bestMatch) > 0);
95 }
96 }
97}
98
99//---------------------------------------------------------------
100//

Callers 1

tabCompleteMethod · 0.85

Calls 3

dStrnicmpFunction · 0.85
dStricmpFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected