Bat: iTerm2 issue with fullscreen

Created on 8 Sep 2018  路  3Comments  路  Source: sharkdp/bat

Thanks a lot for bat!

I just noticed that if you bat a file in iTerm2 and simply keep switching back and forth to fullscreen, the output gets messed up pretty bad.

Here is an example, bat a file belonging to Homebrew:

screen shot 2018-09-07 at 8 26 42 pm

screen shot 2018-09-07 at 8 26 45 pm

Now if I simply get out of fullscreen, output gets messed up:

screen shot 2018-09-07 at 8 27 51 pm

screen shot 2018-09-07 at 8 28 39 pm

You can also see the scrollbar in the terminal growing, simply switching back and forth to fullscreen (cmd+enter):

screen shot 2018-09-07 at 8 29 42 pm

Not even sure where to start with this, but let me know if I can help!

question

Most helpful comment

You can also see the scrollbar in the terminal growing

This would be because of less, the default pager for bat. less will automatically resize itself with the terminal and re-print everything to fit the new size. The content that was on the screen before the re-print is pushed back into the scrollback buffer, which creates a jumbled mess when scrolling back up.

If you disable the pager with --paging=never, this shouldn't happen anymore. A more permanent fix would be to add export BAT_PAGER=cat export BAT_PAGER='' (thanks for the tip, @sharkdp!) to your .bash_profile file, though.


As for the last image: the line wrapping fails because the terminal was resized to a smaller width than when it was printed, which makes iTerm's text wrapping take over. Unfortunately, once bat passes control to the pager, there's no way redraw/refresh the output to fit the smaller terminal.

All 3 comments

You can also see the scrollbar in the terminal growing

This would be because of less, the default pager for bat. less will automatically resize itself with the terminal and re-print everything to fit the new size. The content that was on the screen before the re-print is pushed back into the scrollback buffer, which creates a jumbled mess when scrolling back up.

If you disable the pager with --paging=never, this shouldn't happen anymore. A more permanent fix would be to add export BAT_PAGER=cat export BAT_PAGER='' (thanks for the tip, @sharkdp!) to your .bash_profile file, though.


As for the last image: the line wrapping fails because the terminal was resized to a smaller width than when it was printed, which makes iTerm's text wrapping take over. Unfortunately, once bat passes control to the pager, there's no way redraw/refresh the output to fit the smaller terminal.

Thank you for helping out here, @eth-p. Just a minor comment: To disable the pager permanently, you can use export BAT_PAGER="" (instead of setting it to cat). This way, bat will not spawn an additional process.

export BAT_PAGER="" working great!

Thanks for the help, closing 鉂わ笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

x70b1 picture x70b1  路  3Comments

rien333 picture rien333  路  3Comments

gAmUssA picture gAmUssA  路  3Comments

tbsvttr picture tbsvttr  路  3Comments

niedzielski picture niedzielski  路  3Comments