marionebl / svg-term-cli

Share terminal sessions via SVG and CSS
MIT License
3.48k stars 116 forks source link

Last line of terminal cast goes off-screen #73

Open mihael-stormrage opened 3 years ago

mihael-stormrage commented 3 years ago

Here is an example:

svg

made with this command:

svg-term --cast lArG86KKfUePxjImN9bGx6x5B --out preview.svg --no-cursor --width 80 --height 20 --window

As you can see the last line with prompt and user input only shows after it comes up.

Repository: mihael-stormrage/backend-project-lvl1

mrlnc commented 3 years ago

I ended up changing this line in node_modules/svg-term/lib/to-view-model.js, worked for me. First time using the tool, not sure if anything else breaks :) [EDIT the first line is gone of course :D anyway i can live with that, just insert a newline before the first command]

function toViewModel(options) {
...
    const frames = cast.frames
        .filter(([stamp], i, fs) => stamp >= from && stamp <= to)
        .map(([delta, data], i) => [delta, data, liner(data)])
        .map(([stamp, data, l], index) => {
        const lines = l
            .map((chars, y) => {
            const words = toWords(chars);
            return {
-               y: y * fontSize * lineHeight,
+               y: (y-1) * fontSize * lineHeight, 
               words,
                hash: hash(words),
                ref: null
            };
        });