mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
Fix refreshing custom patch view when adding first file to custom patch (#3266)
Fixes #3258.
This commit is contained in:
commit
24e79a057c
@ -66,7 +66,7 @@ func (self inlineStatusHelperTask) Continue() {
|
|||||||
func (self *InlineStatusHelper) WithInlineStatus(opts InlineStatusOpts, f func(gocui.Task) error) {
|
func (self *InlineStatusHelper) WithInlineStatus(opts InlineStatusOpts, f func(gocui.Task) error) {
|
||||||
context := self.c.ContextForKey(opts.ContextKey).(types.IListContext)
|
context := self.c.ContextForKey(opts.ContextKey).(types.IListContext)
|
||||||
view := context.GetView()
|
view := context.GetView()
|
||||||
visible := view.Visible && self.windowHelper.TopViewInWindow(context.GetWindowName()) == view
|
visible := view.Visible && self.windowHelper.TopViewInWindow(context.GetWindowName(), false) == view
|
||||||
if visible && context.IsItemVisible(opts.Item) {
|
if visible && context.IsItemVisible(opts.Item) {
|
||||||
self.c.OnWorker(func(task gocui.Task) {
|
self.c.OnWorker(func(task gocui.Task) {
|
||||||
self.start(opts)
|
self.start(opts)
|
||||||
|
@ -90,7 +90,7 @@ func (self *WindowHelper) MoveToTopOfWindow(context types.Context) {
|
|||||||
|
|
||||||
window := context.GetWindowName()
|
window := context.GetWindowName()
|
||||||
|
|
||||||
topView := self.TopViewInWindow(window)
|
topView := self.TopViewInWindow(window, true)
|
||||||
|
|
||||||
if topView != nil && view.Name() != topView.Name() {
|
if topView != nil && view.Name() != topView.Name() {
|
||||||
if err := self.c.GocuiGui().SetViewOnTopOf(view.Name(), topView.Name()); err != nil {
|
if err := self.c.GocuiGui().SetViewOnTopOf(view.Name(), topView.Name()); err != nil {
|
||||||
@ -99,14 +99,14 @@ func (self *WindowHelper) MoveToTopOfWindow(context types.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *WindowHelper) TopViewInWindow(windowName string) *gocui.View {
|
func (self *WindowHelper) TopViewInWindow(windowName string, includeInvisibleViews bool) *gocui.View {
|
||||||
// now I need to find all views in that same window, via contexts. And I guess then I need to find the index of the highest view in that list.
|
// now I need to find all views in that same window, via contexts. And I guess then I need to find the index of the highest view in that list.
|
||||||
viewNamesInWindow := self.viewNamesInWindow(windowName)
|
viewNamesInWindow := self.viewNamesInWindow(windowName)
|
||||||
|
|
||||||
// The views list is ordered highest-last, so we're grabbing the last view of the window
|
// The views list is ordered highest-last, so we're grabbing the last view of the window
|
||||||
var topView *gocui.View
|
var topView *gocui.View
|
||||||
for _, currentView := range self.c.GocuiGui().Views() {
|
for _, currentView := range self.c.GocuiGui().Views() {
|
||||||
if lo.Contains(viewNamesInWindow, currentView.Name()) && currentView.Visible {
|
if lo.Contains(viewNamesInWindow, currentView.Name()) && (currentView.Visible || includeInvisibleViews) {
|
||||||
topView = currentView
|
topView = currentView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func (gui *Gui) moveMainContextToTop(context types.Context) {
|
|||||||
|
|
||||||
view := context.GetView()
|
view := context.GetView()
|
||||||
|
|
||||||
topView := gui.helpers.Window.TopViewInWindow(context.GetWindowName())
|
topView := gui.helpers.Window.TopViewInWindow(context.GetWindowName(), true)
|
||||||
|
|
||||||
if topView != nil && topView != view {
|
if topView != nil && topView != view {
|
||||||
// We need to copy the content to avoid a flicker effect: If we're flicking
|
// We need to copy the content to avoid a flicker effect: If we're flicking
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
var SelectAllFiles = NewIntegrationTest(NewIntegrationTestArgs{
|
||||||
Description: "All all files of a commit to a custom patch with the 'a' keybinding",
|
Description: "Add all files of a commit to a custom patch with the 'a' keybinding",
|
||||||
ExtraCmdArgs: []string{},
|
ExtraCmdArgs: []string{},
|
||||||
Skip: false,
|
Skip: false,
|
||||||
SetupConfig: func(config *config.AppConfig) {},
|
SetupConfig: func(config *config.AppConfig) {},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user