jesseduffield / lazygit

simple terminal UI for git commands
MIT License
50.47k stars 1.78k forks source link

Scroll main panel by whole pages? #1707

Open thesoftwarephilosopher opened 2 years ago

thesoftwarephilosopher commented 2 years ago

Is your feature request related to a problem? Please describe.

I'm used to using git diff, where I have to do f and b to scroll up/down whole pages.

I'd like to scroll up/down the main panel multiple pages in the same way for the same reason.

Describe the solution you'd like

I tried Ctrl-PgUp/Down and Shift-etc and they did not work. Could these be used?

Describe alternatives you've considered

Just dealing with it, but then I thought: why not post a feature request?

Additional context

Cool program everyone. Thanks for making it!

jesseduffield commented 2 years ago

I like the sound of ctrl+pgup/pgdown. If that's actually a thing that we can send to the terminal then I'm on board.

f and b are already used for various keybindings so I'm hesitant to use those.

I'll chuck a good-first-issue label on this. If anybody wants to take a stab, you can search for scrollUpMain in the codebase to see how that works. We need versions of scrollUpView and scrollDownView in pkg/gui/global_handlers.go that take the scroll amount as a parameter, rather than hardcoding to use gui.UserConfig.Gui.ScrollHeight internally. Then we can pass them the height of the view as that parameter to have us scrolling by a whole page.

jesseduffield commented 2 years ago

btw @sdegutis if you want to get your hands dirty with Go, this would be a good first start!

thesoftwarephilosopher commented 2 years ago

Sorry, to clarify, I'm requesting we use Shift-PageUp and Shift-PageDown (or Ctrl-).

thesoftwarephilosopher commented 2 years ago

Tbh I mainly solved this by just setting scroll amount to 10 in config instead of the default of 2 and using the mouse wheel to scroll, so this can be closed if you want.

thesoftwarephilosopher commented 2 years ago

By the way @jesseduffield when I looked through the src earlier, I was surprised this was written in Go. I assumed it was written using https://www.npmjs.com/package/blessed

jesseduffield commented 2 years ago

Happy to keep this issue open as others have asked about it (even I would like it haha).

Yeah my choice to use Go was really just coincidence because I wanted to learn the language

thesoftwarephilosopher commented 2 years ago

So how do you like Go after learning it?

glendsoza commented 2 years ago

First of all Awesome tool!

Based on my understanding of https://github.com/jesseduffield/lazygit/issues/1707#issuecomment-1017947410 I have created a PR to try and implement this -> https://github.com/jesseduffield/lazygit/pull/1709

I had to use Alt+f to scroll up a page and Alt+b to scroll down a page since I was not able to figure out how to use other modifiers like Shift or Ctrl

jesseduffield commented 2 years ago

So how do you like Go after learning it?

@sdegutis I'm fairly critical of Go to be honest. I've had enough exposure to Rust to feel that Go is sorely lacking in features. Especially when it comes to code re-use, Go just doesn't have much (if anything) to offer due to lack of both inheritance, mixins/traits, and generics (though generics are on the way). I've done a fairly extensive writeup on my thoughts here

@glendsoza Nice one. I've left a comment on that PR. As commented, there's another PR in flight that's going to make it easier to use shift/ctrl modifiers, and hopefully that'll let us use pgdown/pgup.

thesoftwarephilosopher commented 2 years ago

@jesseduffield I agree, I came to that conclusion maybe 7 years ago. I tried Rust out and I guess it's fine if you need low-level and lightning-fast and ultra-safe code, which I do 0% of the time (and apparently neither does VS Code but it works well enough). I'm going to try my hand at a quick Electron git client in TypeScript one of these days using simple-git.

zhengpd commented 2 years ago

I also vote for hotkeys for whole page scrolling. C-f/C-b (like manpage) and C-u/C-d (like tig) both feels right to me. It should be configurable so there should just be a default one and let users choose what they like.