Small fixes

This commit is contained in:
Zachary Yedidia
2019-06-15 22:23:19 -04:00
parent 0f4f60c018
commit 7cd5024e34
3 changed files with 7 additions and 5 deletions

View File

@@ -57,7 +57,9 @@ func (b *Buffer) CycleAutocomplete(forward bool) {
}
b.Replace(start, end, b.Completions[b.CurSuggestion])
b.HasSuggestions = true
if len(b.Suggestions) > 1 {
b.HasSuggestions = true
}
}
func GetArg(b *Buffer) (string, int) {

View File

@@ -134,8 +134,8 @@ func NewBufferFromFile(path string, btype BufType) (*Buffer, error) {
defer file.Close()
cursorLoc, err := ParseCursorLocation(cursorPos)
if err != nil {
cursorLoc, cursorerr := ParseCursorLocation(cursorPos)
if cursorerr != nil {
cursorLoc = Loc{-1, -1}
}
@@ -449,7 +449,7 @@ func (b *Buffer) UpdateRules() {
}
ft := b.Settings["filetype"].(string)
if (ft == "Unknown" || ft == "") && !rehighlight {
if (ft == "unknown" || ft == "") && !rehighlight {
if highlight.MatchFiletype(ftdetect, b.Path, b.lines[0].data) {
header := new(highlight.Header)
header.FileType = file.FileType

View File

@@ -197,7 +197,7 @@ func DefaultGlobalSettings() map[string]interface{} {
// Note that filetype is a local only option
func DefaultLocalSettings() map[string]interface{} {
common := DefaultCommonSettings()
common["filetype"] = "Unknown"
common["filetype"] = "unknown"
return common
}