[ruby-trunk - Bug #6302][Open] irb で math-mode 中でも conf.math mode に nil を代入すると math-mode を抜ける事ができる

Issue #6302 has been reported by sho-h (Sho H.).


Bug #6302: irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode
を抜ける事ができる

Author: sho-h (Sho H.)
Status: Open
Priority: Low
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

irb では、一度 math-mode になった場合は抜ける事ができない仕様だと思いますが、conf.math_mode に nil
を代入すると math-mode を抜ける事ができてしまうようです。(1.9.3-p125 で確認しましたが、trunk でも同様のようです)

conf.math_mode = true
=> true
conf.math_mode = nil
=> nil
conf.math_mode = false
=> false
conf.math_mode = true
=> true
conf.math_mode = false
IRB::CantReturnToNormalMode: Normalモードに戻れません.
from (irb):10
from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `’

false 以外でも抜ける事ができるように修正するのがよいのではないかと思いました。

— lib/irb/ext/math-mode.rb (revision 35336)
+++ lib/irb/ext/math-mode.rb (working copy)
@@ -16,7 +16,7 @@
alias math? math_mode

 def math_mode=(opt)
  •  if @math_mode == true && opt == false
    
  •  if @math_mode == true && !opt
      IRB.fail CantReturnToNormalMode
      return
     end
    

Issue #6302 has been updated by ayumin (Ayumu AIZAWA).

Category set to lib
Assignee set to keiju (Keiju Ishitsuka)


Bug #6302: irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode
を抜ける事ができる

Author: sho-h (Sho H.)
Status: Open
Priority: Low
Assignee: keiju (Keiju Ishitsuka)
Category: lib
Target version:
ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

irb では、一度 math-mode になった場合は抜ける事ができない仕様だと思いますが、conf.math_mode に nil
を代入すると math-mode を抜ける事ができてしまうようです。(1.9.3-p125 で確認しましたが、trunk でも同様のようです)

conf.math_mode = true
=> true
conf.math_mode = nil
=> nil
conf.math_mode = false
=> false
conf.math_mode = true
=> true
conf.math_mode = false
IRB::CantReturnToNormalMode: Normalモードに戻れません.
from (irb):10
from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `’

false 以外でも抜ける事ができるように修正するのがよいのではないかと思いました。

— lib/irb/ext/math-mode.rb (revision 35336)
+++ lib/irb/ext/math-mode.rb (working copy)
@@ -16,7 +16,7 @@
alias math? math_mode

 def math_mode=(opt)
  •  if @math_mode == true && opt == false
    
  •  if @math_mode == true && !opt
      IRB.fail CantReturnToNormalMode
      return
     end
    

Issue #6302 has been updated by mame (Yusuke E.).

Status changed from Open to Assigned


Bug #6302: irb で math-mode 中でも conf.math_mode に nil を代入すると math-mode
を抜ける事ができる

Author: sho-h (Sho H.)
Status: Assigned
Priority: Low
Assignee: keiju (Keiju Ishitsuka)
Category: lib
Target version:
ruby -v: ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

irb では、一度 math-mode になった場合は抜ける事ができない仕様だと思いますが、conf.math_mode に nil
を代入すると math-mode を抜ける事ができてしまうようです。(1.9.3-p125 で確認しましたが、trunk でも同様のようです)

conf.math_mode = true
=> true
conf.math_mode = nil
=> nil
conf.math_mode = false
=> false
conf.math_mode = true
=> true
conf.math_mode = false
IRB::CantReturnToNormalMode: Normalモードに戻れません.
from (irb):10
from /home/sho-h/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `’

false 以外でも抜ける事ができるように修正するのがよいのではないかと思いました。

— lib/irb/ext/math-mode.rb (revision 35336)
+++ lib/irb/ext/math-mode.rb (working copy)
@@ -16,7 +16,7 @@
alias math? math_mode

 def math_mode=(opt)
  •  if @math_mode == true && opt == false
    
  •  if @math_mode == true && !opt
      IRB.fail CantReturnToNormalMode
      return
     end