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

Function tabComplete

Engine/source/console/console.cpp:461–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461U32 tabComplete(char* inputBuffer, U32 cursorPos, U32 maxResultLength, bool forwardTab)
462{
463 // Check for null input.
464 if (!inputBuffer[0])
465 {
466 return cursorPos;
467 }
468
469 // Cap the max result length.
470 if (maxResultLength > MaxCompletionBufferSize)
471 {
472 maxResultLength = MaxCompletionBufferSize;
473 }
474
475 // See if this is the same partial text as last checked.
476 if (String::compare(tabBuffer, inputBuffer))
477 {
478 // If not...
479 // Save it for checking next time.
480 dStrcpy(tabBuffer, inputBuffer, MaxCompletionBufferSize);
481 // Scan backward from the cursor position to find the base to complete from.
482 S32 p = cursorPos;
483 while ((p > 0) && (inputBuffer[p - 1] != ' ') && (inputBuffer[p - 1] != '.') && (inputBuffer[p - 1] != '('))
484 {
485 p--;
486 }
487 completionBaseStart = p;
488 completionBaseLen = cursorPos - p;
489
490 // Bail if we end up at start of string
491 if (p == 0)
492 {
493 return cursorPos;
494 }
495
496 // Is this function being invoked on an object?
497 if (inputBuffer[p - 1] == '.')
498 {
499 // If so...
500 if (p <= 1)
501 {
502 // Bail if no object identifier.
503 return cursorPos;
504 }
505
506 // Find the object identifier.
507 S32 objLast = --p;
508 while ((p > 0) && (inputBuffer[p - 1] != ' ') && (inputBuffer[p - 1] != '('))
509 {
510 p--;
511 }
512
513 if (objLast == p)
514 {
515 // Bail if no object identifier.
516 return cursorPos;
517 }
518

Callers 3

onKeyDownMethod · 0.85
processMethod · 0.85
processMethod · 0.85

Calls 7

compareFunction · 0.85
dStrcpyFunction · 0.85
dStrncpyFunction · 0.85
findObjectFunction · 0.70
globalClass · 0.50
dStrlenFunction · 0.50
tabCompleteMethod · 0.45

Tested by

no test coverage detected