1

TL;RD less -S -R gives colored output but lines still wrapped to next line.

I'm requesting a http service (instagram api) which gives me json encoded data. I use prettyjson from npm to see colored output. But some lines are too long, so they are wrapped by terminal. I want to enable horizontal scroll by using less. Horizontal scroll works by arrow keys, but lines still wrapped to next line

Look at last lines with thumbnail_src and display_src screenshot of termnal app in OSX screenshot of terminal app in OSX

GRiMe2D
  • 121

1 Answers1

1

By reading unix stackexchange I found the answer:

Warning: when the -r option is used, less cannot keep track of the actual appearance of the screen (since this depends on how the screen responds to each type of control character). Thus, various display problems may result, such as long lines being split in the wrong place.

link to comment

GRiMe2D
  • 121
  • less -R is supposed to be the fix to that. Unlike -r, the screen appearance is maintained correctly in most cases. (repeat 10 seq 100 | paste -sd - -) | grep --color=always '[0-9]' | less -RS (zsh syntax) works OK for me. Possibly less cannot determine the width of your terminal. – Stéphane Chazelas Nov 21 '16 at 07:43