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

Rename prompter concepts #2601

Closed
aadcg opened this issue Oct 20, 2022 · 11 comments · Fixed by #2655
Closed

Rename prompter concepts #2601

aadcg opened this issue Oct 20, 2022 · 11 comments · Fixed by #2655
Labels
prompt-buffer Related to the prompt buffer.

Comments

@aadcg
Copy link
Member

aadcg commented Oct 20, 2022

While working on #2555, I noticed that prompter's concepts can be difficult to internalize.

I suggest the following rename (reasoning below):

  • selection -> current-suggestion
  • selection-actions -> current-suggestion-actions
  • marks -> selection
  • marks-actions -> selection-actions

The key observation is that marks only exist when multi-selection-p is non-nil, which immediately makes us think of a selection (a set of items). But that collides with our concept for "the current suggestion", which we call it selection...

In #2527 I have proposed marks to be a singular concept, and selection falls in that category too. This proposal makes #2527 obsolete.

With this rename the overview of the prompter library would be as follows.

The key objects are =prompters=, =sources= and =suggestions=.

A =prompt= is an interface for user interactions that holds one or more
=sources=, and each of those are populated by =suggestions=.

Other central concepts include:

  • =prompt=
    • =current-suggestion= :: A single =suggestion=, if any. Think of it as the currently
      selected =suggestion=, belonging to a =source=.
  • =source=
    • =selection= :: A list of =suggestions=, when =multi-selection-p= is non-nil.
    • =actions= :: A list of functions that run on =suggestions=.
      • =return-actions= :: General purpose.
      • =selection-actions= :: On =selection= change (event-driven).
      • =current-suggestion-actions= :: On =current-suggestion= change (event-driven).
@aadcg aadcg added the prompt-buffer Related to the prompt buffer. label Oct 20, 2022
@aartaka
Copy link
Contributor

aartaka commented Oct 21, 2022

But then marks-actions should be selection-actions, no? Which collides with the existing ones...

@aartaka
Copy link
Contributor

aartaka commented Oct 21, 2022

Other than that, selection and current-suggestion sound good to me, yes!

@aadcg
Copy link
Member Author

aadcg commented Oct 21, 2022

Oops, good point @aartaka. I forgot to update the action-related concepts. I've edited the top post, please take a look.

current-suggestion-actions is perhaps a bit verbose, but I'm afraid we can't do much better...

@aartaka
Copy link
Contributor

aartaka commented Oct 21, 2022

Well, there can be other shorter terms for current suggestion. Like cursor, focus, point, locus?

@aadcg
Copy link
Member Author

aadcg commented Oct 21, 2022

The issue is that prompter is a just a backend libary, so I'm afraid those suggestions might not be suitable.

@aartaka
Copy link
Contributor

aartaka commented Oct 21, 2022

I mean, cursor is a data structure term as much as UI one, and focus is merely a generic word for one's center of attention at a certain moment in time. Those two are kind of suitable, even for a backend library.

@aadcg
Copy link
Member Author

aadcg commented Oct 21, 2022

Fair.

Let's wait for @Ambrevar's input.

@Ambrevar
Copy link
Contributor

Well, selection is a pretty good term for the current suggestion :)
Can also have selections and current-selection.

Let's sleep over this.

@aadcg
Copy link
Member Author

aadcg commented Nov 9, 2022

@Ambrevar I'd like to ping on this issue since it's extremely important.

The prompt buffer entry on the manual is perhaps the most important one, since this special buffer is the main interface from the user's perspective.

In other to write a proper entry, we need to settle on a set consistent concepts between prompter (the external library) and prompter-buffer (in nyxt's package).

When we reach consensus, let's incorporate this into #2630.

@Ambrevar
Copy link
Contributor

I'm fine with the suggestion from the original post.

@aadcg
Copy link
Member Author

aadcg commented Nov 18, 2022

Didn't add this bit as part of #2630 so that it would be easier to review. Will open a separate PR on that.

@aadcg aadcg mentioned this issue Nov 24, 2022
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prompt-buffer Related to the prompt buffer.
Development

Successfully merging a pull request may close this issue.

3 participants