Function cleanup_captured_buffer

Source
pub fn cleanup_captured_buffer(
    buffer: &[u8],
    drop_n_last_lines: usize,
) -> Vec<u8> 
Expand description

This function processes a pane captured bufer.

  • All lines are trimmed after capture because tmux does not allow capturing escape codes and trimming lines.
  • If drop_n_last_lines is greater than 0, the n last line are not captured. This is used only for panes with a zsh prompt, in order to avoid polluting the history with new prompts on restore.
  • In addition, the last line has an additional ascii reset escape code because tmux does not capture it.