Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last line of terminal cast goes off-screen #73

Open
mihael-stormrage opened this issue Apr 24, 2021 · 1 comment · May be fixed by marionebl/svg-term#43
Open

Last line of terminal cast goes off-screen #73

mihael-stormrage opened this issue Apr 24, 2021 · 1 comment · May be fixed by marionebl/svg-term#43

Comments

@mihael-stormrage
Copy link

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
Copy link

mrlnc commented May 7, 2021

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
            };
        });

MadLittleMods added a commit to MadLittleMods/svg-term that referenced this issue Feb 19, 2024
MadLittleMods added a commit to MadLittleMods/svg-term that referenced this issue Feb 19, 2024
Fix marionebl/svg-term-cli#73

This problem only manifested when an explicit `--height`
was given.

Because `options.height` and `cast.height` differ, using
the wrong one will result in an off-by-one error. Note:
those height values only differ because it errantly seems to be
[incremented by one when we load the cast](https://github.com/marionebl/svg-term/blob/f761fcac7dc77520cb6d7c8e28618cd266f74538/src/load-cast.ts#L14).
We should probably remove that increment (see next commit).
@MadLittleMods MadLittleMods linked a pull request Feb 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants