fix capture bug

This commit is contained in:
AI Christianson 2025-02-25 15:13:33 -05:00
parent 7ae4c61af6
commit d3b4d9b8d9
1 changed files with 18 additions and 6 deletions

View File

@ -403,17 +403,29 @@ def run_interactive_command(
all_lines = [] all_lines = []
# Add history.top lines (older history) # Add history.top lines (older history)
for line_num in sorted(screen.history.top): if hasattr(screen.history.top, 'keys'):
line = screen.history.top[line_num] # Dictionary-like object
all_lines.append(render_line(line, cols)) for line_num in sorted(screen.history.top.keys()):
line = screen.history.top[line_num]
all_lines.append(render_line(line, cols))
else:
# Deque or other iterable
for i, line in enumerate(screen.history.top):
all_lines.append(render_line(line, cols))
# Add current display lines # Add current display lines
all_lines.extend([render_line(line, cols) for line in screen.display]) all_lines.extend([render_line(line, cols) for line in screen.display])
# Add history.bottom lines (newer history) # Add history.bottom lines (newer history)
for line_num in sorted(screen.history.bottom): if hasattr(screen.history.bottom, 'keys'):
line = screen.history.bottom[line_num] # Dictionary-like object
all_lines.append(render_line(line, cols)) for line_num in sorted(screen.history.bottom.keys()):
line = screen.history.bottom[line_num]
all_lines.append(render_line(line, cols))
else:
# Deque or other iterable
for i, line in enumerate(screen.history.bottom):
all_lines.append(render_line(line, cols))
# Trim out empty lines to get only meaningful lines # Trim out empty lines to get only meaningful lines
# Also strip trailing whitespace from each line # Also strip trailing whitespace from each line