diff --git a/cmd/micro/actions.go b/cmd/micro/actions.go index 00ecb35d..4a9b5a7b 100644 --- a/cmd/micro/actions.go +++ b/cmd/micro/actions.go @@ -543,6 +543,8 @@ func (v *View) ParagraphNext(usePlugin bool) bool { return true } +// Retab changes all tabs to spaces or all spaces to tabs depending +// on the user's settings func (v *View) Retab(usePlugin bool) bool { if usePlugin && !PreActionCall("Retab", v) { return false diff --git a/cmd/micro/autocomplete.go b/cmd/micro/autocomplete.go index 472c3099..3ecc3f16 100644 --- a/cmd/micro/autocomplete.go +++ b/cmd/micro/autocomplete.go @@ -142,6 +142,7 @@ func OptionComplete(input string) (string, []string) { return chosen, suggestions } +// OptionValueComplete completes values for various options func OptionValueComplete(inputOpt, input string) (string, []string) { inputOpt = strings.TrimSpace(inputOpt) var suggestions []string @@ -219,6 +220,7 @@ func PluginComplete(complete Completion, input string) (chosen string, suggestio return } +// PluginCmdComplete completes with possible choices for the `> plugin` command func PluginCmdComplete(input string) (chosen string, suggestions []string) { for _, cmd := range []string{"install", "remove", "search", "update", "list"} { if strings.HasPrefix(cmd, input) { @@ -232,6 +234,7 @@ func PluginCmdComplete(input string) (chosen string, suggestions []string) { return chosen, suggestions } +// PluginnameComplete completes with the names of loaded plugins func PluginNameComplete(input string) (chosen string, suggestions []string) { for _, pp := range GetAllPluginPackages() { if strings.HasPrefix(pp.Name, input) { diff --git a/cmd/micro/bindings.go b/cmd/micro/bindings.go index b77ceb24..682c415e 100644 --- a/cmd/micro/bindings.go +++ b/cmd/micro/bindings.go @@ -406,6 +406,8 @@ func findMouseAction(v string) func(*View, bool, *tcell.EventMouse) bool { return action } +// TryBindKey tries to bind a key by writing to configDir/bindings.json +// This function is unused for now func TryBindKey(k, v string) { filename := configDir + "/bindings.json" if _, e := os.Stat(filename); e == nil { diff --git a/cmd/micro/command.go b/cmd/micro/command.go index 958bc14b..2607cdb8 100644 --- a/cmd/micro/command.go +++ b/cmd/micro/command.go @@ -227,10 +227,14 @@ func PluginCmd(args []string) { } } +// Retab changes all spaces to tabs or all tabs to spaces +// depending on the user's settings func Retab(args []string) { CurView().Retab(true) } +// Raw opens a new raw view which displays the escape sequences micro +// is receiving in real-time func Raw(args []string) { buf := NewBufferFromString("", "Raw events") diff --git a/cmd/micro/eventhandler.go b/cmd/micro/eventhandler.go index 8230c436..adf7cba4 100644 --- a/cmd/micro/eventhandler.go +++ b/cmd/micro/eventhandler.go @@ -28,6 +28,7 @@ type TextEvent struct { Time time.Time } +// A Delta is a change to the buffer type Delta struct { Text string Start Loc diff --git a/cmd/micro/messenger.go b/cmd/micro/messenger.go index a62ca8a7..43dd5785 100644 --- a/cmd/micro/messenger.go +++ b/cmd/micro/messenger.go @@ -223,6 +223,7 @@ func (m *Messenger) LetterPrompt(prompt string, responses ...rune) (rune, bool) } } +// Completion represents a type of completion type Completion int const ( @@ -348,7 +349,7 @@ func (m *Messenger) Prompt(prompt, placeholder, historyType string, completionTy return response, canceled } -// DownHistory fetches the previous item in the history +// UpHistory fetches the previous item in the history func (m *Messenger) UpHistory(history []string) { if m.historyNum > 0 { m.historyNum-- diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index bf3f8e9d..189d79b1 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -44,8 +44,10 @@ var ( // Version is the version number or commit hash // These variables should be set by the linker when compiling - Version = "0.0.0-unknown" - CommitHash = "Unknown" + Version = "0.0.0-unknown" + // CommitHash is the commit this version was built on + CommitHash = "Unknown" + // CompileDate is the date this binary was compiled on CompileDate = "Unknown" // The list of views diff --git a/cmd/micro/scrollbar.go b/cmd/micro/scrollbar.go index 6389b9a6..f4a9a078 100644 --- a/cmd/micro/scrollbar.go +++ b/cmd/micro/scrollbar.go @@ -1,6 +1,6 @@ package main -// Scrollbar represents an optional scrollbar that can be used +// ScrollBar represents an optional scrollbar that can be used type ScrollBar struct { view *View } diff --git a/cmd/micro/tab.go b/cmd/micro/tab.go index 650ce269..b0373670 100644 --- a/cmd/micro/tab.go +++ b/cmd/micro/tab.go @@ -8,6 +8,8 @@ import ( var tabBarOffset int +// A Tab holds an array of views and a splitTree to determine how the +// views should be arranged type Tab struct { // This contains all the views in this tab // There is generally only one view per tab, but you can have @@ -53,10 +55,13 @@ func (t *Tab) SetNum(num int) { } } +// Cleanup cleans up the tree (for example if views have closed) func (t *Tab) Cleanup() { t.tree.Cleanup() } +// Resize handles a resize event from the terminal and resizes +// all child views correctly func (t *Tab) Resize() { w, h := screen.Size() t.tree.width = w