update tput to support terminfo on mac

For some reason clr_eos on the mac responds to "cd" not "ed".
All other codes seem to respond to the cap name, but this one responds
to the tcap code

fixes #313
This commit is contained in:
Keenan Brock 2015-04-25 00:36:43 -04:00
parent 52dbf88f85
commit 76ecc8fa80
2 changed files with 11 additions and 1 deletions

View file

@ -18,7 +18,7 @@ module Mutant
reset = capture('tput reset')
save = capture('tput sc') if reset
restore = capture('tput rc') if save
clean = capture('tput ed') if restore
clean = capture('tput ed') || capture('tput cd') if restore
new(reset + save, restore + clean) if clean
end

View file

@ -34,5 +34,15 @@ RSpec.describe Mutant::Reporter::CLI::Tput do
it { should be(nil) }
end
context 'when ed fails' do
let(:tput_ed?) { false }
let(:tput_cd?) { true }
before do
expect_command('tput cd', '[cd]', tput_cd?)
end
its(:prepare) { should eql('[reset][sc]') }
its(:restore) { should eql('[rc][cd]') }
end
end
end