Skip to content

Export/print marks to stdout#187

Merged
YS-L merged 3 commits intoYS-L:mainfrom
giantatwork:stdout_marks
Jan 9, 2026
Merged

Export/print marks to stdout#187
YS-L merged 3 commits intoYS-L:mainfrom
giantatwork:stdout_marks

Conversation

@giantatwork
Copy link
Copy Markdown
Contributor

Hi @jqnatividad,

As requested in #186, I've added a shortcut (Ctrl+m) that prints/exports marked rows to stdout with their headers, similar to how single cells are currently handled.

@YS-L, let me know what you think!

@jqnatividad
Copy link
Copy Markdown
Contributor

Awesome @giantatwork !

What about adding a shortcut to Mark All? I was thinking that after filtering, I can mark all and then export?

Of course, this is pending @YS-L 's review....

@giantatwork
Copy link
Copy Markdown
Contributor Author

@jqnatividad

Awesome @giantatwork !

Thanks!

What about adding a shortcut to Mark All? I was thinking that after filtering, I can mark all and then export?

That’s a great suggestion. My only concern is the potential performance impact when handling a large number of records. We’d likely run into the same bottleneck described in #167. We should consider how to handle the 'Select All' action efficiently for high-volume exports.
Let's wait for @YS-L's reaction on this subject first.

@jqnatividad
Copy link
Copy Markdown
Contributor

As to performance, I wonder if a "streaming" approach can be used instead?

Comment thread src/input.rs Outdated
KeyCode::Left => Control::ScrollLeftMost,
KeyCode::Right => Control::ScrollRightMost,
KeyCode::Char('j') => Control::ToggleNaturalSort,
KeyCode::Char('m') => Control::SelectMarks,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't get Ctrl + m to work in iTerm2 or the macOS Terminal (it's treated the same as Enter there), though it does work in Ghostty. Might need to use a more portable key binding such as Ctrl + e.

Comment thread src/app.rs
Comment on lines +757 to +759
if marked.is_empty() {
return Some(String::new());
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to return None when there are no marked rows, so the program doesn't exit?

Comment thread src/view.rs Outdated
.iter()
.map(|&n| n.saturating_sub(1) as u64)
.collect();
indices.sort_unstable();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this sort still needed? The passed in record_numbers is already sorted.

@YS-L
Copy link
Copy Markdown
Owner

YS-L commented Jan 7, 2026

Thanks @giantatwork for the PR! I agree with your concerns about handling large numbers of records. In this case in particular, we need to be careful not to read a large number of rows into memory.

@YS-L
Copy link
Copy Markdown
Owner

YS-L commented Jan 7, 2026

@jqnatividad Would this still be a useful addition without a “Mark All” option? Curious since you raised the original feature request.

@jqnatividad
Copy link
Copy Markdown
Contributor

Yes @YS-L , IMHO, it's still a useful addition.

Insofar as "Mark All" causing memory issues, perhaps we can include some simple heuristics to ensure it doesn't cause OOM - i.e. "Mark All" will not work without any filters in place; Maximum hardcoded row limit; some OOM checking for folks with the memory to spare, etc.

@YS-L
Copy link
Copy Markdown
Owner

YS-L commented Jan 9, 2026

Thanks @giantatwork !

@YS-L YS-L merged commit 5df8087 into YS-L:main Jan 9, 2026
7 checks passed
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.

3 participants