Handle lacking infocmp a little smoother

git-svn-id: file:///home/svn/framework3/trunk@7091 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2009-09-29 03:30:15 +00:00
parent 542b3de249
commit 7b28cdacd8
1 changed files with 4 additions and 1 deletions

View File

@ -1822,7 +1822,10 @@ module RbReadline
def get_term_capabilities(buffer)
hash = {}
IO.popen('infocmp -C 2>/dev/null').read.split(':').select{|x| x =~ /(.*)=(.*)/ and hash[$1]=$2.gsub('\\E',"\e").gsub(/\^(.)/){($1[0].ord ^ ((?a..?z).include?($1[0]) ? 0x60 : 0x40)).chr}}
buff = IO.popen('infocmp -C 2>/dev/null').read
if(buff and not buff.empty? and buff !~ /couldn't open terminfo/)
buff.split(':').select{|x| x =~ /(.*)=(.*)/ and hash[$1]=$2.gsub('\\E',"\e").gsub(/\^(.)/){($1[0].ord ^ ((?a..?z).include?($1[0]) ? 0x60 : 0x40)).chr}}
end
@_rl_term_at7 = hash["@7"]
@_rl_term_DC = hash["DC"]
@_rl_term_IC = hash["IC"]