Skip to content
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

separate style and inline_height settings for ctrl+r and up keybinding #2612

Open
gwenya opened this issue Mar 7, 2025 · 1 comment
Open

Comments

@gwenya
Copy link

gwenya commented Mar 7, 2025

I would really like to have the "full" style taking up the complete window when I press ctrl+r, but the "compact" style and only 10 lines or so when using the up arrow.

If creating such a feature wouldn't require huge rewrites then I would love to try implementing it, and would appreciate some pointers about where to start with that.

@ellie
Copy link
Member

ellie commented Mar 7, 2025

That sounds cool to me! I don't think it will need much of a rewrite at all, here are a few pointers

For a summary of what's probably needed

  1. Our shell integrations pass a different flag for the up arrow

_atuin_search --shell-up-key-binding "$@"

Which is defined here

#[arg(long = "shell-up-key-binding", hide = true)]
shell_up_key_binding: bool,

  1. We have a search setting struct defined here, which would be a sensible place to apply some config

pub struct Search {
/// The list of enabled filter modes, in order of priority.
pub filters: Vec<FilterMode>,

I don't have a strong preference on config naming

  1. Finally, the inline_height value is used here

pub async fn history(
query: &[String],
settings: &Settings,
mut db: impl Database,
history_store: &HistoryStore,
theme: &Theme,
) -> Result<String> {
let stdout = Stdout::new(settings.inline_height > 0)?;
let backend = CrosstermBackend::new(stdout);
let mut terminal = Terminal::with_options(
backend,
TerminalOptions {
viewport: if settings.inline_height > 0 {
Viewport::Inline(settings.inline_height)
} else {
Viewport::Fullscreen
},
},
)?;

This has access to the settings struct. We'll probably want some way of passing the flag through, but I'll leave that up to you.

Let me know if you need any help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants