hwatch icon indicating copy to clipboard operation
hwatch copied to clipboard

Don't show diff on first command result

Open sentinelt opened this issue 1 year ago • 3 comments

Currently command result is initialized as empty which means that the first diff shows everything as added. With this change the no changes are shown on the first command result.

sentinelt avatar Jun 24 '24 08:06 sentinelt

Should there be a configuration option for that?

sentinelt avatar Jun 24 '24 09:06 sentinelt

Umm... Wouldn't this change affect the case where the output is empty? 🤔

blacknon avatar Jun 26 '24 01:06 blacknon

I don't think so. Just to make sure I created a test script that sometimes shows an empty result:

#!/bin/bash
if (( RANDOM % 2 == 0 )); then
    echo "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
    echo "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
    echo "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
    echo "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
    echo "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
fi

In diff mode the first time the command is called the result is not highlighted: image In subsequent calls the result is highlighted: image

sentinelt avatar Jun 26 '24 08:06 sentinelt

It looks okay, so I'm going to merge it into v0.3.16 and make it possible to specify it as an option.

blacknon avatar Jul 10 '24 11:07 blacknon