Skip to content

Commit

Permalink
Add additional keys for navigating to the first and last slide
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed Jul 9, 2023
1 parent c1b7dda commit 6cb825e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/slideck/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class CLI
desc "Present Markdown-powered slide decks in the terminal"

desc "Controls:",
" First ^",
" First f, ^",
" Go to 1..n+g",
" Last $",
" Last t, $",
" Next n, l, Right, Spacebar",
" Prev p, h, Left, Backspace",
" Reload r, Ctrl+l",
Expand Down
4 changes: 2 additions & 2 deletions lib/slideck/presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def keypress(event)
case event.value
when "n", "l" then keyright
when "p", "h" then keyleft
when "^" then go_to_first
when "$" then go_to_last
when "f", "^" then go_to_first
when "t", "$" then go_to_last
when "g" then go_to_slide
when /\d/ then add_to_buffer(event.value)
when "r" then keyctrl_l
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
Present Markdown-powered slide decks in the terminal
Controls:
First ^
First f, ^
Go to 1..n+g
Last $
Last t, $
Next n, l, Right, Spacebar
Prev p, h, Left, Backspace
Reload r, Ctrl+l
Expand Down
8 changes: 7 additions & 1 deletion spec/unit/presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def build_metadata(custom_metadata)
reader, renderer, tracker, screen, output) do
[metadata, slides]
end
input << "$" << "^" << "\e"
input << "t" << "f" << "$" << "^" << "\e"
input.rewind

presenter.start
Expand All @@ -184,6 +184,12 @@ def build_metadata(custom_metadata)
"\e[2J\e[1;1H",
"\e[1;1Hslide1\n",
"\e[8;16H1 / 3",
"\e[2J\e[1;1H",
"\e[1;1Hslide3\n",
"\e[8;16H3 / 3",
"\e[2J\e[1;1H",
"\e[1;1Hslide1\n",
"\e[8;16H1 / 3",
"\e[2J\e[1;1H\e[?25h"
].join.inspect)
end
Expand Down

0 comments on commit 6cb825e

Please sign in to comment.