-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[WIP] GUI: Rework part 1 #276
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
Conversation
pkg/gui/app_status_manager.go
Outdated
| name string | ||
| statusType string | ||
| duration int | ||
| name string `json:"name"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field name has json tag but is not exported
pkg/gui/app_status_manager.go
Outdated
| statusType string | ||
| duration int | ||
| name string `json:"name"` | ||
| statusType string `json:"status_type"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field statusType has json tag but is not exported
pkg/gui/app_status_manager.go
Outdated
| duration int | ||
| name string `json:"name"` | ||
| statusType string `json:"status_type"` | ||
| duration int `json:"duration"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct field duration has json tag but is not exported
Codecov Report
@@ Coverage Diff @@
## master #276 +/- ##
==========================================
+ Coverage 92.4% 92.42% +0.01%
==========================================
Files 9 9
Lines 1553 1557 +4
==========================================
+ Hits 1435 1439 +4
Misses 117 117
Partials 1 1
Continue to review full report at Codecov.
|
* Removed g parameter * Moved to top * Added error stuff
pkg/gui/branches_panel.go
Outdated
| for _, branch := range gui.State.Branches { | ||
| fmt.Fprintln(v, branch.GetDisplayString()) | ||
| } | ||
| gui.resetOrigin(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.resetOrigin is not checked
pkg/gui/files_panel.go
Outdated
| gui.refreshStatus(g) | ||
| } | ||
| gui.refreshFiles(g) | ||
| gui.refreshFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshFiles is not checked
pkg/gui/gui.go
Outdated
| gui.Updater.CheckForNewUpdate(gui.onBackgroundUpdateCheckFinish, false) | ||
| gui.handleFileSelect(g, filesView) | ||
| gui.refreshFiles(g) | ||
| gui.refreshFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshFiles is not checked
pkg/gui/gui.go
Outdated
| go func() { | ||
| for range time.Tick(interval) { | ||
| function(g) | ||
| function() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of function is not checked
pkg/gui/refresher.go
Outdated
| } | ||
| } | ||
|
|
||
| gui.refreshBranches(gui.g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshBranches is not checked
pkg/gui/refresher.go
Outdated
|
|
||
| gui.refreshBranches(gui.g) | ||
| gui.refreshFiles() | ||
| gui.refreshCommits(gui.g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshCommits is not checked
pkg/gui/files_panel.go
Outdated
| } else { | ||
| gui.closeConfirmationPrompt(g) | ||
| gui.refreshCommits(g) | ||
| gui.refreshCommits() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshCommits is not checked
pkg/gui/files_panel.go
Outdated
| gui.refreshStatus(g) | ||
| } | ||
| gui.refreshFiles(g) | ||
| gui.refreshFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshFiles is not checked
pkg/gui/gui.go
Outdated
| v.FgColor = gocui.ColorWhite | ||
| filesView.FgColor = gocui.ColorWhite | ||
|
|
||
| gui.registerRefresher("files", gui.refreshFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.registerRefresher is not checked
pkg/gui/gui.go
Outdated
| v.Title = gui.Tr.SLocalize("CommitsTitle") | ||
| v.FgColor = gocui.ColorWhite | ||
|
|
||
| gui.registerRefresher("commits", gui.refreshCommits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.registerRefresher is not checked
pkg/gui/gui.go
Outdated
| gui.refreshFiles(g) | ||
| gui.refreshBranches(g) | ||
| gui.refreshCommits(g) | ||
| gui.refreshFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshFiles is not checked
pkg/gui/gui.go
Outdated
| gui.refreshBranches(g) | ||
| gui.refreshCommits(g) | ||
| gui.refreshFiles() | ||
| gui.refreshBranches() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshBranches is not checked
pkg/gui/gui.go
Outdated
| gui.refreshCommits(g) | ||
| gui.refreshFiles() | ||
| gui.refreshBranches() | ||
| gui.refreshCommits() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshCommits is not checked
pkg/gui/branches_panel.go
Outdated
|
|
||
| err := gui.GitCommand.Checkout(branch.Name, true) | ||
| if err != nil { | ||
| gui.createErrorPanel(g, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.createErrorPanel is not checked
pkg/gui/branches_panel.go
Outdated
| return gui.refreshSidePanels(g) | ||
| }) | ||
|
|
||
| gui.createPromptPanel(g, v, gui.Tr.SLocalize("BranchName")+":", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.createPromptPanel is not checked
pkg/gui/files_panel.go
Outdated
|
|
||
| err := gui.GitCommand.Pull() | ||
| if err != nil { | ||
| gui.createErrorPanel(gui.g, err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.createErrorPanel is not checked
pkg/gui/merge_panel.go
Outdated
| } | ||
| gui.stageSelectedFile(g) | ||
| gui.refreshFiles(g) | ||
| gui.refreshFiles() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshFiles is not checked
pkg/gui/gui.go
Outdated
| gui.SubProcess.Stdin = os.Stdin | ||
| gui.SubProcess.Stdout = os.Stdout | ||
| gui.SubProcess.Stderr = os.Stderr | ||
| gui.SubProcess.Run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.SubProcess.Run is not checked
Added a lot of if statements Removed view specific render options functions since we now have a global one. Removed a lot of g passing
pkg/gui/files_panel.go
Outdated
| gui.createMessagePanel(g, v, "", gui.Tr.SLocalize("MergeAborted")) | ||
| gui.refreshStatus(g) | ||
| return gui.refreshFiles(g) | ||
| gui.refreshStatus() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of gui.refreshStatus is not checked
pkg/gui/confirmation_panel.go
Outdated
| return err | ||
| } | ||
|
|
||
| err = gui.returnFocus(gui.g, view) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove gui.g from this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost done with view_handlers.go then this will be removed
|
@jesseduffield It should all be good now |
andreimc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few points if we want to get this merged in:
- Too much whitespace around fns
- Don't log on each error just bubble up errors and log at the top
- naming is a bit hard to follow I can't understand what vv is in most cases
- prefer
if err := function(gui.g, v); err != nil {vs more verbose format
Good points:
- gui.g is great vs passing g in functions
- +1 on the docs
|
Seem like fair points, could any of u @jesseduffield @andreimc help me out with changing some thing, kinda busy with work myself atm. |
|
Sure I'll jump onto this tomorrow :) |
| // In case something goes wrong it returns an error | ||
| func (gui *Gui) handleBranchPress(g *gocui.Gui, v *gocui.View) error { | ||
| v, err := gui.g.View("branches") | ||
| branchesView, err := gui.g.View("branches") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think v should be used here instead since it will always be the branches view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm am I right in thinking we can just use the v that gets passed in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, since the menu special case got solved, this v will always be branches
|
I pushed a commit that has aligned a few panels (files panel, branches panel, commits panel, and a couple others iirc) with the structure I'm looking for |
|
also I've noticed that the application is slow to quit on this branch. I'm not sure what might be causing that |
|
I dont seem to have that problem, how bad is it |
|
about 2 seconds of latency |
|
Going to break this up into smaller pr's |
Uh oh!
There was an error while loading. Please reload this page.