}
// Remove the whitespaces if keepautoindent setting is off
- if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y - 1)) && !v.Buf.Settings["keepautoindent"].(bool) {
+ if IsSpacesOrTabs(v.Buf.Line(v.Cursor.Y-1)) && !v.Buf.Settings["keepautoindent"].(bool) {
line := v.Buf.Line(v.Cursor.Y - 1)
v.Buf.Remove(Loc{0, v.Cursor.Y - 1}, Loc{Count(line), v.Cursor.Y - 1})
}
if closeAll {
// only quit if all of the buffers can be closed and the user confirms that they actually want to quit everything
- should_quit, _ := messenger.YesNoPrompt("Do you want to quit micro (all open files will be closed)?")
-
- if should_quit {
+
+ shouldQuit, _ := messenger.YesNoPrompt("Do you want to quit micro (all open files will be closed)?")
+
+ if shouldQuit {
for _, tab := range tabs {
for _, v := range tab.views {
v.CloseBuffer()
return chosen, suggestions
}
-// MakeCompletion registeres a function from a plugin for autocomplete commands
+// MakeCompletion registers a function from a plugin for autocomplete commands
func MakeCompletion(function string) Completion {
pluginCompletions = append(pluginCompletions, LuaFunctionComplete(function))
return Completion(-len(pluginCompletions))
if helpBinding == k && v != "ToggleHelp" {
helpBinding = ""
}
-
+
actionNames := strings.Split(v, ",")
if actionNames[0] == "UnbindKey" {
delete(bindings, key)
data, err := br.ReadBytes('\n')
if err != nil {
if err == io.EOF {
- la.lines = append(la.lines, data[:len(data)])
+ la.lines = append(la.lines, data[:])
}
// Last line was read
break
"os"
"strings"
- "layeh.com/gopher-luar"
"github.com/yuin/gopher-lua"
+ "layeh.com/gopher-luar"
)
var loadedPlugins map[string]string
package main
-// SpltType specifies whether a split is horizontal or vertical
+// SplitType specifies whether a split is horizontal or vertical
type SplitType bool
const (
return false
}
str, indicies := TabbarString()
- if x + tabBarOffset >= len(str) {
+ if x+tabBarOffset >= len(str) {
return false
}
var tabnum int
}
sort.Ints(keys)
for _, k := range keys {
- if x + tabBarOffset <= k {
+ if x+tabBarOffset <= k {
tabnum = indicies[k] - 1
break
}
if tooWide == true {
// first we have to work out where the selected tab is
// out of the total length of the tab bar. this is done
- // by extracting the hit-areas from the indicies map
+ // by extracting the hit-areas from the indicies map
// that was constructed by `TabbarString()`
var keys []int
for offset := range indicies {
rightBuffer := currentTabOffset + (centeringOffset / 2)
// check to make sure we haven't overshot the bounds of the string,
- // if we have, then take that remainder and put it on the left side
+ // if we have, then take that remainder and put it on the left side
overshotRight := rightBuffer - len(fileRunes)
if overshotRight > 0 {
leftBuffer = leftBuffer + overshotRight
} else {
rightBuffer = leftBuffer + (w - 2)
}
-
- if rightBuffer > len(fileRunes) - 1 {
+
+ if rightBuffer > len(fileRunes)-1 {
rightBuffer = len(fileRunes) - 1
}
- // construct a new buffer of text to put the
+ // construct a new buffer of text to put the
// newly formatted tab bar text into.
var displayText []rune
}
// if there is more text to the right of the right-most
// column in the tab bar text, then indicate there are more
- // tabs to ther right by displaying a "+"
- if rightBuffer < len(fileRunes) - 1 {
+ // tabs to the right by displaying a "+"
+ if rightBuffer < len(fileRunes)-1 {
displayText = append(displayText, '+')
}
// now store the offset from zero of the left-most text
- // that is being displayed. This is to ensure that when
+ // that is being displayed. This is to ensure that when
// clicking on the tab bar, the correct tab gets selected.
tabBarOffset = leftBuffer
}
// iterate over the width of the terminal display and for each column,
- // write a character into the tab display area with the appropraite style.
+ // write a character into the tab display area with the appropriate style.
for x := 0; x < w; x++ {
if x < len(fileRunes) {
screen.SetContent(x, 0, fileRunes[x], nil, tabBarStyle)
package main
import (
- "os"
- "fmt"
- "runtime"
- "io/ioutil"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "runtime"
)
func check(e error) {
- if e != nil {
- panic(e)
- }
+ if e != nil {
+ panic(e)
+ }
}
func main() {
- if runtime.GOOS == "darwin" {
- if len(os.Args) == 2 {
- raw_info_plist_string := `<?xml version="1.0" encoding="UTF-8"?>
+ if runtime.GOOS == "darwin" {
+ if len(os.Args) == 2 {
+ rawInfoPlistString := `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
`
- info_plist_data := []byte(raw_info_plist_string)
-
- err := ioutil.WriteFile("/tmp/micro-info.plist", info_plist_data, 0644)
- check(err)
- fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
- } else {
- panic("missing argument for version number!")
- }
- }
+ infoPlistData := []byte(rawInfoPlistString)
+
+ err := ioutil.WriteFile("/tmp/micro-info.plist", infoPlistData, 0644)
+ check(err)
+ fmt.Println("-linkmode external -extldflags -Wl,-sectcreate,__TEXT,__info_plist,/tmp/micro-info.plist")
+ } else {
+ panic("missing argument for version number!")
+ }
+ }
}