feat(nvim): display selected file in tree in the editor

This commit is contained in:
Pihkaal
2024-01-28 21:35:06 +01:00
parent 965fff6226
commit e778631828
7 changed files with 139 additions and 27 deletions

View File

@@ -0,0 +1,16 @@
import { useTerminal } from "~/context/TerminalContext";
import { TerminalRenderer } from "~/utils/terminal/renderer";
export const NvimEditor = (props: { content: string | null }) => {
const { cols: width, rows: height } = useTerminal();
const canvas = new TerminalRenderer(width * 0.8, height - 2);
if (props.content) {
props.content.split("\n").forEach((line, y) => {
canvas.write(0, y, line);
});
}
return canvas.render();
};