diff --git a/command.go b/command.go index 4e5b0d06..20dbcd55 100644 --- a/command.go +++ b/command.go @@ -54,6 +54,8 @@ var CommandFuncs = map[parser.CommandType]CommandFunc{ token.PAGE_DOWN: ExecuteKey(input.PageDown), token.SCROLL_UP: ExecuteScroll(-1), token.SCROLL_DOWN: ExecuteScroll(1), + token.HOME: ExecuteKey(input.Home), + token.END: ExecuteKey(input.End), token.HIDE: ExecuteHide, token.REQUIRE: ExecuteRequire, token.SHOW: ExecuteShow, @@ -237,6 +239,10 @@ func ExecuteCtrl(c parser.Command, v *VHS) error { inputKey = &input.ArrowUp case "Down": inputKey = &input.ArrowDown + case "Home": + inputKey = &input.Home + case "End": + inputKey = &input.End default: r := rune(key[0]) if k, ok := keymap[r]; ok { diff --git a/command_test.go b/command_test.go index 19ddc98a..ad582cf9 100644 --- a/command_test.go +++ b/command_test.go @@ -13,7 +13,7 @@ func TestCommand(t *testing.T) { t.Errorf("Expected %d commands, got %d", numberOfCommands, len(parser.CommandTypes)) } - const numberOfCommandFuncs = 31 + const numberOfCommandFuncs = 33 if len(CommandFuncs) != numberOfCommandFuncs { t.Errorf("Expected %d commands, got %d", numberOfCommandFuncs, len(CommandFuncs)) } diff --git a/parser/parser.go b/parser/parser.go index 39a4dcb4..8c56c51a 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -331,6 +331,8 @@ func (p *Parser) parseCtrl() Command { peek.Type == token.RIGHT, peek.Type == token.UP, peek.Type == token.DOWN, + peek.Type == token.HOME, + peek.Type == token.END, peek.Type == token.STRING && len(peek.Literal) == 1: args = append(args, peek.Literal) default: