From 7cd5024e34e99a5d53e7d6beaec7810d9948df6b Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 15 Jun 2019 22:23:19 -0400 Subject: [PATCH] Small fixes --- internal/buffer/autocomplete.go | 4 +++- internal/buffer/buffer.go | 6 +++--- internal/config/settings.go | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/buffer/autocomplete.go b/internal/buffer/autocomplete.go index c5577b6f..d143f329 100644 --- a/internal/buffer/autocomplete.go +++ b/internal/buffer/autocomplete.go @@ -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) { diff --git a/internal/buffer/buffer.go b/internal/buffer/buffer.go index ba595cee..e9523b14 100644 --- a/internal/buffer/buffer.go +++ b/internal/buffer/buffer.go @@ -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 diff --git a/internal/config/settings.go b/internal/config/settings.go index 2740d957..2d0787a9 100644 --- a/internal/config/settings.go +++ b/internal/config/settings.go @@ -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 }