2018-08-14 11:05:26 +02:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
2022-01-16 14:46:53 +11:00
|
|
|
"github.com/jesseduffield/gocui"
|
2021-12-30 17:19:01 +11:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands/loaders"
|
2020-09-29 20:28:39 +10:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
2022-01-26 01:20:19 +11:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/commands/types/enums"
|
2021-03-21 15:58:15 +11:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/filetree"
|
2022-01-26 01:20:19 +11:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/mergeconflicts"
|
2022-01-28 20:44:36 +11:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/popup"
|
|
|
|
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
2020-04-15 17:27:42 +02:00
|
|
|
"github.com/jesseduffield/lazygit/pkg/utils"
|
2018-08-14 11:05:26 +02:00
|
|
|
)
|
|
|
|
|
2018-12-06 22:18:17 +11:00
|
|
|
// list panel functions
|
|
|
|
|
2021-03-31 23:26:53 +11:00
|
|
|
func (gui *Gui) getSelectedFileNode() *filetree.FileNode {
|
2021-03-14 14:41:11 +11:00
|
|
|
selectedLine := gui.State.Panels.Files.SelectedLineIdx
|
|
|
|
if selectedLine == -1 {
|
|
|
|
return nil
|
|
|
|
}
|
2020-11-15 10:45:55 +11:00
|
|
|
|
2022-01-22 00:13:51 +11:00
|
|
|
return gui.State.FileTreeViewModel.GetItemAtIndex(selectedLine)
|
2021-03-14 14:41:11 +11:00
|
|
|
}
|
2020-11-15 10:45:55 +11:00
|
|
|
|
2020-09-29 18:45:00 +10:00
|
|
|
func (gui *Gui) getSelectedFile() *models.File {
|
2021-03-31 23:26:53 +11:00
|
|
|
node := gui.getSelectedFileNode()
|
2020-11-15 10:45:55 +11:00
|
|
|
if node == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return node.File
|
2018-12-06 22:18:17 +11:00
|
|
|
}
|
|
|
|
|
2021-03-15 23:00:20 +11:00
|
|
|
func (gui *Gui) getSelectedPath() string {
|
2021-03-31 23:26:53 +11:00
|
|
|
node := gui.getSelectedFileNode()
|
2021-03-15 23:00:20 +11:00
|
|
|
if node == nil {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
return node.GetPath()
|
|
|
|
}
|
|
|
|
|
2021-11-21 12:48:49 +11:00
|
|
|
func (gui *Gui) filesRenderToMain() error {
|
2021-03-31 23:26:53 +11:00
|
|
|
node := gui.getSelectedFileNode()
|
2021-03-14 18:46:22 +11:00
|
|
|
|
|
|
|
if node == nil {
|
2020-08-23 09:46:28 +10:00
|
|
|
return gui.refreshMainViews(refreshMainOpts{
|
2020-08-18 22:02:35 +10:00
|
|
|
main: &viewUpdateOpts{
|
|
|
|
title: "",
|
2022-01-16 14:46:53 +11:00
|
|
|
task: NewRenderStringTask(gui.c.Tr.NoChangedFiles),
|
2020-08-18 22:02:35 +10:00
|
|
|
},
|
|
|
|
})
|
2018-12-06 22:18:17 +11:00
|
|
|
}
|
|
|
|
|
2021-03-14 18:46:22 +11:00
|
|
|
if node.File != nil && node.File.HasInlineMergeConflicts {
|
2022-01-27 20:10:25 +11:00
|
|
|
ok, err := gui.setConflictsAndRenderWithLock(node.GetPath(), false)
|
2022-01-26 01:20:19 +11:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-01-27 20:10:25 +11:00
|
|
|
if ok {
|
|
|
|
return nil
|
2022-01-26 01:20:19 +11:00
|
|
|
}
|
2020-03-29 14:34:17 +11:00
|
|
|
}
|
|
|
|
|
2022-01-27 20:10:25 +11:00
|
|
|
gui.resetMergeStateWithLock()
|
2022-01-26 01:20:19 +11:00
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, !node.GetHasUnstagedChanges() && node.GetHasStagedChanges(), gui.IgnoreWhitespaceInDiffView)
|
2020-08-18 22:02:35 +10:00
|
|
|
|
|
|
|
refreshOpts := refreshMainOpts{main: &viewUpdateOpts{
|
2022-01-16 14:46:53 +11:00
|
|
|
title: gui.c.Tr.UnstagedChanges,
|
2021-12-07 21:59:36 +11:00
|
|
|
task: NewRunPtyTask(cmdObj.GetCmd()),
|
2020-08-18 22:02:35 +10:00
|
|
|
}}
|
|
|
|
|
2021-03-14 18:46:22 +11:00
|
|
|
if node.GetHasUnstagedChanges() {
|
|
|
|
if node.GetHasStagedChanges() {
|
2022-01-16 14:46:53 +11:00
|
|
|
cmdObj := gui.git.WorkingTree.WorktreeFileDiffCmdObj(node, false, true, gui.IgnoreWhitespaceInDiffView)
|
2019-10-30 20:23:25 +11:00
|
|
|
|
2021-03-14 18:46:22 +11:00
|
|
|
refreshOpts.secondary = &viewUpdateOpts{
|
2022-01-16 14:46:53 +11:00
|
|
|
title: gui.c.Tr.StagedChanges,
|
2021-12-07 21:59:36 +11:00
|
|
|
task: NewRunPtyTask(cmdObj.GetCmd()),
|
2021-03-14 18:46:22 +11:00
|
|
|
}
|
2020-08-18 22:02:35 +10:00
|
|
|
}
|
2021-03-14 18:46:22 +11:00
|
|
|
} else {
|
2022-01-16 14:46:53 +11:00
|
|
|
refreshOpts.main.title = gui.c.Tr.StagedChanges
|
2019-10-30 20:23:25 +11:00
|
|
|
}
|
allow fast flicking through any list panel
Up till now our approach to rendering things like file diffs, branch logs, and
commit patches, has been to run a command on the command line, wait for it to
complete, take its output as a string, and then write that string to the main
view (or secondary view e.g. when showing both staged and unstaged changes of a
file).
This has caused various issues. For once, if you are flicking through a list of
files and an untracked file is particularly large, not only will this require
lazygit to load that whole file into memory (or more accurately it's equally
large diff), it also will slow down the UI thread while loading that file, and
if the user continued down the list, the original command might eventually
resolve and replace whatever the diff is for the newly selected file.
Following what we've done in lazydocker, I've added a tasks package for when you
need something done but you want it to cancel as soon as something newer comes
up. Given this typically involves running a command to display to a view, I've
added a viewBufferManagerMap struct to the Gui struct which allows you to define
these tasks on a per-view basis.
viewBufferManagers can run files and directly write the output to their view,
meaning we no longer need to use so much memory.
In the tasks package there is a helper method called NewCmdTask which takes a
command, an initial amount of lines to read, and then runs that command, reads
that number of lines, and allows for a readLines channel to tell it to read more
lines. We read more lines when we scroll or resize the window.
There is an adapter for the tasks package in a file called tasks_adapter which
wraps the functions from the tasks package in gui-specific stuff like clearing
the main view before starting the next task that wants to write to the main
view.
I've removed some small features as part of this work, namely the little headers
that were at the top of the main view for some situations. For example, we no
longer show the upstream of a selected branch. I want to re-introduce this in
the future, but I didn't want to make this tasks system too complicated, and in
order to facilitate a header section in the main view we'd need to have a task
that gets the upstream for the current branch, writes it to the header, then
tells another task to write the branch log to the main view, but without
clearing inbetween. So it would get messy. I'm thinking instead of having a
separate 'header' view atop the main view to render that kind of thing (which
can happen in another PR)
I've also simplified the 'git show' to just call 'git show' and not do anything
fancy when it comes to merge commits.
I considered using this tasks approach whenever we write to a view. The only
thing is that the renderString method currently resets the origin of a view and
I don't want to lose that. So I've left some in there that I consider harmless,
but we should probably be just using tasks now for all rendering, even if it's
just strings we can instantly make.
2020-01-11 14:54:59 +11:00
|
|
|
|
2020-08-23 09:46:28 +10:00
|
|
|
return gui.refreshMainViews(refreshOpts)
|
2018-12-06 22:18:17 +11:00
|
|
|
}
|
|
|
|
|
2020-09-30 08:27:23 +10:00
|
|
|
func (gui *Gui) refreshFilesAndSubmodules() error {
|
2020-10-07 21:45:57 +11:00
|
|
|
gui.Mutexes.RefreshingFilesMutex.Lock()
|
2019-11-12 22:19:20 +11:00
|
|
|
gui.State.IsRefreshingFiles = true
|
|
|
|
defer func() {
|
|
|
|
gui.State.IsRefreshingFiles = false
|
2020-10-07 21:45:57 +11:00
|
|
|
gui.Mutexes.RefreshingFilesMutex.Unlock()
|
2019-11-12 22:19:20 +11:00
|
|
|
}()
|
|
|
|
|
2022-01-26 01:20:19 +11:00
|
|
|
prevSelectedPath := gui.getSelectedPath()
|
2019-01-15 20:12:31 +11:00
|
|
|
|
2020-09-28 09:14:32 +10:00
|
|
|
if err := gui.refreshStateSubmoduleConfigs(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-01-26 01:20:19 +11:00
|
|
|
|
|
|
|
if err := gui.refreshMergeState(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2019-03-02 13:22:02 +11:00
|
|
|
if err := gui.refreshStateFiles(); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2018-12-06 22:18:17 +11:00
|
|
|
|
2022-01-15 12:04:00 +11:00
|
|
|
gui.OnUIThread(func() error {
|
2022-01-16 14:46:53 +11:00
|
|
|
if err := gui.c.PostRefreshUpdate(gui.State.Contexts.Submodules); err != nil {
|
|
|
|
gui.c.Log.Error(err)
|
2020-08-19 18:41:57 +10:00
|
|
|
}
|
2018-12-06 22:18:17 +11:00
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
if types.ContextKey(gui.Views.Files.Context) == FILES_CONTEXT_KEY {
|
|
|
|
// doing this a little custom (as opposed to using gui.c.PostRefreshUpdate) because we handle selecting the file explicitly below
|
2021-04-03 15:56:11 +11:00
|
|
|
if err := gui.State.Contexts.Files.HandleRender(); err != nil {
|
2020-09-30 08:27:23 +10:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 01:20:19 +11:00
|
|
|
if gui.currentContext().GetKey() == FILES_CONTEXT_KEY {
|
|
|
|
currentSelectedPath := gui.getSelectedPath()
|
|
|
|
alreadySelected := prevSelectedPath != "" && currentSelectedPath == prevSelectedPath
|
2021-11-21 12:48:49 +11:00
|
|
|
if !alreadySelected {
|
|
|
|
gui.takeOverMergeConflictScrolling()
|
2020-09-30 08:27:23 +10:00
|
|
|
}
|
2021-11-21 12:48:49 +11:00
|
|
|
|
|
|
|
gui.Views.Files.FocusPoint(0, gui.State.Panels.Files.SelectedLineIdx)
|
|
|
|
return gui.filesRenderToMain()
|
2018-12-06 22:18:17 +11:00
|
|
|
}
|
2020-09-30 08:27:23 +10:00
|
|
|
|
2018-12-06 22:18:17 +11:00
|
|
|
return nil
|
|
|
|
})
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-03-02 13:22:02 +11:00
|
|
|
func (gui *Gui) refreshStateFiles() error {
|
2021-04-03 19:35:45 +11:00
|
|
|
state := gui.State
|
|
|
|
|
2020-08-07 18:27:18 +10:00
|
|
|
// keep track of where the cursor is currently and the current file names
|
|
|
|
// when we refresh, go looking for a matching name
|
|
|
|
// move the cursor to there.
|
2021-03-21 09:06:15 +11:00
|
|
|
|
2021-03-31 23:26:53 +11:00
|
|
|
selectedNode := gui.getSelectedFileNode()
|
2021-03-21 09:06:15 +11:00
|
|
|
|
2022-01-22 00:13:51 +11:00
|
|
|
prevNodes := gui.State.FileTreeViewModel.GetAllItems()
|
2020-08-25 08:34:02 +10:00
|
|
|
prevSelectedLineIdx := gui.State.Panels.Files.SelectedLineIdx
|
2020-08-07 18:27:18 +10:00
|
|
|
|
2022-01-26 01:20:19 +11:00
|
|
|
// If git thinks any of our files have inline merge conflicts, but they actually don't,
|
|
|
|
// we stage them.
|
|
|
|
// Note that if files with merge conflicts have both arisen and have been resolved
|
|
|
|
// between refreshes, we won't stage them here. This is super unlikely though,
|
|
|
|
// and this approach spares us from having to call `git status` twice in a row.
|
|
|
|
// Although this also means that at startup we won't be staging anything until
|
|
|
|
// we call git status again.
|
|
|
|
pathsToStage := []string{}
|
|
|
|
prevConflictFileCount := 0
|
|
|
|
for _, file := range state.FileTreeViewModel.GetAllFiles() {
|
|
|
|
if file.HasMergeConflicts {
|
|
|
|
prevConflictFileCount++
|
|
|
|
}
|
|
|
|
if file.HasInlineMergeConflicts {
|
|
|
|
hasConflicts, err := mergeconflicts.FileHasConflictMarkers(file.Name)
|
|
|
|
if err != nil {
|
|
|
|
gui.Log.Error(err)
|
|
|
|
} else if !hasConflicts {
|
|
|
|
pathsToStage = append(pathsToStage, file.Name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(pathsToStage) > 0 {
|
2022-01-16 14:46:53 +11:00
|
|
|
gui.c.LogAction(gui.Tr.Actions.StageResolvedFiles)
|
|
|
|
if err := gui.git.WorkingTree.StageFiles(pathsToStage); err != nil {
|
|
|
|
return gui.c.Error(err)
|
2022-01-26 01:20:19 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
files := gui.git.Loaders.Files.
|
2021-12-30 17:19:01 +11:00
|
|
|
GetStatusFiles(loaders.GetStatusFileOptions{})
|
2021-03-21 16:28:03 +11:00
|
|
|
|
2022-01-26 01:20:19 +11:00
|
|
|
conflictFileCount := 0
|
|
|
|
for _, file := range files {
|
|
|
|
if file.HasMergeConflicts {
|
|
|
|
conflictFileCount++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
if gui.git.Status.WorkingTreeState() != enums.REBASE_MODE_NONE && conflictFileCount == 0 && prevConflictFileCount > 0 {
|
2022-01-26 01:20:19 +11:00
|
|
|
gui.OnUIThread(func() error { return gui.promptToContinueRebase() })
|
|
|
|
}
|
|
|
|
|
2021-03-21 16:28:03 +11:00
|
|
|
// for when you stage the old file of a rename and the new file is in a collapsed dir
|
2022-01-22 00:13:51 +11:00
|
|
|
state.FileTreeViewModel.RWMutex.Lock()
|
2021-03-21 16:28:03 +11:00
|
|
|
for _, file := range files {
|
|
|
|
if selectedNode != nil && selectedNode.Path != "" && file.PreviousName == selectedNode.Path {
|
2022-01-22 00:13:51 +11:00
|
|
|
state.FileTreeViewModel.ExpandToPath(file.Name)
|
2021-03-21 16:28:03 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-26 19:45:42 +11:00
|
|
|
// only taking over the filter if it hasn't already been set by the user.
|
|
|
|
// Though this does make it impossible for the user to actually say they want to display all if
|
|
|
|
// conflicts are currently being shown. Hmm. Worth it I reckon. If we need to add some
|
|
|
|
// extra state here to see if the user's set the filter themselves we can do that, but
|
|
|
|
// I'd prefer to maintain as little state as possible.
|
|
|
|
if conflictFileCount > 0 {
|
|
|
|
if state.FileTreeViewModel.GetFilter() == filetree.DisplayAll {
|
|
|
|
state.FileTreeViewModel.SetFilter(filetree.DisplayConflicted)
|
|
|
|
}
|
|
|
|
} else if state.FileTreeViewModel.GetFilter() == filetree.DisplayConflicted {
|
|
|
|
state.FileTreeViewModel.SetFilter(filetree.DisplayAll)
|
|
|
|
}
|
|
|
|
|
2022-01-22 00:13:51 +11:00
|
|
|
state.FileTreeViewModel.SetFiles(files)
|
|
|
|
state.FileTreeViewModel.RWMutex.Unlock()
|
2019-11-12 22:19:20 +11:00
|
|
|
|
2020-01-08 21:02:01 +11:00
|
|
|
if err := gui.fileWatcher.addFilesToFileWatcher(files); err != nil {
|
2019-11-12 22:19:20 +11:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2021-03-21 09:06:15 +11:00
|
|
|
if selectedNode != nil {
|
2022-01-22 00:13:51 +11:00
|
|
|
newIdx := gui.findNewSelectedIdx(prevNodes[prevSelectedLineIdx:], state.FileTreeViewModel.GetAllItems())
|
2021-03-21 09:37:16 +11:00
|
|
|
if newIdx != -1 && newIdx != prevSelectedLineIdx {
|
2022-01-22 00:13:51 +11:00
|
|
|
newNode := state.FileTreeViewModel.GetItemAtIndex(newIdx)
|
2021-04-02 01:31:23 +11:00
|
|
|
// when not in tree mode, we show merge conflict files at the top, so you
|
|
|
|
// can work through them one by one without having to sift through a large
|
|
|
|
// set of files. If you have just fixed the merge conflicts of a file, we
|
|
|
|
// actually don't want to jump to that file's new position, because that
|
|
|
|
// file will now be ages away amidst the other files without merge
|
|
|
|
// conflicts: the user in this case would rather work on the next file
|
|
|
|
// with merge conflicts, which will have moved up to fill the gap left by
|
|
|
|
// the last file, meaning the cursor doesn't need to move at all.
|
2022-01-22 00:13:51 +11:00
|
|
|
leaveCursor := !state.FileTreeViewModel.InTreeMode() && newNode != nil &&
|
2021-04-02 01:31:23 +11:00
|
|
|
selectedNode.File != nil && selectedNode.File.HasMergeConflicts &&
|
|
|
|
newNode.File != nil && !newNode.File.HasMergeConflicts
|
|
|
|
|
|
|
|
if !leaveCursor {
|
2021-04-03 19:35:45 +11:00
|
|
|
state.Panels.Files.SelectedLineIdx = newIdx
|
2021-04-02 01:31:23 +11:00
|
|
|
}
|
2021-03-21 09:37:16 +11:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-22 00:13:51 +11:00
|
|
|
gui.refreshSelectedLine(state.Panels.Files, state.FileTreeViewModel.GetItemsLength())
|
2021-03-21 09:37:16 +11:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-01-26 01:20:19 +11:00
|
|
|
// promptToContinueRebase asks the user if they want to continue the rebase/merge that's in progress
|
|
|
|
func (gui *Gui) promptToContinueRebase() error {
|
|
|
|
gui.takeOverMergeConflictScrolling()
|
|
|
|
|
2022-01-28 20:44:36 +11:00
|
|
|
return gui.PopupHandler.Ask(popup.AskOpts{
|
|
|
|
Title: "continue",
|
|
|
|
Prompt: gui.Tr.ConflictsResolved,
|
|
|
|
HandleConfirm: func() error {
|
2022-01-26 01:20:19 +11:00
|
|
|
return gui.genericMergeCommand(REBASE_OPTION_CONTINUE)
|
|
|
|
},
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2021-03-21 09:37:16 +11:00
|
|
|
// Let's try to find our file again and move the cursor to that.
|
|
|
|
// If we can't find our file, it was probably just removed by the user. In that
|
|
|
|
// case, we go looking for where the next file has been moved to. Given that the
|
|
|
|
// user could have removed a whole directory, we continue iterating through the old
|
|
|
|
// nodes until we find one that exists in the new set of nodes, then move the cursor
|
|
|
|
// to that.
|
|
|
|
// prevNodes starts from our previously selected node because we don't need to consider anything above that
|
2021-03-31 23:26:53 +11:00
|
|
|
func (gui *Gui) findNewSelectedIdx(prevNodes []*filetree.FileNode, currNodes []*filetree.FileNode) int {
|
|
|
|
getPaths := func(node *filetree.FileNode) []string {
|
2021-03-21 09:37:16 +11:00
|
|
|
if node == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
if node.File != nil && node.File.IsRename() {
|
|
|
|
return node.File.Names()
|
|
|
|
} else {
|
|
|
|
return []string{node.Path}
|
2021-03-21 09:20:52 +11:00
|
|
|
}
|
2021-03-21 09:37:16 +11:00
|
|
|
}
|
2021-03-21 09:20:52 +11:00
|
|
|
|
2021-03-21 09:37:16 +11:00
|
|
|
for _, prevNode := range prevNodes {
|
|
|
|
selectedPaths := getPaths(prevNode)
|
2021-03-21 09:20:52 +11:00
|
|
|
|
2021-03-21 09:37:16 +11:00
|
|
|
for idx, node := range currNodes {
|
|
|
|
paths := getPaths(node)
|
2021-03-21 09:20:52 +11:00
|
|
|
|
2021-03-21 09:37:16 +11:00
|
|
|
// If you started off with a rename selected, and now it's broken in two, we want you to jump to the new file, not the old file.
|
|
|
|
// This is because the new should be in the same position as the rename was meaning less cursor jumping
|
|
|
|
foundOldFileInRename := prevNode.File != nil && prevNode.File.IsRename() && node.Path == prevNode.File.PreviousName
|
|
|
|
foundNode := utils.StringArraysOverlap(paths, selectedPaths) && !foundOldFileInRename
|
|
|
|
if foundNode {
|
|
|
|
return idx
|
2020-08-25 08:34:02 +10:00
|
|
|
}
|
2020-08-07 18:27:18 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-21 09:37:16 +11:00
|
|
|
return -1
|
2018-08-14 11:05:26 +02:00
|
|
|
}
|
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
func (gui *Gui) onFocusFile() error {
|
2022-01-26 01:20:19 +11:00
|
|
|
gui.takeOverMergeConflictScrolling()
|
|
|
|
|
|
|
|
if gui.State.Panels.Merging.GetPath() != file.Name {
|
2022-01-27 20:10:25 +11:00
|
|
|
hasConflicts, err := gui.setMergeStateWithLock(file.Name)
|
2022-01-26 01:20:19 +11:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
if !hasConflicts {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
// TODO: this can't be right.
|
2021-04-03 15:56:11 +11:00
|
|
|
return gui.pushContext(gui.State.Contexts.Merging)
|
2018-08-14 11:05:26 +02:00
|
|
|
}
|
|
|
|
|
2022-01-16 14:46:53 +11:00
|
|
|
func (gui *Gui) getSetTextareaTextFn(view *gocui.View) func(string) {
|
|
|
|
return func(text string) {
|
|
|
|
view.ClearTextArea()
|
|
|
|
view.TextArea.TypeString(text)
|
|
|
|
view.RenderTextArea()
|
2018-08-23 21:05:09 +02:00
|
|
|
}
|
2022-01-28 20:44:36 +11:00
|
|
|
}
|