1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-13 01:30:53 +02:00

add switch-to-view methods

This commit is contained in:
Jesse Duffield
2022-12-26 16:49:54 +11:00
parent 9a6f21ce42
commit c841ba8237
22 changed files with 77 additions and 51 deletions

View File

@ -45,26 +45,56 @@ func (self *Input) SwitchToStatusWindow() {
self.assert.CurrentWindowName("status")
}
// switch to status window and assert that the status view is on top
func (self *Input) SwitchToStatusView() {
self.SwitchToStatusWindow()
self.assert.CurrentView().Name("status")
}
func (self *Input) SwitchToFilesWindow() {
self.press(self.keys.Universal.JumpToBlock[1])
self.assert.CurrentWindowName("files")
}
// switch to files window and assert that the files view is on top
func (self *Input) SwitchToFilesView() {
self.SwitchToFilesWindow()
self.assert.CurrentView().Name("files")
}
func (self *Input) SwitchToBranchesWindow() {
self.press(self.keys.Universal.JumpToBlock[2])
self.assert.CurrentWindowName("localBranches")
}
// switch to branches window and assert that the branches view is on top
func (self *Input) SwitchToBranchesView() {
self.SwitchToBranchesWindow()
self.assert.CurrentView().Name("localBranches")
}
func (self *Input) SwitchToCommitsWindow() {
self.press(self.keys.Universal.JumpToBlock[3])
self.assert.CurrentWindowName("commits")
}
// switch to commits window and assert that the commits view is on top
func (self *Input) SwitchToCommitsView() {
self.SwitchToCommitsWindow()
self.assert.CurrentView().Name("commits")
}
func (self *Input) SwitchToStashWindow() {
self.press(self.keys.Universal.JumpToBlock[4])
self.assert.CurrentWindowName("stash")
}
// switch to stash window and assert that the stash view is on top
func (self *Input) SwitchToStashView() {
self.SwitchToStashWindow()
self.assert.CurrentView().Name("stash")
}
func (self *Input) Type(content string) {
for _, char := range content {
self.press(string(char))