Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mgunyho
Copy link
Owner

@mgunyho mgunyho commented Feb 18, 2024

Currently, tere outputs a lot of redundant escape codes. When starting tere in a folder containing two subfolders bar and foo, the following escape codes are printed:

^[[?25l^M
^[[1;1H^[[2K^[[1;1H^M
^[[0m^[[1m^[[4m/tmp/xxxxxxxxxx^[[0m^M
^[[1;1H^[[2K^[[1;1H^M
^[[0m^[[1m^[[4m/tmp/xxxxxxxxxx^[[0m^M
^[[23;1H^[[2K^[[23;1H^[[0m^[[1mtere 1.5.1 - Type something to search, press '?' to view help or Esc to exit.^[[0m^M
^[[24;1H^[[2K^[[24;27H^[[0m^[[1mgap search from start - smart case - sort:name - 2 / 3^[[0m^M
^[[24;1H^[[0m^[[1msearch: ^[[0m^M
^[[2;1H^[[0m^[[0m^[[1m^M
^[[24m^[[49m^[[39m.^M
^[[24m^[[49m^[[39m.^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[3;1H^[[0m^[[0m^[[1m^M
^[[24m^[[48;5;7m^[[38;5;0mb^M
^[[24m^[[48;5;7m^[[38;5;0ma^M
^[[24m^[[48;5;7m^[[38;5;0mr^M
^[[0m^[[48;5;7m                                                                             ^[[0m^[[0m^[[4;1H^[[0m^[[0m^[[1m^M
^[[24m^[[49m^[[39mf^M
^[[24m^[[49m^[[39mo^M
^[[24m^[[49m^[[39mo^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[5;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[6;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[7;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[8;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[9;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[10;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[11;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[12;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[13;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[14;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[15;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[16;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[17;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[18;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[19;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[20;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[21;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[22;1H^[[0m^[[0m^[[2m^M
^[[0m^[[0m^[[K^[[0m^[[0m^[[?25h^M
^[[?1049l/tmp/xxxxxxxxxx^M

(Printed using cat -v tests/expected-output-basic.txt, newlines added for clarity.)

Some issues to be fixed in this PR:

  • Lot of unnecessary ^[[0m (reset attributes) commands
  • The attributes are repeated for each character. For example, when printing foo, it should be
    ^[[24m^[[49m^[[39mfoo instead of
    ^[[24m^[[49m^[[39mf^M
    ^[[24m^[[49m^[[39mo^M
    ^[[24m^[[49m^[[39mo^M
    

@mgunyho mgunyho changed the title Add basic test of full raw escape codes output by program Reduce redundant escape codes Feb 18, 2024
@mgunyho mgunyho force-pushed the reduce-escape-codes branch from 51ce697 to 3a9f27f Compare September 15, 2024 17:08
@mgunyho mgunyho force-pushed the reduce-escape-codes branch from 3a9f27f to 85e97d7 Compare September 15, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants