-
Notifications
You must be signed in to change notification settings - Fork 22
Add viewport VT export action #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -517,6 +517,12 @@ pub const Action = union(enum) { | |
| /// See `write_scrollback_file` for possible actions. | ||
| write_screen_file: WriteScreen, | ||
|
|
||
| /// Write the visible viewport into a temporary file with the | ||
| /// specified action. | ||
| /// | ||
| /// See `write_scrollback_file` for possible actions. | ||
| write_viewport_file: WriteScreen, | ||
|
|
||
| /// Write the currently selected text into a temporary file with the | ||
| /// specified action. | ||
| /// | ||
|
|
@@ -1338,6 +1344,7 @@ pub const Action = union(enum) { | |
| .jump_to_prompt, | ||
| .write_scrollback_file, | ||
| .write_screen_file, | ||
| .write_viewport_file, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No parsing test added for The sibling actions Since parsing is shared via the {
const binding = try parseSingle("a=write_viewport_file:copy");
try testing.expect(binding.action == .write_viewport_file);
try testing.expectEqual(Action.WriteScreen.copy, binding.action.write_viewport_file);
}
{
const binding = try parseSingle("a=write_viewport_file:copy,vt");
try testing.expect(binding.action == .write_viewport_file);
try testing.expectEqual(Action.WriteScreen{
.action = .copy,
.emit = .vt,
}, binding.action.write_viewport_file);
}Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| .write_selection_file, | ||
| .close_surface, | ||
| .close_tab, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orelsebranch is dead code for.viewportgetBottomRight(.viewport)is guaranteed to return a non-nullPin— its implementation unconditionally computes a pin viabr.down(self.rows - 1).?(which itself asserts non-null internally) and then returns it. This meansorelse break :viewport nullwill never be taken.This is consistent with how
.screenis handled (also usingorelsedefensively), so it's not a correctness issue, but it is worth noting that unlike.history— where thenullreturn is possible when the history region is empty — the viewport region always exists in a live terminal. A comment clarifying this behavior (similar to the one on.historyabout alternate screens) would improve readability.