exe/helpline in helpline-0.1.8 vs exe/helpline in helpline-0.1.9
- old
+ new
@@ -128,21 +128,21 @@
g = ExpandRuby::Generator.new # re_expandのジェネレータ
#
# HelpLineエントリ
#
- lines = []
+ entries = []
data['defs'].each { |line|
if line =~ /^\s*\$\s*(.*)$/ # $....
- lines << $1
+ entries << $1
elsif line =~ /^\s*\%\s*(.*)$/ # %....
cmd = $1
- lines.each { |l|
+ entries.each { |l|
desc = eval('"' + l + '"')
g.add desc.force_encoding('utf-8'), cmd.force_encoding('utf-8')
}
- lines = []
+ entries = []
end
}
# puts "GENERATE #{params.split('|').join(' ')} "
@@ -178,10 +178,13 @@
}
sel = 0
disp(list,sel)
+ lines = list.length
+ lines = LINES if lines > LINES
+
inputchars = ''
while true
c = STDIN.getch
inputchars += c
@@ -195,11 +198,11 @@
elsif inputchars == "\x02" || inputchars == "\e[D" || inputchars == "\eOD"
# Curses.left
inputchars = ''
elsif inputchars == "\x0e" || inputchars == "\e[B" || inputchars == "\eOB"
Curses.down
- sel = (sel + 1) if sel < LINES-1
+ sel = (sel + 1) if sel < lines-1
inputchars = ''
elsif inputchars == "\x10" || inputchars == "\e[A" || inputchars == "\eOA"
Curses.up
sel = sel - 1 if sel > 0
inputchars = ''
@@ -217,10 +220,10 @@
end
desc = list[sel.to_i][0]
cmd = list[sel][1]
- Curses.move(lines.length,0)
+ Curses.move(lines,0)
#Curses.move(0,0)
##Curses.down
##Curses.tol
Curses.print_inverse("「#{desc}」を実行")
puts " (ソース: http://scrapbox.io/HelpLine/#{data['pages'][help_number[desc]]})"