Skip to content

Commit db435fe

Browse files
authored
Merge pull request #10 from ArkieCoder/kittysupport
Add terminal size check and fix viu system call
2 parents ce26eea + c11db69 commit db435fe

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/stringformat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def iterm2?
5353
system("convert -density 130 #{pdf_file} #{png_file} >/dev/null 2>&1")
5454
if File.exist?(png_file)
5555
width = (cols * 0.75).to_i
56-
if system("viu -w #{width} #{png_file} >/dev/null 2>&1")
56+
if system("viu -w #{width} #{png_file}") == true
5757
# Clean up
5858
tmp_file.unlink
5959
File.unlink(pdf_file)

rp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ end
1818
load "#{DATA_DIR}/lib/stringformat.rb"
1919
load "#{DATA_DIR}/lib/sayings.rb"
2020

21+
# Check terminal size
22+
cols = `tput cols`.to_i
23+
lines = `tput lines`.to_i
24+
if cols < 135 || lines < 40
25+
puts "Terminal must be at least 135 columns x 40 rows. Current: #{cols}x#{lines}".red
26+
exit 1
27+
end
28+
2129
def print_header(header)
2230
puts ""
2331
figlet = RubyFiglet::Figlet.new(header, 'standard')

0 commit comments

Comments
 (0)