MCPcopy
hub / github.com/Doorman11991/smallcode / addDiff

Method addDiff

src/tui/fullscreen.js:1056–1083  ·  view source on GitHub ↗
(filePath, oldStr, newStr, lineNum)

Source from the content-addressed store, hash-verified

1054
1055 // Show a diff in the chat panel (non-blocking, inline)
1056 addDiff(filePath, oldStr, newStr, lineNum) {
1057 const t = this.theme;
1058 const maxLines = 8;
1059
1060 const prefix = t.accent + ' DIFF ' + t.border + '│ ' + ANSI.reset;
1061 const contPrefix = ' ' + t.border + '│ ' + ANSI.reset;
1062
1063 this.chatLines.push(`${prefix}${t.accent}${filePath}:${lineNum}${ANSI.reset}`);
1064
1065 const oldLines = oldStr.split('\n').slice(0, maxLines);
1066 const newLines = newStr.split('\n').slice(0, maxLines);
1067
1068 for (const line of oldLines) {
1069 this.chatLines.push(`${contPrefix}${t.error}- ${line}${ANSI.reset}`);
1070 }
1071 if (oldStr.split('\n').length > maxLines) {
1072 this.chatLines.push(`${contPrefix}${t.muted}... (${oldStr.split('\n').length - maxLines} more)${ANSI.reset}`);
1073 }
1074 for (const line of newLines) {
1075 this.chatLines.push(`${contPrefix}${t.success}+ ${line}${ANSI.reset}`);
1076 }
1077 if (newStr.split('\n').length > maxLines) {
1078 this.chatLines.push(`${contPrefix}${t.muted}... (${newStr.split('\n').length - maxLines} more)${ANSI.reset}`);
1079 }
1080
1081 this.chatScroll = 0;
1082 this.render();
1083 }
1084
1085 setStreaming(streaming) {
1086 this.isStreaming = streaming;

Callers 1

executeToolFunction · 0.80

Calls 1

renderMethod · 0.95

Tested by

no test coverage detected