MCPcopy Create free account
hub / github.com/Noumena-Network/code / estimateTextRows

Function estimateTextRows

src/components/VirtualMessageList.tsx:39–52  ·  view source on GitHub ↗
(text: string, columns: number)

Source from the content-addressed store, hash-verified

37}
38
39function estimateTextRows(text: string, columns: number): number | undefined {
40 if (!text) return undefined;
41 const wrapWidth = Math.max(1, columns);
42 let rows = 0;
43 let start = 0;
44 while (start <= text.length) {
45 const end = text.indexOf('\n', start);
46 const lineLength = (end === -1 ? text.length : end) - start;
47 rows += Math.max(1, Math.ceil(lineLength / wrapWidth));
48 if (end === -1) break;
49 start = end + 1;
50 }
51 return rows;
52}
53export type StickyPrompt = {
54 text: string;
55 scrollTo: () => void;

Callers 1

VirtualMessageListFunction · 0.85

Calls 1

maxMethod · 0.80

Tested by

no test coverage detected