Documentation ¶
Index ¶
- Constants
- Variables
- func GetKeyDisplay(key interface{}) string
- func NewFileWatcher(log *logrus.Entry) *fileWatcher
- func NewRenderStringTask(str string) *renderStringTask
- func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
- func NewRunCommandTask(cmd *exec.Cmd) *runCommandTask
- func NewRunCommandTaskWithPrefix(cmd *exec.Cmd, prefix string) *runCommandTask
- func NewRunPtyTask(cmd *exec.Cmd) *runPtyTask
- type BasicContext
- func (c *BasicContext) GetKey() ContextKey
- func (c *BasicContext) GetKind() ContextKind
- func (c *BasicContext) GetOptionsMap() map[string]string
- func (c *BasicContext) GetParentContext() (Context, bool)
- func (c *BasicContext) GetViewName() string
- func (c *BasicContext) GetWindowName() string
- func (c *BasicContext) HandleFocus() error
- func (c *BasicContext) HandleFocusLost() error
- func (c *BasicContext) HandleRender() error
- func (c *BasicContext) SetParentContext(context Context)
- func (c *BasicContext) SetWindowName(windowName string)
- type Binding
- type CherryPicking
- type Context
- type ContextKey
- type ContextKind
- type ContextManager
- type ContextTree
- type CustomCommandObjects
- type Diffing
- type Gui
- func (gui *Gui) GetCustomCommandKeybindings() []*Binding
- func (gui *Gui) GetInitialKeybindings() []*Binding
- func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry)
- func (gui *Gui) HandlePasteCommits() error
- func (gui *Gui) RenderCommitLength()
- func (gui *Gui) Run() error
- func (gui *Gui) RunAndHandleError() error
- func (gui *Gui) WithWaitingStatus(message string, f func() error) error
- type IListPanelState
- type LblPanelState
- type ListContext
- type ListItem
- type MergingPanelState
- type Modes
- type PullFilesOptions
- type ReflogActionKind
- type RefreshMode
- type RefreshableView
- type Repo
- type StartupStage
- type TaskKind
- type Views
- type WindowMaximisation
Constants ¶
const INFO_SECTION_PADDING = " "
const MAX_WATCHED_FILES = 50
macs for some bizarre reason cap the number of watchable files to 256. there's no obvious platform agonstic way to check the situation of the user's computer so we're just arbitrarily capping at 200. This isn't so bad because file watching is only really an added bonus for faster refreshing.
const SEARCH_PREFIX = "search: "
const StartupPopupVersion = 5
const UNKNOWN_VIEW_ERROR_MSG = "unknown view"
Variables ¶
var OverlappingEdges = false
OverlappingEdges determines if panel edges overlap
Functions ¶
func GetKeyDisplay ¶ added in v0.12.1
func GetKeyDisplay(key interface{}) string
func NewFileWatcher ¶ added in v0.12.1
func NewRenderStringTask ¶ added in v0.27.1
func NewRenderStringTask(str string) *renderStringTask
func NewRenderStringWithoutScrollTask ¶ added in v0.27.1
func NewRenderStringWithoutScrollTask(str string) *renderStringWithoutScrollTask
func NewRunCommandTask ¶ added in v0.27.1
func NewRunCommandTaskWithPrefix ¶ added in v0.27.1
func NewRunPtyTask ¶ added in v0.27.1
Types ¶
type BasicContext ¶ added in v0.22.0
type BasicContext struct { OnFocus func() error OnFocusLost func() error OnRender func() error Kind ContextKind Key ContextKey ViewName string WindowName string OnGetOptionsMap func() map[string]string ParentContext Context // contains filtered or unexported fields }
func (*BasicContext) GetKey ¶ added in v0.22.0
func (c *BasicContext) GetKey() ContextKey
func (*BasicContext) GetKind ¶ added in v0.22.0
func (c *BasicContext) GetKind() ContextKind
func (*BasicContext) GetOptionsMap ¶ added in v0.22.0
func (c *BasicContext) GetOptionsMap() map[string]string
func (*BasicContext) GetParentContext ¶ added in v0.22.0
func (c *BasicContext) GetParentContext() (Context, bool)
func (*BasicContext) GetViewName ¶ added in v0.22.0
func (c *BasicContext) GetViewName() string
func (*BasicContext) GetWindowName ¶ added in v0.22.0
func (c *BasicContext) GetWindowName() string
func (*BasicContext) HandleFocus ¶ added in v0.22.0
func (c *BasicContext) HandleFocus() error
func (*BasicContext) HandleFocusLost ¶ added in v0.22.0
func (c *BasicContext) HandleFocusLost() error
func (*BasicContext) HandleRender ¶ added in v0.22.0
func (c *BasicContext) HandleRender() error
func (*BasicContext) SetParentContext ¶ added in v0.22.0
func (c *BasicContext) SetParentContext(context Context)
func (*BasicContext) SetWindowName ¶ added in v0.22.0
func (c *BasicContext) SetWindowName(windowName string)
type Binding ¶
type Binding struct { ViewName string Contexts []string Handler func() error Key interface{} // FIXME: find out how to get `gocui.Key | rune` Modifier gocui.Modifier Description string Alternative string Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet OpensMenu bool }
Binding - a keybinding mapping a key and modifier to a handler. The keypress is only handled if the given view has focus, or handled globally if the view is ""
func (*Binding) GetDisplayStrings ¶ added in v0.3.0
GetDisplayStrings returns the display string of a file
type CherryPicking ¶ added in v0.22.0
type CherryPicking struct { CherryPickedCommits []*models.Commit // we only allow cherry picking from one context at a time, so you can't copy a commit from the local commits context and then also copy a commit in the reflog context ContextKey ContextKey }
func (*CherryPicking) Active ¶ added in v0.22.0
func (m *CherryPicking) Active() bool
type Context ¶ added in v0.22.0
type Context interface { HandleFocus() error HandleFocusLost() error HandleRender() error GetKind() ContextKind GetViewName() string GetWindowName() string SetWindowName(string) GetKey() ContextKey SetParentContext(Context) // we return a bool here to tell us whether or not the returned value just wraps a nil GetParentContext() (Context, bool) GetOptionsMap() map[string]string }
type ContextKey ¶ added in v0.27.1
type ContextKey string
const ( STATUS_CONTEXT_KEY ContextKey = "status" FILES_CONTEXT_KEY ContextKey = "files" LOCAL_BRANCHES_CONTEXT_KEY ContextKey = "localBranches" REMOTES_CONTEXT_KEY ContextKey = "remotes" REMOTE_BRANCHES_CONTEXT_KEY ContextKey = "remoteBranches" TAGS_CONTEXT_KEY ContextKey = "tags" BRANCH_COMMITS_CONTEXT_KEY ContextKey = "commits" REFLOG_COMMITS_CONTEXT_KEY ContextKey = "reflogCommits" SUB_COMMITS_CONTEXT_KEY ContextKey = "subCommits" COMMIT_FILES_CONTEXT_KEY ContextKey = "commitFiles" STASH_CONTEXT_KEY ContextKey = "stash" MAIN_NORMAL_CONTEXT_KEY ContextKey = "normal" MAIN_MERGING_CONTEXT_KEY ContextKey = "merging" MAIN_PATCH_BUILDING_CONTEXT_KEY ContextKey = "patchBuilding" MAIN_STAGING_CONTEXT_KEY ContextKey = "staging" MENU_CONTEXT_KEY ContextKey = "menu" CREDENTIALS_CONTEXT_KEY ContextKey = "credentials" CONFIRMATION_CONTEXT_KEY ContextKey = "confirmation" SEARCH_CONTEXT_KEY ContextKey = "search" COMMIT_MESSAGE_CONTEXT_KEY ContextKey = "commitMessage" SUBMODULES_CONTEXT_KEY ContextKey = "submodules" SUGGESTIONS_CONTEXT_KEY ContextKey = "suggestions" COMMAND_LOG_CONTEXT_KEY ContextKey = "cmdLog" )
type ContextKind ¶ added in v0.27.1
type ContextKind int
const ( SIDE_CONTEXT ContextKind = iota MAIN_CONTEXT TEMPORARY_POPUP PERSISTENT_POPUP EXTRAS_CONTEXT )
type ContextManager ¶ added in v0.27.1
func NewContextManager ¶ added in v0.27.1
func NewContextManager(initialContext Context) ContextManager
type ContextTree ¶ added in v0.22.0
type ContextTree struct { Status Context Files *ListContext Submodules *ListContext Menu *ListContext Branches *ListContext Remotes *ListContext RemoteBranches *ListContext Tags *ListContext BranchCommits *ListContext CommitFiles *ListContext ReflogCommits *ListContext SubCommits *ListContext Stash *ListContext Suggestions *ListContext Normal Context Staging Context PatchBuilding Context Merging Context Credentials Context Confirmation Context CommitMessage Context Search Context CommandLog Context }
type CustomCommandObjects ¶ added in v0.23.1
type CustomCommandObjects struct { SelectedLocalCommit *models.Commit SelectedReflogCommit *models.Commit SelectedSubCommit *models.Commit SelectedFile *models.File SelectedPath string SelectedLocalBranch *models.Branch SelectedRemoteBranch *models.RemoteBranch SelectedRemote *models.Remote SelectedTag *models.Tag SelectedStashEntry *models.StashEntry SelectedCommitFile *models.CommitFile SelectedCommitFilePath string CheckedOutBranch *models.Branch PromptResponses []string }
type Gui ¶
type Gui struct { Log *logrus.Entry GitCommand *commands.GitCommand OSCommand *oscommands.OSCommand // this is the state of the GUI for the current repo State *guiState // this is a mapping of repos to gui states, so that we can restore the original // gui state when returning from a subrepo RepoStateMap map[Repo]*guiState Config config.AppConfigurer Tr *i18n.TranslationSet Updater *updates.Updater Mutexes guiMutexes // when you enter into a submodule we'll append the superproject's path to this array // so that you can return to the superproject RepoPathStack []string // this tells us whether our views have been initially set up ViewsSetup bool Views Views // if we've suspended the gui (e.g. because we've switched to a subprocess) // we typically want to pause some things that are running like background // file refreshes PauseBackgroundThreads bool // Log of the commands that get run, to be displayed to the user. CmdLog []string OnRunCommand func(entry oscommands.CmdLogEntry) // the extras window contains things like the command log ShowExtrasWindow bool // contains filtered or unexported fields }
Gui wraps the gocui Gui object which handles rendering and events
func NewGui ¶
func NewGui(log *logrus.Entry, gitCommand *commands.GitCommand, oSCommand *oscommands.OSCommand, tr *i18n.TranslationSet, config config.AppConfigurer, updater *updates.Updater, filterPath string, showRecentRepos bool) (*Gui, error)
for now the split view will always be on NewGui builds a new gui handler
func (*Gui) GetCustomCommandKeybindings ¶ added in v0.23.1
func (*Gui) GetInitialKeybindings ¶ added in v0.7.1
GetInitialKeybindings is a function.
func (*Gui) GetOnRunCommand ¶ added in v0.28.1
func (gui *Gui) GetOnRunCommand() func(entry oscommands.CmdLogEntry)
func (*Gui) HandlePasteCommits ¶ added in v0.7.1
HandlePasteCommits begins a cherry-pick rebase with the commits the user has copied
func (*Gui) RenderCommitLength ¶ added in v0.2.2
func (gui *Gui) RenderCommitLength()
RenderCommitLength is a function.
func (*Gui) RunAndHandleError ¶ added in v0.27.1
RunAndHandleError
type IListPanelState ¶ added in v0.22.0
type LblPanelState ¶ added in v0.28.1
type LblPanelState struct { *lbl.State SecondaryFocused bool // this is for if we show the left or right panel }
for now the staging panel state, unlike the other panel states, is going to be non-mutative, so that we don't accidentally end up with mismatches of data. We might change this in the future
type ListContext ¶ added in v0.22.0
type ListContext struct { GetItemsLength func() int GetDisplayStrings func() [][]string OnFocus func() error OnFocusLost func() error OnClickSelectedItem func() error // the boolean here tells us whether the item is nil. This is needed because you can't work it out on the calling end once the pointer is wrapped in an interface (unless you want to use reflection) SelectedItem func() (ListItem, bool) GetPanelState func() IListPanelState Gui *Gui ResetMainViewOriginOnFocus bool *BasicContext }
func (*ListContext) GetSelectedItem ¶ added in v0.22.0
func (lc *ListContext) GetSelectedItem() (ListItem, bool)
func (*ListContext) GetSelectedItemId ¶ added in v0.22.0
func (lc *ListContext) GetSelectedItemId() string
func (*ListContext) HandleFocus ¶ added in v0.22.0
func (lc *ListContext) HandleFocus() error
func (*ListContext) HandleFocusLost ¶ added in v0.22.0
func (lc *ListContext) HandleFocusLost() error
func (*ListContext) HandleRender ¶ added in v0.22.0
func (lc *ListContext) HandleRender() error
func (*ListContext) OnRender ¶ added in v0.22.0
func (lc *ListContext) OnRender() error
OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view
type ListItem ¶ added in v0.22.0
type ListItem interface { // ID is a SHA when the item is a commit, a filename when the item is a file, 'stash@{4}' when it's a stash entry, 'my_branch' when it's a branch ID() string // Description is something we would show in a message e.g. '123as14: push blah' for a commit Description() string }
type MergingPanelState ¶ added in v0.28.1
type MergingPanelState struct { *mergeconflicts.State // UserScrolling tells us if the user has started scrolling through the file themselves // in which case we won't auto-scroll to a conflict. UserScrolling bool }
type Modes ¶ added in v0.22.0
type Modes struct { Filtering filtering.Filtering CherryPicking CherryPicking Diffing Diffing }
type PullFilesOptions ¶ added in v0.22.0
type ReflogActionKind ¶ added in v0.27.1
type ReflogActionKind int
const ( CHECKOUT ReflogActionKind = iota COMMIT REBASE CURRENT_REBASE )
type RefreshMode ¶ added in v0.27.1
type RefreshMode int
const ( SYNC RefreshMode = iota // wait until everything is done before returning ASYNC // return immediately, allowing each independent thing to update itself BLOCK_UI // wrap code in an update call to ensure UI updates all at once and keybindings aren't executed till complete )
type RefreshableView ¶ added in v0.27.1
type RefreshableView int
models/views that we can refresh
const ( COMMITS RefreshableView = iota BRANCHES FILES STASH REFLOG TAGS REMOTES STATUS SUBMODULES )
type StartupStage ¶ added in v0.27.1
type StartupStage int
startup stages so we don't need to load everything at once
const ( INITIAL StartupStage = iota COMPLETE )
type Views ¶ added in v0.27.1
type Views struct { Status *gocui.View Files *gocui.View Branches *gocui.View Commits *gocui.View Stash *gocui.View Main *gocui.View Secondary *gocui.View Options *gocui.View Confirmation *gocui.View Menu *gocui.View Credentials *gocui.View CommitMessage *gocui.View CommitFiles *gocui.View Information *gocui.View AppStatus *gocui.View Search *gocui.View SearchPrefix *gocui.View Limit *gocui.View Suggestions *gocui.View Extras *gocui.View }
type WindowMaximisation ¶ added in v0.27.1
type WindowMaximisation int
screen sizing determines how much space your selected window takes up (window as in panel, not your terminal's window). Sometimes you want a bit more space to see the contents of a panel, and this keeps track of how much maximisation you've set
const ( SCREEN_NORMAL WindowMaximisation = iota SCREEN_HALF SCREEN_FULL )
Source Files ¶
- app_status_manager.go
- arrangement.go
- basic_context.go
- branches_panel.go
- cherry_picking.go
- command_log_panel.go
- commit_files_panel.go
- commit_message_panel.go
- commits_panel.go
- confirmation_panel.go
- context.go
- context_config.go
- credentials_panel.go
- custom_commands.go
- diffing.go
- discard_changes_menu_panel.go
- editors.go
- errors.go
- extras_panel.go
- file_watching.go
- files_panel.go
- filtering.go
- filtering_menu_panel.go
- git_flow.go
- global_handlers.go
- gpg.go
- gui.go
- information_panel.go
- keybindings.go
- layout.go
- line_by_line_panel.go
- list_context.go
- list_context_config.go
- main_panels.go
- menu_panel.go
- merge_panel.go
- modes.go
- options_menu_panel.go
- patch_building_panel.go
- patch_options_panel.go
- pty.go
- quitting.go
- rebase_options_panel.go
- recent_repos_panel.go
- recording.go
- reflog_panel.go
- remote_branches_panel.go
- remotes_panel.go
- reset_menu_panel.go
- searching.go
- side_window.go
- staging_panel.go
- stash_panel.go
- status_panel.go
- sub_commits_panel.go
- submodules_panel.go
- suggestions_panel.go
- tags_panel.go
- tasks_adapter.go
- undoing.go
- updates.go
- view_helpers.go
- window.go
- workspace_reset_options_panel.go