Skip to content

scrollback_pager_history_size keeps formatting escape codes without --stdin-add-formatting #3132

@aorith

Description

@aorith

Describe the bug

When piping the full scrollback buffer with --stdin-source=@screen_scrollback, the text contains the escape sequence for erasing format: ^[[m only in front of the lines that came from the scrollback_pager_history_size buffer.

To Reproduce
Steps to reproduce the behavior:

  1. Configure a very small scrollback buffer size and a mapping to save the buffer:
scrollback_lines 10
scrollback_pager_history_size 1
map ctrl+shift+x launch --stdin-source=@screen_scrollback --type=background /bin/dd of=/tmp/test.output
  1. Restart kitty and generate some output, for example: yes "XXXXXXXXXXX"
  2. Enter ctrl+shift+x or whatever hotkey configured
  3. Edit /tmp/test.output in vim or some editor that doesn't take in account escape codes.

Expected behavior

Escape codes/sequences should not be saved without --stdin-add-formatting

Environment details
OS: MacOs Big Dissapointment 11.0.1

kitty 0.19.2 created by Kovid Goyal
Darwin moria 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:11 PDT 2020; root:xnu-7195.50.7~2/RELEASE_X86_64 x86_64
ProductName:	macOS ProductVersion:	11.0.1 BuildVersion:	20B29
Loaded config files: /Users/aomanu/.config/kitty/kitty.conf

Config options different from defaults:
scrollback_lines              10
scrollback_pager_history_size 1048576
Added shortcuts:
	 shift+control+x KeyAction(func='launch', args=['--stdin-source=@screen_scrollback', '--type=background', '/bin/dd', 'of=/tmp/test.output'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions