Skip to content

Whitespace glitch when updating #2

@papandreou

Description

@papandreou

Thanks for creating this library -- it looks really promising.

I ran into a problem while trying to render a live-updated table. It can be boiled down to:

const frames = [
`
┌─┐
│ │
`,
`
┌────┐
│    │
`
];

const diffy = require('diffy')();
const trim = require('diffy/trim');
let nextFrameNumber = 0;

diffy.render(() => trim(`
    ${frames[nextFrameNumber++]}
`));

setTimeout(() => diffy.render(), 1000);

Expected output:

┌─┐
│ │

and then:

┌────┐
│    │

Actual output:

┌─┐
│ │

and then:

┌────┐
││

Reproduced with the Gnome Terminal on Ubuntu.

Seems like removing the whitespace between trim(` and ${ corrects the output, so I hope it's an easy fix :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions