MCPcopy Create free account
hub / github.com/Alphanimble/htmlstream / shouldShowStreamingCaret

Function shouldShowStreamingCaret

src/patch-streaming-html.ts:135–149  ·  view source on GitHub ↗
(cleanTrack: string)

Source from the content-addressed store, hash-verified

133
134/** Show the caret only while literal text is streaming into a text-bearing element. */
135export function shouldShowStreamingCaret(cleanTrack: string): boolean {
136 const track = cleanTrack.trim();
137 const tailText = getTrailingTextRun(track);
138 if (!tailText) {
139 return false;
140 }
141
142 const stack = getOpenTagStack(track);
143 if (stack.length === 0) {
144 return true;
145 }
146
147 const deepest = stack[stack.length - 1]!.toLowerCase();
148 return TEXT_STREAM_TAGS.has(deepest);
149}
150
151/** Walk DOM to the innermost open element matching the track stack */
152function findDeepOpenElement(

Callers 3

StreamHtmlFunction · 0.90
syncStreamingCaretFunction · 0.85

Calls 2

getTrailingTextRunFunction · 0.85
getOpenTagStackFunction · 0.85

Tested by

no test coverage detected