MCPcopy Create free account
hub / github.com/BruceDevices/firmware / trySyncLiveInputFromRemoteLine

Function trySyncLiveInputFromRemoteLine

src/modules/wifi/clients.cpp:526–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526bool trySyncLiveInputFromRemoteLine(const String &line, bool renderUpdatedPrompt) {
527 String liveInput = getTerminalLiveInput();
528 if (liveInput.isEmpty()) return false;
529
530 String promptPrefix = getCurrentPromptPrefix();
531 String payload = line;
532 if (!promptPrefix.isEmpty() && line.startsWith(promptPrefix)) {
533 payload = line.substring(promptPrefix.length());
534 } else if (!line.startsWith(liveInput)) return false;
535
536 payload.trim();
537 if (payload.isEmpty() || !payload.startsWith(liveInput)) return false;
538
539 bool awaiting = false;
540 withClientLock([&]() { awaiting = awaitingTabDebugResponse; });
541 if (awaiting && payload == liveInput) return true;
542
543 syncCommandBufferFromRemote(payload);
544 withClientLock([&]() { awaitingTabDebugResponse = false; });
545 if (renderUpdatedPrompt) redrawCurrentCommandLine();
546 return true;
547}
548
549bool isLikelyCompletionSuffix(const String &text) {
550 if (text.isEmpty()) return false;

Callers 1

renderSessionOutputFunction · 0.85

Calls 5

getTerminalLiveInputFunction · 0.85
getCurrentPromptPrefixFunction · 0.85
withClientLockFunction · 0.85
redrawCurrentCommandLineFunction · 0.85

Tested by

no test coverage detected