walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

Fix rendering of whitespace lines #163

Closed Wallunen closed 8 months ago

Wallunen commented 8 months ago

The TestRenderLineEmpty and TestRenderLineOnlyTrailingSpaces tests fail now. screenshot

walles commented 8 months ago
  1. What was broken before this change? What symptoms were you seeing?
  2. How does this change fix that?

Do you have screenshots before and after this change?

Also, the tests have to pass.

Wallunen commented 8 months ago

What was broken before this change? What symptoms were you seeing?

The broken version is shown in the above screenshot. Empty lines were not being re-rendered when scrolling.

How does this change fix that?

By removing an early return that apparently was skipping the rendering of empty lines.

Do you have screenshots before and after this change?

Here is a screenshot of the after. screenshot

Also, the tests have to pass.

Are those specific tests important? Can they be removed?

walles commented 8 months ago

Now released with v1.18.1, thanks for the fix!

Regarding tests in general, they are just code, and like any other code they need to work.

In some cases it's easier to start by updating the tests to reflect the behavior you want and then adapt the code until the new tests pass.

In this particular case, both of those tests check for empty line corner cases, which are easy to mess up (obviously, since I did just that), so they are very important.