From 3ada4dde12571d794a7415e4516e457961e01c45 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Thu, 18 Aug 2022 23:05:30 +0900 Subject: [PATCH 1/4] fix: fix initial scroll position of edit box --- pkg/gui/confirmation_panel.go | 2 ++ pkg/gui/view_helpers.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go index 1ad724ad5..16bc551be 100644 --- a/pkg/gui/confirmation_panel.go +++ b/pkg/gui/confirmation_panel.go @@ -122,6 +122,7 @@ func (gui *Gui) prepareConfirmationPanel( gui.Views.Confirmation.Wrap = !opts.Editable gui.Views.Confirmation.FgColor = theme.GocuiDefaultTextColor gui.Views.Confirmation.Mask = runeForMask(opts.Mask) + _ = gui.Views.Confirmation.SetOrigin(0, 0) gui.findSuggestions = opts.FindSuggestionsFunc if opts.FindSuggestionsFunc != nil { @@ -133,6 +134,7 @@ func (gui *Gui) prepareConfirmationPanel( suggestionsView.Title = fmt.Sprintf(gui.c.Tr.SuggestionsTitle, gui.c.UserConfig.Keybinding.Universal.TogglePanel) } + gui.resizeConfirmationPanel() return nil } diff --git a/pkg/gui/view_helpers.go b/pkg/gui/view_helpers.go index 40bc2fa02..713639251 100644 --- a/pkg/gui/view_helpers.go +++ b/pkg/gui/view_helpers.go @@ -87,7 +87,8 @@ func (gui *Gui) resizeConfirmationPanel() { } panelWidth := gui.getConfirmationPanelWidth() prompt := gui.Views.Confirmation.Buffer() - panelHeight := gui.getMessageHeight(true, prompt, panelWidth) + suggestionsViewHeight + wrap := !gui.Views.Confirmation.Editable + panelHeight := gui.getMessageHeight(wrap, prompt, panelWidth) + suggestionsViewHeight x0, y0, x1, y1 := gui.getConfirmationPanelDimensionsAux(panelWidth, panelHeight) confirmationViewBottom := y1 - suggestionsViewHeight _, _ = gui.g.SetView(gui.Views.Confirmation.Name(), x0, y0, x1, confirmationViewBottom, 0) From a67a08eeac3d648966caacfb00e59d1b2facaf27 Mon Sep 17 00:00:00 2001 From: Konstantin Mikhailov Date: Wed, 24 Aug 2022 11:00:57 +1000 Subject: [PATCH 2/4] Fix open commit in browser for some Gitlab repos --- pkg/commands/hosting_service/definitions.go | 2 +- .../hosting_service/hosting_service_test.go | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/pkg/commands/hosting_service/definitions.go b/pkg/commands/hosting_service/definitions.go index c53ee0507..39a554c3f 100644 --- a/pkg/commands/hosting_service/definitions.go +++ b/pkg/commands/hosting_service/definitions.go @@ -3,7 +3,7 @@ package hosting_service // if you want to make a custom regex for a given service feel free to test it out // at regoio.herokuapp.com var defaultUrlRegexStrings = []string{ - `^(?:https?|ssh)://.*/(?P.*)/(?P.*?)(?:\.git)?$`, + `^(?:https?|ssh)://[^/]+/(?P.*)/(?P.*?)(?:\.git)?$`, `^git@.*:(?P.*)/(?P.*?)(?:\.git)?$`, } var defaultRepoURLTemplate = "https://{{.webDomain}}/{{.owner}}/{{.repo}}" diff --git a/pkg/commands/hosting_service/hosting_service_test.go b/pkg/commands/hosting_service/hosting_service_test.go index b92daa98d..ded310c85 100644 --- a/pkg/commands/hosting_service/hosting_service_test.go +++ b/pkg/commands/hosting_service/hosting_service_test.go @@ -47,6 +47,15 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Fsum-operation?expand=1", url) }, }, + { + testName: "Opens a link to new pull request on github with https remote url", + from: "feature/sum-operation", + remoteUrl: "https://github.com/peter/calculator.git", + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Fsum-operation?expand=1", url) + }, + }, { testName: "Opens a link to new pull request on bitbucket with specific target branch", from: "feature/profile-page/avatar", @@ -77,6 +86,16 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Foperations...feature%2Fsum-operation?expand=1", url) }, }, + { + testName: "Opens a link to new pull request on github with https remote url with specific target branch", + from: "feature/sum-operation", + to: "feature/operations", + remoteUrl: "https://github.com/peter/calculator.git", + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://github.com/peter/calculator/compare/feature%2Foperations...feature%2Fsum-operation?expand=1", url) + }, + }, { testName: "Opens a link to new pull request on gitlab", from: "feature/ui", @@ -95,6 +114,15 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fui", url) }, }, + { + testName: "Opens a link to new pull request on gitlab with https remote url in nested groups", + from: "feature/ui", + remoteUrl: "https://gitlab.com/peter/public/calculator.git", + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fui", url) + }, + }, { testName: "Opens a link to new pull request on gitlab with specific target branch", from: "feature/commit-ui", @@ -115,6 +143,16 @@ func TestGetPullRequestURL(t *testing.T) { assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fcommit-ui&merge_request[target_branch]=epic%2Fui", url) }, }, + { + testName: "Opens a link to new pull request on gitlab with https remote url with specific target branch in nested groups", + from: "feature/commit-ui", + to: "epic/ui", + remoteUrl: "https://gitlab.com/peter/public/calculator.git", + test: func(url string, err error) { + assert.NoError(t, err) + assert.Equal(t, "https://gitlab.com/peter/public/calculator/merge_requests/new?merge_request[source_branch]=feature%2Fcommit-ui&merge_request[target_branch]=epic%2Fui", url) + }, + }, { testName: "Opens a link to new pull request on bitbucket with a custom SSH username", from: "feature/profile-page", From d78d694959f82c611d63317248202f39351d5910 Mon Sep 17 00:00:00 2001 From: Abirdcfly Date: Tue, 30 Aug 2022 13:23:37 +0800 Subject: [PATCH 3/4] chore: remove duplicate word in comments Signed-off-by: Abirdcfly --- pkg/commands/models/file.go | 2 +- pkg/commands/oscommands/cmd_obj_runner.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/commands/models/file.go b/pkg/commands/models/file.go index 4589f91fa..eeb540def 100644 --- a/pkg/commands/models/file.go +++ b/pkg/commands/models/file.go @@ -44,7 +44,7 @@ func (f *File) Names() []string { return result } -// returns true if the file names are the same or if a a file rename includes the filename of the other +// returns true if the file names are the same or if a file rename includes the filename of the other func (f *File) Matches(f2 *File) bool { return utils.StringArraysOverlap(f.Names(), f2.Names()) } diff --git a/pkg/commands/oscommands/cmd_obj_runner.go b/pkg/commands/oscommands/cmd_obj_runner.go index 8311f9eb7..ba1489fe6 100644 --- a/pkg/commands/oscommands/cmd_obj_runner.go +++ b/pkg/commands/oscommands/cmd_obj_runner.go @@ -147,7 +147,7 @@ func (self *cmdObjRunner) runWithCredentialHandling(cmdObj ICmdObj) error { promptFn = failPromptFn case NONE: // we should never land here - return errors.New("runWithCredentialHandling called but cmdObj does not have a a credential strategy") + return errors.New("runWithCredentialHandling called but cmdObj does not have a credential strategy") } return self.runAndDetectCredentialRequest(cmdObj, promptFn) From 25c4aa532e892c885bbabdfa0a4e3b4956180160 Mon Sep 17 00:00:00 2001 From: README-bot Date: Thu, 1 Sep 2022 05:42:26 +0000 Subject: [PATCH 4/4] Updated README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8e0785fb..ff2a7faff 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ A simple terminal UI for git commands, written in Go with the [gocui](https://gi

- +

## Elevator Pitch