mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-08 23:56:15 +02:00
rename merging context to mergeConflicts
This commit is contained in:
parent
cd2c01d1cf
commit
445a625b56
@ -106,7 +106,7 @@ func localisedTitle(tr *i18n.TranslationSet, str string) string {
|
|||||||
"information": tr.InformationTitle,
|
"information": tr.InformationTitle,
|
||||||
"main": tr.NormalTitle,
|
"main": tr.NormalTitle,
|
||||||
"patchBuilding": tr.PatchBuildingTitle,
|
"patchBuilding": tr.PatchBuildingTitle,
|
||||||
"merging": tr.MergingTitle,
|
"mergeConflicts": tr.MergingTitle,
|
||||||
"staging": tr.StagingTitle,
|
"staging": tr.StagingTitle,
|
||||||
"menu": tr.MenuTitle,
|
"menu": tr.MenuTitle,
|
||||||
"search": tr.SearchTitle,
|
"search": tr.SearchTitle,
|
||||||
|
@ -23,7 +23,7 @@ const (
|
|||||||
STAGING_SECONDARY_CONTEXT_KEY types.ContextKey = "stagingSecondary"
|
STAGING_SECONDARY_CONTEXT_KEY types.ContextKey = "stagingSecondary"
|
||||||
PATCH_BUILDING_MAIN_CONTEXT_KEY types.ContextKey = "patchBuilding"
|
PATCH_BUILDING_MAIN_CONTEXT_KEY types.ContextKey = "patchBuilding"
|
||||||
PATCH_BUILDING_SECONDARY_CONTEXT_KEY types.ContextKey = "patchBuildingSecondary"
|
PATCH_BUILDING_SECONDARY_CONTEXT_KEY types.ContextKey = "patchBuildingSecondary"
|
||||||
MERGING_MAIN_CONTEXT_KEY types.ContextKey = "merging"
|
MERGE_CONFLICTS_CONTEXT_KEY types.ContextKey = "mergeConflicts"
|
||||||
|
|
||||||
// these shouldn't really be needed for anything but I'm giving them unique keys nonetheless
|
// these shouldn't really be needed for anything but I'm giving them unique keys nonetheless
|
||||||
OPTIONS_CONTEXT_KEY types.ContextKey = "options"
|
OPTIONS_CONTEXT_KEY types.ContextKey = "options"
|
||||||
@ -60,7 +60,7 @@ var AllContextKeys = []types.ContextKey{
|
|||||||
STAGING_SECONDARY_CONTEXT_KEY,
|
STAGING_SECONDARY_CONTEXT_KEY,
|
||||||
PATCH_BUILDING_MAIN_CONTEXT_KEY,
|
PATCH_BUILDING_MAIN_CONTEXT_KEY,
|
||||||
PATCH_BUILDING_SECONDARY_CONTEXT_KEY,
|
PATCH_BUILDING_SECONDARY_CONTEXT_KEY,
|
||||||
MERGING_MAIN_CONTEXT_KEY,
|
MERGE_CONFLICTS_CONTEXT_KEY,
|
||||||
|
|
||||||
MENU_CONTEXT_KEY,
|
MENU_CONTEXT_KEY,
|
||||||
CONFIRMATION_CONTEXT_KEY,
|
CONFIRMATION_CONTEXT_KEY,
|
||||||
@ -93,7 +93,7 @@ type ContextTree struct {
|
|||||||
StagingSecondary *PatchExplorerContext
|
StagingSecondary *PatchExplorerContext
|
||||||
CustomPatchBuilder *PatchExplorerContext
|
CustomPatchBuilder *PatchExplorerContext
|
||||||
CustomPatchBuilderSecondary types.Context
|
CustomPatchBuilderSecondary types.Context
|
||||||
Merging types.Context
|
MergeConflicts *MergeConflictsContext
|
||||||
Confirmation types.Context
|
Confirmation types.Context
|
||||||
CommitMessage types.Context
|
CommitMessage types.Context
|
||||||
CommandLog types.Context
|
CommandLog types.Context
|
||||||
@ -127,7 +127,7 @@ func (self *ContextTree) Flatten() []types.Context {
|
|||||||
self.Confirmation,
|
self.Confirmation,
|
||||||
self.CommitMessage,
|
self.CommitMessage,
|
||||||
|
|
||||||
self.Merging,
|
self.MergeConflicts,
|
||||||
self.StagingSecondary,
|
self.StagingSecondary,
|
||||||
self.Staging,
|
self.Staging,
|
||||||
self.CustomPatchBuilderSecondary,
|
self.CustomPatchBuilderSecondary,
|
||||||
|
63
pkg/gui/context/merge_conflicts_context.go
Normal file
63
pkg/gui/context/merge_conflicts_context.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package context
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/gocui"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MergeConflictsContext struct {
|
||||||
|
types.Context
|
||||||
|
viewModel *ConflictsViewModel
|
||||||
|
c *types.HelperCommon
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConflictsViewModel struct {
|
||||||
|
state *mergeconflicts.State
|
||||||
|
|
||||||
|
// userVerticalScrolling tells us if the user has started scrolling through the file themselves
|
||||||
|
// in which case we won't auto-scroll to a conflict.
|
||||||
|
userVerticalScrolling bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMergeConflictsContext(
|
||||||
|
view *gocui.View,
|
||||||
|
|
||||||
|
opts ContextCallbackOpts,
|
||||||
|
|
||||||
|
c *types.HelperCommon,
|
||||||
|
getOptionsMap func() map[string]string,
|
||||||
|
) *MergeConflictsContext {
|
||||||
|
viewModel := &ConflictsViewModel{
|
||||||
|
state: mergeconflicts.NewState(),
|
||||||
|
userVerticalScrolling: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
return &MergeConflictsContext{
|
||||||
|
viewModel: viewModel,
|
||||||
|
Context: NewSimpleContext(
|
||||||
|
NewBaseContext(NewBaseContextOpts{
|
||||||
|
Kind: types.MAIN_CONTEXT,
|
||||||
|
View: view,
|
||||||
|
WindowName: "main",
|
||||||
|
Key: MERGE_CONFLICTS_CONTEXT_KEY,
|
||||||
|
OnGetOptionsMap: getOptionsMap,
|
||||||
|
Focusable: true,
|
||||||
|
}),
|
||||||
|
opts,
|
||||||
|
),
|
||||||
|
c: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsContext) SetUserScrolling(isScrolling bool) {
|
||||||
|
self.viewModel.userVerticalScrolling = isScrolling
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsContext) IsUserScrolling() bool {
|
||||||
|
return self.viewModel.userVerticalScrolling
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsContext) State() *mergeconflicts.State {
|
||||||
|
return self.viewModel.state
|
||||||
|
}
|
@ -10,7 +10,7 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
Global: context.NewSimpleContext(
|
Global: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
Kind: types.GLOBAL_CONTEXT,
|
Kind: types.GLOBAL_CONTEXT,
|
||||||
View: nil,
|
View: nil, // TODO: see if this breaks anything
|
||||||
WindowName: "",
|
WindowName: "",
|
||||||
Key: context.GLOBAL_CONTEXT_KEY,
|
Key: context.GLOBAL_CONTEXT_KEY,
|
||||||
Focusable: false,
|
Focusable: false,
|
||||||
@ -158,27 +158,22 @@ func (gui *Gui) contextTree() *context.ContextTree {
|
|||||||
}),
|
}),
|
||||||
context.ContextCallbackOpts{},
|
context.ContextCallbackOpts{},
|
||||||
),
|
),
|
||||||
Merging: context.NewSimpleContext(
|
MergeConflicts: context.NewMergeConflictsContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
gui.Views.MergeConflicts,
|
||||||
Kind: types.MAIN_CONTEXT,
|
|
||||||
View: gui.Views.Merging,
|
|
||||||
WindowName: "main",
|
|
||||||
Key: context.MERGING_MAIN_CONTEXT_KEY,
|
|
||||||
OnGetOptionsMap: gui.getMergingOptions,
|
|
||||||
Focusable: true,
|
|
||||||
}),
|
|
||||||
context.ContextCallbackOpts{
|
context.ContextCallbackOpts{
|
||||||
OnFocus: OnFocusWrapper(func() error {
|
OnFocus: OnFocusWrapper(func() error {
|
||||||
gui.Views.Merging.Wrap = false
|
gui.Views.MergeConflicts.Wrap = false
|
||||||
|
|
||||||
return gui.renderConflictsWithLock(true)
|
return gui.renderConflictsWithLock(true)
|
||||||
}),
|
}),
|
||||||
OnFocusLost: func(types.OnFocusLostOpts) error {
|
OnFocusLost: func(types.OnFocusLostOpts) error {
|
||||||
gui.Views.Merging.Wrap = true
|
gui.Views.MergeConflicts.Wrap = true
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
gui.c,
|
||||||
|
gui.getMergingOptions,
|
||||||
),
|
),
|
||||||
Confirmation: context.NewSimpleContext(
|
Confirmation: context.NewSimpleContext(
|
||||||
context.NewBaseContext(context.NewBaseContextOpts{
|
context.NewBaseContext(context.NewBaseContextOpts{
|
||||||
|
@ -22,7 +22,7 @@ func (gui *Gui) resetControllers() {
|
|||||||
model,
|
model,
|
||||||
)
|
)
|
||||||
|
|
||||||
rebaseHelper := helpers.NewMergeAndRebaseHelper(helperCommon, gui.State.Contexts, gui.git, gui.takeOverMergeConflictScrolling, refsHelper)
|
rebaseHelper := helpers.NewMergeAndRebaseHelper(helperCommon, gui.State.Contexts, gui.git, refsHelper)
|
||||||
suggestionsHelper := helpers.NewSuggestionsHelper(helperCommon, model, gui.refreshSuggestions)
|
suggestionsHelper := helpers.NewSuggestionsHelper(helperCommon, model, gui.refreshSuggestions)
|
||||||
gui.helpers = &helpers.Helpers{
|
gui.helpers = &helpers.Helpers{
|
||||||
Refs: refsHelper,
|
Refs: refsHelper,
|
||||||
|
@ -161,7 +161,7 @@ func (self *FilesController) GetMouseKeybindings(opts types.KeybindingsOpts) []*
|
|||||||
FocusedView: self.context().GetViewName(),
|
FocusedView: self.context().GetViewName(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: gocui.MouseLeft,
|
Key: gocui.MouseLeft,
|
||||||
Handler: self.onClickMain,
|
Handler: self.onClickMain,
|
||||||
FocusedView: self.context().GetViewName(),
|
FocusedView: self.context().GetViewName(),
|
||||||
@ -269,7 +269,7 @@ func (self *FilesController) pressWithLock(node *filetree.FileNode) error {
|
|||||||
file := node.File
|
file := node.File
|
||||||
|
|
||||||
if file.HasInlineMergeConflicts {
|
if file.HasInlineMergeConflicts {
|
||||||
return self.c.PushContext(self.contexts.Merging)
|
return self.c.PushContext(self.contexts.MergeConflicts)
|
||||||
}
|
}
|
||||||
|
|
||||||
if file.HasUnstagedChanges {
|
if file.HasUnstagedChanges {
|
||||||
|
@ -17,7 +17,6 @@ type MergeAndRebaseHelper struct {
|
|||||||
c *types.HelperCommon
|
c *types.HelperCommon
|
||||||
contexts *context.ContextTree
|
contexts *context.ContextTree
|
||||||
git *commands.GitCommand
|
git *commands.GitCommand
|
||||||
takeOverMergeConflictScrolling func()
|
|
||||||
refsHelper *RefsHelper
|
refsHelper *RefsHelper
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,14 +24,12 @@ func NewMergeAndRebaseHelper(
|
|||||||
c *types.HelperCommon,
|
c *types.HelperCommon,
|
||||||
contexts *context.ContextTree,
|
contexts *context.ContextTree,
|
||||||
git *commands.GitCommand,
|
git *commands.GitCommand,
|
||||||
takeOverMergeConflictScrolling func(),
|
|
||||||
refsHelper *RefsHelper,
|
refsHelper *RefsHelper,
|
||||||
) *MergeAndRebaseHelper {
|
) *MergeAndRebaseHelper {
|
||||||
return &MergeAndRebaseHelper{
|
return &MergeAndRebaseHelper{
|
||||||
c: c,
|
c: c,
|
||||||
contexts: contexts,
|
contexts: contexts,
|
||||||
git: git,
|
git: git,
|
||||||
takeOverMergeConflictScrolling: takeOverMergeConflictScrolling,
|
|
||||||
refsHelper: refsHelper,
|
refsHelper: refsHelper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,7 +186,7 @@ func (self *MergeAndRebaseHelper) workingTreeStateNoun() string {
|
|||||||
|
|
||||||
// PromptToContinueRebase asks the user if they want to continue the rebase/merge that's in progress
|
// PromptToContinueRebase asks the user if they want to continue the rebase/merge that's in progress
|
||||||
func (self *MergeAndRebaseHelper) PromptToContinueRebase() error {
|
func (self *MergeAndRebaseHelper) PromptToContinueRebase() error {
|
||||||
self.takeOverMergeConflictScrolling()
|
self.contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
|
|
||||||
return self.c.Confirm(types.ConfirmOpts{
|
return self.c.Confirm(types.ConfirmOpts{
|
||||||
Title: "continue",
|
Title: "continue",
|
||||||
|
54
pkg/gui/controllers/merge_conflicts_controller.go
Normal file
54
pkg/gui/controllers/merge_conflicts_controller.go
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MergeConflictsController struct {
|
||||||
|
baseController
|
||||||
|
*controllerCommon
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ types.IController = &MergeConflictsController{}
|
||||||
|
|
||||||
|
func NewMergeConflictsController(
|
||||||
|
common *controllerCommon,
|
||||||
|
) *MergeConflictsController {
|
||||||
|
return &MergeConflictsController{
|
||||||
|
baseController: baseController{},
|
||||||
|
controllerCommon: common,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
||||||
|
bindings := []*types.Binding{
|
||||||
|
{
|
||||||
|
Key: opts.GetKey(opts.Config.Universal.Edit),
|
||||||
|
Handler: self.EditFile,
|
||||||
|
Description: self.c.Tr.LcEditFile,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return bindings
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsController) Context() types.Context {
|
||||||
|
return self.context()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsController) context() *context.MergeConflictsContext {
|
||||||
|
return self.contexts.MergeConflicts
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsController) EditFile() error {
|
||||||
|
lineNumber := self.context().State().GetSelectedLine()
|
||||||
|
return self.helpers.Files.EditFileAtLine(self.context().State().GetPath(), lineNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (self *MergeConflictsController) withMergeConflictLock(f func() error) error {
|
||||||
|
self.context().State().Lock()
|
||||||
|
defer self.context().State().Unlock()
|
||||||
|
|
||||||
|
return f()
|
||||||
|
}
|
@ -93,7 +93,7 @@ func (gui *Gui) filesRenderToMain() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) onFocusFile() error {
|
func (gui *Gui) onFocusFile() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ func (gui *Gui) scrollDownView(view *gocui.View) {
|
|||||||
|
|
||||||
func (gui *Gui) scrollUpMain() error {
|
func (gui *Gui) scrollUpMain() error {
|
||||||
if gui.renderingConflicts() {
|
if gui.renderingConflicts() {
|
||||||
gui.State.Panels.Merging.UserVerticalScrolling = true
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
var view *gocui.View
|
var view *gocui.View
|
||||||
@ -93,7 +93,7 @@ func (gui *Gui) scrollUpMain() error {
|
|||||||
|
|
||||||
func (gui *Gui) scrollDownMain() error {
|
func (gui *Gui) scrollDownMain() error {
|
||||||
if gui.renderingConflicts() {
|
if gui.renderingConflicts() {
|
||||||
gui.State.Panels.Merging.UserVerticalScrolling = true
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
var view *gocui.View
|
var view *gocui.View
|
||||||
|
@ -19,7 +19,6 @@ import (
|
|||||||
"github.com/jesseduffield/lazygit/pkg/config"
|
"github.com/jesseduffield/lazygit/pkg/config"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
"github.com/jesseduffield/lazygit/pkg/gui/context"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
"github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/cherrypicking"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/diffing"
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/modes/filtering"
|
"github.com/jesseduffield/lazygit/pkg/gui/modes/filtering"
|
||||||
@ -169,7 +168,6 @@ type GuiRepoState struct {
|
|||||||
Suggestions []*types.Suggestion
|
Suggestions []*types.Suggestion
|
||||||
|
|
||||||
Updating bool
|
Updating bool
|
||||||
Panels *panelStates
|
|
||||||
SplitMainPanel bool
|
SplitMainPanel bool
|
||||||
LimitCommits bool
|
LimitCommits bool
|
||||||
|
|
||||||
@ -199,20 +197,6 @@ type GuiRepoState struct {
|
|||||||
CurrentPopupOpts *types.CreatePopupPanelOpts
|
CurrentPopupOpts *types.CreatePopupPanelOpts
|
||||||
}
|
}
|
||||||
|
|
||||||
type MergingPanelState struct {
|
|
||||||
*mergeconflicts.State
|
|
||||||
|
|
||||||
// UserVerticalScrolling tells us if the user has started scrolling through the file themselves
|
|
||||||
// in which case we won't auto-scroll to a conflict.
|
|
||||||
UserVerticalScrolling bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// as we move things to the new context approach we're going to eventually
|
|
||||||
// remove this struct altogether and store this state on the contexts.
|
|
||||||
type panelStates struct {
|
|
||||||
Merging *MergingPanelState
|
|
||||||
}
|
|
||||||
|
|
||||||
type searchingState struct {
|
type searchingState struct {
|
||||||
view *gocui.View
|
view *gocui.View
|
||||||
isSearching bool
|
isSearching bool
|
||||||
@ -299,13 +283,6 @@ func (gui *Gui) resetState(startArgs types.StartArgs, reuseState bool) {
|
|||||||
BisectInfo: git_commands.NewNullBisectInfo(),
|
BisectInfo: git_commands.NewNullBisectInfo(),
|
||||||
FilesTrie: patricia.NewTrie(),
|
FilesTrie: patricia.NewTrie(),
|
||||||
},
|
},
|
||||||
|
|
||||||
Panels: &panelStates{
|
|
||||||
Merging: &MergingPanelState{
|
|
||||||
State: mergeconflicts.NewState(),
|
|
||||||
UserVerticalScrolling: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Modes: &types.Modes{
|
Modes: &types.Modes{
|
||||||
Filtering: filtering.New(startArgs.FilterPath),
|
Filtering: filtering.New(startArgs.FilterPath),
|
||||||
CherryPicking: cherrypicking.New(),
|
CherryPicking: cherrypicking.New(),
|
||||||
@ -438,7 +415,7 @@ var RuneReplacements = map[rune]string{
|
|||||||
graph.CommitSymbol: "o",
|
graph.CommitSymbol: "o",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) initGocui() (*gocui.Gui, error) {
|
func (gui *Gui) initGocui(headless bool) (*gocui.Gui, error) {
|
||||||
recordEvents := recordingEvents()
|
recordEvents := recordingEvents()
|
||||||
playMode := gocui.NORMAL
|
playMode := gocui.NORMAL
|
||||||
if recordEvents {
|
if recordEvents {
|
||||||
@ -447,7 +424,7 @@ func (gui *Gui) initGocui() (*gocui.Gui, error) {
|
|||||||
playMode = gocui.REPLAYING
|
playMode = gocui.REPLAYING
|
||||||
}
|
}
|
||||||
|
|
||||||
g, err := gocui.NewGui(gocui.OutputTrue, OverlappingEdges, playMode, headless(), RuneReplacements)
|
g, err := gocui.NewGui(gocui.OutputTrue, OverlappingEdges, playMode, headless, RuneReplacements)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -496,7 +473,7 @@ func (gui *Gui) viewTabMap() map[string][]context.TabView {
|
|||||||
|
|
||||||
// Run: setup the gui with keybindings and start the mainloop
|
// Run: setup the gui with keybindings and start the mainloop
|
||||||
func (gui *Gui) Run(startArgs types.StartArgs) error {
|
func (gui *Gui) Run(startArgs types.StartArgs) error {
|
||||||
g, err := gui.initGocui()
|
g, err := gui.initGocui(headless())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -326,105 +326,105 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
|||||||
Handler: self.scrollUpSecondary,
|
Handler: self.scrollUpSecondary,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.ScrollLeft),
|
Key: opts.GetKey(opts.Config.Universal.ScrollLeft),
|
||||||
Handler: self.scrollLeftMain,
|
Handler: self.scrollLeftMain,
|
||||||
Description: self.c.Tr.LcScrollLeft,
|
Description: self.c.Tr.LcScrollLeft,
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.ScrollRight),
|
Key: opts.GetKey(opts.Config.Universal.ScrollRight),
|
||||||
Handler: self.scrollRightMain,
|
Handler: self.scrollRightMain,
|
||||||
Description: self.c.Tr.LcScrollRight,
|
Description: self.c.Tr.LcScrollRight,
|
||||||
Tag: "navigation",
|
Tag: "navigation",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||||
Handler: self.handleEscapeMerge,
|
Handler: self.handleEscapeMerge,
|
||||||
Description: self.c.Tr.ReturnToFilesPanel,
|
Description: self.c.Tr.ReturnToFilesPanel,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Files.OpenMergeTool),
|
Key: opts.GetKey(opts.Config.Files.OpenMergeTool),
|
||||||
Handler: self.helpers.WorkingTree.OpenMergeTool,
|
Handler: self.helpers.WorkingTree.OpenMergeTool,
|
||||||
Description: self.c.Tr.LcOpenMergeTool,
|
Description: self.c.Tr.LcOpenMergeTool,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.Select),
|
Key: opts.GetKey(opts.Config.Universal.Select),
|
||||||
Handler: self.handlePickHunk,
|
Handler: self.handlePickHunk,
|
||||||
Description: self.c.Tr.PickHunk,
|
Description: self.c.Tr.PickHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Main.PickBothHunks),
|
Key: opts.GetKey(opts.Config.Main.PickBothHunks),
|
||||||
Handler: self.handlePickAllHunks,
|
Handler: self.handlePickAllHunks,
|
||||||
Description: self.c.Tr.PickAllHunks,
|
Description: self.c.Tr.PickAllHunks,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
|
Key: opts.GetKey(opts.Config.Universal.PrevBlock),
|
||||||
Handler: self.handleSelectPrevConflict,
|
Handler: self.handleSelectPrevConflict,
|
||||||
Description: self.c.Tr.PrevConflict,
|
Description: self.c.Tr.PrevConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.NextBlock),
|
Key: opts.GetKey(opts.Config.Universal.NextBlock),
|
||||||
Handler: self.handleSelectNextConflict,
|
Handler: self.handleSelectNextConflict,
|
||||||
Description: self.c.Tr.NextConflict,
|
Description: self.c.Tr.NextConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
Key: opts.GetKey(opts.Config.Universal.PrevItem),
|
||||||
Handler: self.handleSelectPrevConflictHunk,
|
Handler: self.handleSelectPrevConflictHunk,
|
||||||
Description: self.c.Tr.SelectPrevHunk,
|
Description: self.c.Tr.SelectPrevHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
Key: opts.GetKey(opts.Config.Universal.NextItem),
|
||||||
Handler: self.handleSelectNextConflictHunk,
|
Handler: self.handleSelectNextConflictHunk,
|
||||||
Description: self.c.Tr.SelectNextHunk,
|
Description: self.c.Tr.SelectNextHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
|
Key: opts.GetKey(opts.Config.Universal.PrevBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: self.handleSelectPrevConflict,
|
Handler: self.handleSelectPrevConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
|
Key: opts.GetKey(opts.Config.Universal.NextBlockAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: self.handleSelectNextConflict,
|
Handler: self.handleSelectNextConflict,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
Key: opts.GetKey(opts.Config.Universal.PrevItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: self.handleSelectPrevConflictHunk,
|
Handler: self.handleSelectPrevConflictHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
Key: opts.GetKey(opts.Config.Universal.NextItemAlt),
|
||||||
Modifier: gocui.ModNone,
|
Modifier: gocui.ModNone,
|
||||||
Handler: self.handleSelectNextConflictHunk,
|
Handler: self.handleSelectNextConflictHunk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.Edit),
|
Key: opts.GetKey(opts.Config.Universal.Edit),
|
||||||
Handler: self.handleMergeConflictEditFileAtLine,
|
Handler: self.handleMergeConflictEditFileAtLine,
|
||||||
Description: self.c.Tr.LcEditFile,
|
Description: self.c.Tr.LcEditFile,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
||||||
Handler: self.handleMergeConflictOpenFileAtLine,
|
Handler: self.handleMergeConflictOpenFileAtLine,
|
||||||
Description: self.c.Tr.LcOpenFile,
|
Description: self.c.Tr.LcOpenFile,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ViewName: "merging",
|
ViewName: "mergeConflicts",
|
||||||
Key: opts.GetKey(opts.Config.Universal.Undo),
|
Key: opts.GetKey(opts.Config.Universal.Undo),
|
||||||
Handler: self.handleMergeConflictUndo,
|
Handler: self.handleMergeConflictUndo,
|
||||||
Description: self.c.Tr.LcUndo,
|
Description: self.c.Tr.LcUndo,
|
||||||
|
@ -144,7 +144,7 @@ func (gui *Gui) patchBuildingMainContextPair() MainContextPair {
|
|||||||
|
|
||||||
func (gui *Gui) mergingMainContextPair() MainContextPair {
|
func (gui *Gui) mergingMainContextPair() MainContextPair {
|
||||||
return MainContextPair{
|
return MainContextPair{
|
||||||
main: gui.State.Contexts.Merging,
|
main: gui.State.Contexts.MergeConflicts,
|
||||||
secondary: nil,
|
secondary: nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,38 +14,38 @@ import (
|
|||||||
|
|
||||||
func (gui *Gui) handleSelectPrevConflictHunk() error {
|
func (gui *Gui) handleSelectPrevConflictHunk() error {
|
||||||
return gui.withMergeConflictLock(func() error {
|
return gui.withMergeConflictLock(func() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
gui.State.Panels.Merging.SelectPrevConflictHunk()
|
gui.State.Contexts.MergeConflicts.State().SelectPrevConflictHunk()
|
||||||
return gui.renderConflictsWithFocus()
|
return gui.renderConflictsWithFocus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleSelectNextConflictHunk() error {
|
func (gui *Gui) handleSelectNextConflictHunk() error {
|
||||||
return gui.withMergeConflictLock(func() error {
|
return gui.withMergeConflictLock(func() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
gui.State.Panels.Merging.SelectNextConflictHunk()
|
gui.State.Contexts.MergeConflicts.State().SelectNextConflictHunk()
|
||||||
return gui.renderConflictsWithFocus()
|
return gui.renderConflictsWithFocus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleSelectNextConflict() error {
|
func (gui *Gui) handleSelectNextConflict() error {
|
||||||
return gui.withMergeConflictLock(func() error {
|
return gui.withMergeConflictLock(func() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
gui.State.Panels.Merging.SelectNextConflict()
|
gui.State.Contexts.MergeConflicts.State().SelectNextConflict()
|
||||||
return gui.renderConflictsWithFocus()
|
return gui.renderConflictsWithFocus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleSelectPrevConflict() error {
|
func (gui *Gui) handleSelectPrevConflict() error {
|
||||||
return gui.withMergeConflictLock(func() error {
|
return gui.withMergeConflictLock(func() error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
gui.State.Panels.Merging.SelectPrevConflict()
|
gui.State.Contexts.MergeConflicts.State().SelectPrevConflict()
|
||||||
return gui.renderConflictsWithFocus()
|
return gui.renderConflictsWithFocus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleMergeConflictUndo() error {
|
func (gui *Gui) handleMergeConflictUndo() error {
|
||||||
state := gui.State.Panels.Merging
|
state := gui.State.Contexts.MergeConflicts.State()
|
||||||
|
|
||||||
ok := state.Undo()
|
ok := state.Undo()
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -63,7 +63,7 @@ func (gui *Gui) handleMergeConflictUndo() error {
|
|||||||
|
|
||||||
func (gui *Gui) handlePickHunk() error {
|
func (gui *Gui) handlePickHunk() error {
|
||||||
return gui.withMergeConflictLock(func() error {
|
return gui.withMergeConflictLock(func() error {
|
||||||
ok, err := gui.resolveConflict(gui.State.Panels.Merging.Selection())
|
ok, err := gui.resolveConflict(gui.State.Contexts.MergeConflicts.State().Selection())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ func (gui *Gui) handlePickHunk() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.State.Panels.Merging.AllConflictsResolved() {
|
if gui.State.Contexts.MergeConflicts.State().AllConflictsResolved() {
|
||||||
return gui.onLastConflictResolved()
|
return gui.onLastConflictResolved()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ func (gui *Gui) handlePickAllHunks() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if gui.State.Panels.Merging.AllConflictsResolved() {
|
if gui.State.Contexts.MergeConflicts.State().AllConflictsResolved() {
|
||||||
return gui.onLastConflictResolved()
|
return gui.onLastConflictResolved()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,9 +100,9 @@ func (gui *Gui) handlePickAllHunks() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error) {
|
func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error) {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
|
|
||||||
state := gui.State.Panels.Merging
|
state := gui.State.Contexts.MergeConflicts.State()
|
||||||
|
|
||||||
ok, content, err := state.ContentAfterConflictResolve(selection)
|
ok, content, err := state.ContentAfterConflictResolve(selection)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -132,21 +132,21 @@ func (gui *Gui) resolveConflict(selection mergeconflicts.Selection) (bool, error
|
|||||||
|
|
||||||
// precondition: we actually have conflicts to render
|
// precondition: we actually have conflicts to render
|
||||||
func (gui *Gui) renderConflicts(hasFocus bool) error {
|
func (gui *Gui) renderConflicts(hasFocus bool) error {
|
||||||
state := gui.State.Panels.Merging.State
|
state := gui.State.Contexts.MergeConflicts.State()
|
||||||
content := mergeconflicts.ColoredConflictFile(state, hasFocus)
|
content := mergeconflicts.ColoredConflictFile(state, hasFocus)
|
||||||
|
|
||||||
if !gui.State.Panels.Merging.UserVerticalScrolling {
|
if !gui.State.Contexts.MergeConflicts.IsUserScrolling() {
|
||||||
// TODO: find a way to not have to do this OnUIThread thing. Why doesn't it work
|
// TODO: find a way to not have to do this OnUIThread thing. Why doesn't it work
|
||||||
// without it given that we're calling the 'no scroll' variant below?
|
// without it given that we're calling the 'no scroll' variant below?
|
||||||
gui.OnUIThread(func() error {
|
gui.c.OnUIThread(func() error {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
if !state.Active() {
|
if !state.Active() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.centerYPos(gui.Views.Merging, state.GetConflictMiddle())
|
gui.centerYPos(gui.Views.MergeConflicts, state.GetConflictMiddle())
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -203,8 +203,8 @@ func (gui *Gui) onLastConflictResolved() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) resetMergeState() {
|
func (gui *Gui) resetMergeState() {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
gui.State.Panels.Merging.Reset()
|
gui.State.Contexts.MergeConflicts.State().Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) setMergeState(path string) (bool, error) {
|
func (gui *Gui) setMergeState(path string) (bool, error) {
|
||||||
@ -213,21 +213,21 @@ func (gui *Gui) setMergeState(path string) (bool, error) {
|
|||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
gui.State.Panels.Merging.SetContent(content, path)
|
gui.State.Contexts.MergeConflicts.State().SetContent(content, path)
|
||||||
|
|
||||||
return !gui.State.Panels.Merging.NoConflicts(), nil
|
return !gui.State.Contexts.MergeConflicts.State().NoConflicts(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) setMergeStateWithLock(path string) (bool, error) {
|
func (gui *Gui) setMergeStateWithLock(path string) (bool, error) {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
return gui.setMergeState(path)
|
return gui.setMergeState(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) resetMergeStateWithLock() {
|
func (gui *Gui) resetMergeStateWithLock() {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
gui.resetMergeState()
|
gui.resetMergeState()
|
||||||
}
|
}
|
||||||
@ -244,24 +244,20 @@ func (gui *Gui) escapeMerge() error {
|
|||||||
|
|
||||||
func (gui *Gui) renderingConflicts() bool {
|
func (gui *Gui) renderingConflicts() bool {
|
||||||
currentView := gui.g.CurrentView()
|
currentView := gui.g.CurrentView()
|
||||||
if currentView != gui.Views.Merging && currentView != gui.Views.Files {
|
if currentView != gui.Views.MergeConflicts && currentView != gui.Views.Files {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return gui.State.Panels.Merging.Active()
|
return gui.State.Contexts.MergeConflicts.State().Active()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) withMergeConflictLock(f func() error) error {
|
func (gui *Gui) withMergeConflictLock(f func() error) error {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
return f()
|
return f()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) takeOverMergeConflictScrolling() {
|
|
||||||
gui.State.Panels.Merging.UserVerticalScrolling = false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (gui *Gui) setConflictsAndRender(path string, hasFocus bool) (bool, error) {
|
func (gui *Gui) setConflictsAndRender(path string, hasFocus bool) (bool, error) {
|
||||||
hasConflicts, err := gui.setMergeState(path)
|
hasConflicts, err := gui.setMergeState(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -276,16 +272,16 @@ func (gui *Gui) setConflictsAndRender(path string, hasFocus bool) (bool, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) setConflictsAndRenderWithLock(path string, hasFocus bool) (bool, error) {
|
func (gui *Gui) setConflictsAndRenderWithLock(path string, hasFocus bool) (bool, error) {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
return gui.setConflictsAndRender(path, hasFocus)
|
return gui.setConflictsAndRender(path, hasFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) switchToMerge(path string) error {
|
func (gui *Gui) switchToMerge(path string) error {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
|
|
||||||
if gui.State.Panels.Merging.GetPath() != path {
|
if gui.State.Contexts.MergeConflicts.State().GetPath() != path {
|
||||||
hasConflicts, err := gui.setMergeStateWithLock(path)
|
hasConflicts, err := gui.setMergeStateWithLock(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -295,7 +291,7 @@ func (gui *Gui) switchToMerge(path string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return gui.c.PushContext(gui.State.Contexts.Merging)
|
return gui.c.PushContext(gui.State.Contexts.MergeConflicts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) handleMergeConflictEditFileAtLine() error {
|
func (gui *Gui) handleMergeConflictEditFileAtLine() error {
|
||||||
@ -304,7 +300,7 @@ func (gui *Gui) handleMergeConflictEditFileAtLine() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
lineNumber := gui.State.Panels.Merging.GetSelectedLine()
|
lineNumber := gui.State.Contexts.MergeConflicts.State().GetSelectedLine()
|
||||||
return gui.helpers.Files.EditFileAtLine(file.GetPath(), lineNumber)
|
return gui.helpers.Files.EditFileAtLine(file.GetPath(), lineNumber)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,6 +310,6 @@ func (gui *Gui) handleMergeConflictOpenFileAtLine() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
lineNumber := gui.State.Panels.Merging.GetSelectedLine()
|
lineNumber := gui.State.Contexts.MergeConflicts.State().GetSelectedLine()
|
||||||
return gui.helpers.Files.OpenFileAtLine(file.GetPath(), lineNumber)
|
return gui.helpers.Files.OpenFileAtLine(file.GetPath(), lineNumber)
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ func (gui *Gui) refreshFilesAndSubmodules() error {
|
|||||||
currentSelectedPath := gui.getSelectedPath()
|
currentSelectedPath := gui.getSelectedPath()
|
||||||
alreadySelected := prevSelectedPath != "" && currentSelectedPath == prevSelectedPath
|
alreadySelected := prevSelectedPath != "" && currentSelectedPath == prevSelectedPath
|
||||||
if !alreadySelected {
|
if !alreadySelected {
|
||||||
gui.takeOverMergeConflictScrolling()
|
gui.State.Contexts.MergeConflicts.SetUserScrolling(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,14 +361,14 @@ func (gui *Gui) refreshFilesAndSubmodules() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) refreshMergeState() error {
|
func (gui *Gui) refreshMergeState() error {
|
||||||
gui.State.Panels.Merging.Lock()
|
gui.State.Contexts.MergeConflicts.State().Lock()
|
||||||
defer gui.State.Panels.Merging.Unlock()
|
defer gui.State.Contexts.MergeConflicts.State().Unlock()
|
||||||
|
|
||||||
if gui.currentContext().GetKey() != context.MERGING_MAIN_CONTEXT_KEY {
|
if gui.currentContext().GetKey() != context.MERGE_CONFLICTS_CONTEXT_KEY {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
hasConflicts, err := gui.setConflictsAndRender(gui.State.Panels.Merging.GetPath(), true)
|
hasConflicts, err := gui.setConflictsAndRender(gui.State.Contexts.MergeConflicts.State().GetPath(), true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return gui.c.Error(err)
|
return gui.c.Error(err)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ type Views struct {
|
|||||||
StagingSecondary *gocui.View
|
StagingSecondary *gocui.View
|
||||||
PatchBuilding *gocui.View
|
PatchBuilding *gocui.View
|
||||||
PatchBuildingSecondary *gocui.View
|
PatchBuildingSecondary *gocui.View
|
||||||
Merging *gocui.View
|
MergeConflicts *gocui.View
|
||||||
|
|
||||||
Options *gocui.View
|
Options *gocui.View
|
||||||
Confirmation *gocui.View
|
Confirmation *gocui.View
|
||||||
@ -74,7 +74,7 @@ func (gui *Gui) orderedViewNameMappings() []viewNameMapping {
|
|||||||
{viewPtr: &gui.Views.StagingSecondary, name: "stagingSecondary"},
|
{viewPtr: &gui.Views.StagingSecondary, name: "stagingSecondary"},
|
||||||
{viewPtr: &gui.Views.PatchBuilding, name: "patchBuilding"},
|
{viewPtr: &gui.Views.PatchBuilding, name: "patchBuilding"},
|
||||||
{viewPtr: &gui.Views.PatchBuildingSecondary, name: "patchBuildingSecondary"},
|
{viewPtr: &gui.Views.PatchBuildingSecondary, name: "patchBuildingSecondary"},
|
||||||
{viewPtr: &gui.Views.Merging, name: "merging"},
|
{viewPtr: &gui.Views.MergeConflicts, name: "mergeConflicts"},
|
||||||
{viewPtr: &gui.Views.Secondary, name: "secondary"},
|
{viewPtr: &gui.Views.Secondary, name: "secondary"},
|
||||||
{viewPtr: &gui.Views.Main, name: "main"},
|
{viewPtr: &gui.Views.Main, name: "main"},
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ func (gui *Gui) createAllViews() error {
|
|||||||
gui.Views.Files.Title = gui.c.Tr.FilesTitle
|
gui.Views.Files.Title = gui.c.Tr.FilesTitle
|
||||||
gui.Views.Files.FgColor = theme.GocuiDefaultTextColor
|
gui.Views.Files.FgColor = theme.GocuiDefaultTextColor
|
||||||
|
|
||||||
for _, view := range []*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Staging, gui.Views.StagingSecondary, gui.Views.PatchBuilding, gui.Views.PatchBuildingSecondary, gui.Views.Merging} {
|
for _, view := range []*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Staging, gui.Views.StagingSecondary, gui.Views.PatchBuilding, gui.Views.PatchBuildingSecondary, gui.Views.MergeConflicts} {
|
||||||
view.Title = gui.c.Tr.DiffTitle
|
view.Title = gui.c.Tr.DiffTitle
|
||||||
view.Wrap = true
|
view.Wrap = true
|
||||||
view.FgColor = theme.GocuiDefaultTextColor
|
view.FgColor = theme.GocuiDefaultTextColor
|
||||||
@ -175,9 +175,9 @@ func (gui *Gui) createAllViews() error {
|
|||||||
gui.Views.PatchBuildingSecondary.Highlight = true
|
gui.Views.PatchBuildingSecondary.Highlight = true
|
||||||
gui.Views.PatchBuildingSecondary.Wrap = true
|
gui.Views.PatchBuildingSecondary.Wrap = true
|
||||||
|
|
||||||
gui.Views.Merging.Title = gui.c.Tr.MergeConflictsTitle
|
gui.Views.MergeConflicts.Title = gui.c.Tr.MergeConflictsTitle
|
||||||
gui.Views.Merging.Highlight = true
|
gui.Views.MergeConflicts.Highlight = true
|
||||||
gui.Views.Merging.Wrap = true
|
gui.Views.MergeConflicts.Wrap = false
|
||||||
|
|
||||||
gui.Views.Limit.Title = gui.c.Tr.NotEnoughSpace
|
gui.Views.Limit.Title = gui.c.Tr.NotEnoughSpace
|
||||||
gui.Views.Limit.Wrap = true
|
gui.Views.Limit.Wrap = true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user