Browse files

some fix for miaout17's fix

  • Loading branch information...
1 parent 5f0a8f8 commit 8131423c87ed46a7618bc0bf87b066c74a6a6c11 @godfat committed Aug 6, 2011
Showing with 6 additions and 5 deletions.
  1. +1 −1 lib/ripl/rc/anchor.rb
  2. +5 −4 lib/ripl/rc/color.rb
View
2 lib/ripl/rc/anchor.rb
@@ -22,7 +22,7 @@ def prompt
if Ripl::Rc.const_defined?(:Color) && kind_of?(Ripl::Rc::Color) &&
obj_or_binding = (config[:rc_anchor] ||= []).last
- super.sub(@name, format_result_with_display(obj_or_binding, @name))
+ super.sub(@name, format_color(obj_or_binding, @name))
else
super
end
View
9 lib/ripl/rc/color.rb
@@ -6,11 +6,12 @@ module Ripl::Rc::Color
module_function
def format_result result
- format_result_with_display result
+ return super if Color.disabled?
+ format_color(result)
end
- def format_result_with_display result, display=result.inspect
- return super(result) if Color.disabled?
+ def format_color result, display=result.inspect
+ return super if Color.disabled?
case result
when String ; U.send(U.colors[String ]){ display }
when Numeric; U.send(U.colors[Numeric ]){ display }
@@ -38,7 +39,7 @@ def format_result_with_display result, display=result.inspect
def get_error e, backtrace=e.backtrace
return super if Color.disabled?
- [format_result_with_display(e, "#{e.class.to_s}: #{e.message}"),
+ [format_color(e, "#{e.class.to_s}: #{e.message}"),
backtrace.map{ |b|
path, rest = File.split(b)
name, msgs = rest.split(':', 2)

0 comments on commit 8131423

Please sign in to comment.