Fix minor issues found by gofmt, go vet, and misspell.

This commit is contained in:
Qi Xiao 2017-12-14 01:27:32 +00:00
parent 6d70cbef50
commit 81617e8ef2
6 changed files with 21 additions and 22 deletions

View File

@ -12,7 +12,7 @@ import (
)
type candidate struct {
code string // This is what will be substitued on the command line.
code string // This is what will be substituted on the command line.
menu ui.Styled // This is what is displayed in the completion menu.
}

View File

@ -30,17 +30,17 @@ var _ = registerBuiltins(modeListing, map[string]func(*Editor){
func init() {
registerBindings(modeListing, modeListing, map[ui.Key]string{
ui.Key{ui.Up, 0}: "up",
ui.Key{ui.PageUp, 0}: "page-up",
ui.Key{ui.Down, 0}: "down",
ui.Key{ui.PageDown, 0}: "page-down",
ui.Key{ui.Tab, 0}: "down-cycle",
ui.Key{ui.Tab, ui.Shift}: "up-cycle",
ui.Key{ui.Backspace, 0}: "backspace",
ui.Key{ui.Enter, 0}: "accept-close",
ui.Key{ui.Enter, ui.Alt}: "accept",
ui.Default: "default",
ui.Key{'[', ui.Ctrl}: "insert:start",
{ui.Up, 0}: "up",
{ui.PageUp, 0}: "page-up",
{ui.Down, 0}: "down",
{ui.PageDown, 0}: "page-down",
{ui.Tab, 0}: "down-cycle",
{ui.Tab, ui.Shift}: "up-cycle",
{ui.Backspace, 0}: "backspace",
{ui.Enter, 0}: "accept-close",
{ui.Enter, ui.Alt}: "accept",
ui.Default: "default",
{'[', ui.Ctrl}: "insert:start",
})
}

View File

@ -39,8 +39,8 @@ func TestListing(t *testing.T) {
// the first 2 elements, with the first being shown as selected.
testListingList(t, 0, 2, listingWithScrollBarRenderer{
listingRenderer: listingRenderer{[]ui.Styled{
ui.Styled{"0 foo", styleForSelected},
ui.Styled{"1 bar", ui.Styles{}},
{"0 foo", styleForSelected},
{"1 bar", ui.Styles{}},
}},
n: 5, low: 0, high: 2, height: 2,
})
@ -48,8 +48,8 @@ func TestListing(t *testing.T) {
// the last 2 elements, with the last being shown as selected.
testListingList(t, 4, 2, listingWithScrollBarRenderer{
listingRenderer: listingRenderer{[]ui.Styled{
ui.Styled{"3 lorem", ui.Styles{}},
ui.Styled{"4 ipsum", styleForSelected},
{"3 lorem", ui.Styles{}},
{"4 ipsum", styleForSelected},
}},
n: 5, low: 3, high: 5, height: 2,
})
@ -58,9 +58,9 @@ func TestListing(t *testing.T) {
// shown as selected.
testListingList(t, 2, 3, listingWithScrollBarRenderer{
listingRenderer: listingRenderer{[]ui.Styled{
ui.Styled{"1 bar", ui.Styles{}},
ui.Styled{"2 foobar", styleForSelected},
ui.Styled{"3 lorem", ui.Styles{}},
{"1 bar", ui.Styles{}},
{"2 foobar", styleForSelected},
{"3 lorem", ui.Styles{}},
}},
n: 5, low: 1, high: 4, height: 3,
})

View File

@ -90,7 +90,7 @@ func glob(segs []Segment, dir string, cb func(string) bool) bool {
}
nexti()
// Enumerate the position of the first slash. In the presense of multiple
// Enumerate the position of the first slash. In the presence of multiple
// **'s in the pattern, the first slash may be in any of those.
//
// For instance, in x**y**z, the first slash may be in the first ** or the

View File

@ -32,7 +32,6 @@ func (ed *minEditor) ReadLine() (string, error) {
// Chop off the trailing \r on Windows.
line = strings.TrimRight(line, "\r\n")
return line, err
return ed.in.ReadString('\n')
}
func (editor *minEditor) Close() {

View File

@ -22,7 +22,7 @@ func TestClaimFile(t *testing.T) {
for _, test := range claimFileTests {
f, err := ClaimFile(".", test.pattern)
if err != nil {
t.Error("ClaimFile errors: %s", err)
t.Errorf("ClaimFile errors: %v", err)
}
if f.Name() != test.wantFileName {
t.Errorf("ClaimFile claims %s, want %s", f.Name(), test.wantFileName)