Add intra-line diff highlighting for edit tool

- Extract diff rendering to dedicated diff.ts component
- Show word-level changes with inverse highlighting when a single line is modified
- Use diffWords for cleaner token grouping (includes adjacent whitespace)
- Only apply intra-line diff when exactly 1 removed and 1 added line (true modification)
- Multi-line changes show all removed then all added without incorrect pairing
- Add theme.inverse() method for inverse text styling
This commit is contained in:
Mario Zechner 2025-12-18 16:49:44 +01:00
parent 1a944f50f9
commit 5117187362
3 changed files with 155 additions and 12 deletions

View file

@ -351,6 +351,10 @@ export class Theme {
return chalk.underline(text);
}
inverse(text: string): string {
return chalk.inverse(text);
}
getFgAnsi(color: ThemeColor): string {
const ansi = this.fgColors.get(color);
if (!ansi) throw new Error(`Unknown theme color: ${color}`);