Skip to content
Browse files

go to aliases to go to the tallest and widest slides

  • Loading branch information...
1 parent dff659d commit 79e9c9cfb6bca0a896117f337438a7d8b3e7a9f8 @fxn committed May 7, 2016
Showing with 20 additions and 5 deletions.
  1. +3 −3 README.md
  2. +17 −2 bin/tkn
View
6 README.md
@@ -153,7 +153,7 @@ There is one hard-coded visual effect: Once the exact characters of a given slid
* Last slide: "$".
-* Go to slide: "g".
+* Go to slide: "g" (accepts a 1-based index, "t" for tallest, and "w" for widest, useful for checking font size).
* Search for slide: "/".
@@ -181,9 +181,9 @@ For your preferred setup you typically have one profile per resolution:
2. Set the screen to that resolution. In Mac OS X, if the resolution is not included among the ones available in the Displays configuration panel, try holding the Option key while clicking on the "Scaled" radio button.
-3. Choose font and font size with a maximized window, check a slide with long horizontal or vertical content. Write down the number of rows and columns. Depending on your terminal configuration they may be displayed in the title bar of the window. Run `stty size` otherwise.
+3. Choose font and font size with a maximized window, make sure the widest and tallest slides in the deck fit (using `g t RET` and `g w RET` respectively). Check the number of rows and columns by opening a shell inside the presentation with `c` and running `stty size` (Ctrl-D to go back to the presentation).
-4. Then, define in your terminal a profile for that resolution, choose a theme you like and configure those settings. In particular set the initial rows and cols to those figures.
+4. Then, define in your terminal a profile for that resolution, choose a theme you like and configure those settings. In particular set font size and the initial rows and cols to those figures.
Using that profile the terminal will launch with all set no matter the screen resolution and you can hack your talk in your day to day with the native resolution, seeing how it is going to look in proportion.
View
19 bin/tkn
@@ -228,8 +228,23 @@ end
def go_to(n)
target = prompt('Go to')
- n = target.to_i - 1 if target.length > 0
- n
+ return n if target.length == 0
+
+ if target == 'w'
+ widths = []
+ $slides.each.with_index do |slide, i|
+ widths << [i, width(slide[:content])]
+ end
+ widths.max_by(&:last).first
+ elsif target == 't'
+ heights = []
+ $slides.each.with_index do |slide, i|
+ heights << [i, slide[:content].count("\n")]
+ end
+ heights.max_by(&:last).first
+ else
+ [[target.to_i, 1].max, $slides.length].min - 1
+ end
end
def search_for(n)

0 comments on commit 79e9c9c

Please sign in to comment.
Something went wrong with that request. Please try again.