Skip to content

Experimental support for _message content as fzf header#354

Draft
AndydeCleyre wants to merge 2 commits into
romkatv:v5from
AndydeCleyre:message-as-fzf-header
Draft

Experimental support for _message content as fzf header#354
AndydeCleyre wants to merge 2 commits into
romkatv:v5from
AndydeCleyre:message-as-fzf-header

Conversation

@AndydeCleyre

Copy link
Copy Markdown

From discussion at #352, this draft PR is a place to explore possibilities for retaining messages from _message calls so that the user still sees them.

@AndydeCleyre

Copy link
Copy Markdown
Author

Currently this doesn't touch -z4h-comp-files, and I don't know if it ought to.

@romkatv

romkatv commented Apr 3, 2025

Copy link
Copy Markdown
Owner

Currently this doesn't touch -z4h-comp-files, and I don't know if it ought to.

Let's ignore that for now. If needed, It'll be easy to handle -z4h-comp-files later, when we are happy with -z4h-comp-words.

@AndydeCleyre
AndydeCleyre force-pushed the message-as-fzf-header branch from 3d5664a to 4347a81 Compare April 3, 2025 19:28
@AndydeCleyre

AndydeCleyre commented Apr 3, 2025

Copy link
Copy Markdown
Author
  1. It's safe to consider extendedglob to be already set when -z4h-comp-words is evaluated, right?
  2. My new "FIXUP" commit is in fact very wrong. With many-lined headers, even when they can fit with space to spare, the choices are invisible and there's no indication of the selected choice changing. And the headers get truncated I think.

I'll have another look at this in the evening I think.

@romkatv

romkatv commented Apr 5, 2025

Copy link
Copy Markdown
Owner
  • It's safe to consider extendedglob to be already set when -z4h-comp-words is evaluated, right?

I don't see why it would be safe to assume that. What am I missing?

I'll have another look at this in the evening I think.

I'm here to review the change whenever you think it's ready. If I were doing it, I would run something like this with various arguments:

seq 3 | fzf --header=$'1\n2\n3\n4\n5\n'

Build a mental model of how exactly fzf displays the value --header, and then code the same login in zsh to compute the height.

@AndydeCleyre

Copy link
Copy Markdown
Author

I don't see why it would be safe to assume that. What am I missing?

I guessed that just because it looks like the extended glob # operator is used in -z4h-main-complete without a local setopt (curcontext="${curcontext/:[^:]#:/:${_completer}:}", curcontext="${curcontext/:[^:]#:/::}"), and it looks like it's set in z4h.sh.

@romkatv

romkatv commented Apr 6, 2025

Copy link
Copy Markdown
Owner

-z4h-comp-words is called directly from z4h-fzf-complete. I don't think the latter enabled extended_glob.

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.

2 participants