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

extend lastcmd mode to support all the previous cmds #1831

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

tw4452852
Copy link
Contributor

@tw4452852 tw4452852 commented Aug 12, 2024

Sometimes, I found that what I want is not just last command, but even older one.

@tw4452852 tw4452852 force-pushed the extend_lastcmd branch 3 times, most recently from aeb9b1d to 7a9f8cf Compare August 13, 2024 01:29
@xiaq
Copy link
Member

xiaq commented Aug 14, 2024

I feel "rolling over" to the previous/next command is not exactly idea:

  • I might hold down Up or Down to navigate to a far away item, and the worst thing that would happen is that I would stop at the first or last item. But now there's a danger of going over to another command
  • It can also take a bit too many keystrokes to fully go over one command

Left and Right are not used in lastcmd mode, what about using them to navigate commands?

@tw4452852
Copy link
Contributor Author

@xiaq How about using Alt + <Up/Down>? I prefer to reserve <Left/Right> to be used as selecting left/right item in the future.

@xiaq
Copy link
Member

xiaq commented Aug 15, 2024

@xiaq How about using Alt + <Up/Down>? I prefer to reserve <Left/Right> to be used as selecting left/right item in the future.

Alt-Up/Down sound fine too!

Signed-off-by: Tw <tw19881113@gmail.com>
@tw4452852
Copy link
Contributor Author

@xiaq How about using Alt + <Up/Down>? I prefer to reserve <Left/Right> to be used as selecting left/right item in the future.

Alt-Up/Down sound fine too!

Updated in the latest version.

Copy link
Member

@xiaq xiaq left a comment

Choose a reason for hiding this comment

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

I'm going to merge this to a separate branch before integrating into master.

I'll probably only work on the integration next week, so feel free to open more pull requests in the interim (or not, whichever you prefer :).

for i, word := range words {
entries[i+1] = lastcmdEntry{strconv.Itoa(i), strconv.Itoa(i - len(words)), word}

get_items := func(c histutil.Cursor) []lastcmdEntry {
Copy link
Member

Choose a reason for hiding this comment

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

Should be called getItems - also the choice of making c an argument seems arbitrary, it's always the same argument

Comment on lines +38 to +41
// A function called when selecting before the beginning of the items.
OnUnderFlow func(ListBox)
// A function called when selecting after the ending of the items.
OnOverFlow func(ListBox)
Copy link
Member

Choose a reason for hiding this comment

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

These are misnomers that they're no longer triggered when underflow/overflow. Maybe OnPrevItemSet would be a bit better.

Comment on lines +297 to +302
case term.K(ui.Up, ui.Alt):
w.OnUnderFlow(w)
return true
case term.K(ui.Down, ui.Alt):
w.OnOverFlow(w)
return true
Copy link
Member

Choose a reason for hiding this comment

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

It would be nicer if this is part of the keybinding rather than hardcoded in the event handler.

@xiaq xiaq changed the base branch from master to integrate-1831 August 27, 2024 15:05
@xiaq xiaq merged commit 50dad91 into elves:integrate-1831 Aug 27, 2024
13 of 17 checks passed
@tw4452852 tw4452852 deleted the extend_lastcmd branch September 2, 2024 06:54
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