diff options
author | Stan Lo <[email protected]> | 2023-08-09 15:57:47 +0100 |
---|---|---|
committer | git <[email protected]> | 2023-08-09 14:57:52 +0000 |
commit | ab0f90f1f5583a64a125701e3b08f6620f029eb6 () | |
tree | 2998b14ea2cdb106ea71e5beba2aa38257ac13fe /lib/irb/context.rb | |
parent | 6acfc50bccf0c201f77c274281ac33920a0a6923 (diff) |
[ruby/irb] Fix nested IRB sessions' history saving
(https://.com/ruby/irb/pull/652) 1. Dynamically including `HistorySavingAbility` makes things unnecessarily complicated and should be avoided. 2. Because both `Reline` and `Readline` use a single `HISTORY` constant to store history data. When nesting IRB sessions, only the first IRB session should handle history loading and saving so we can avoid duplicating history. 3. History saving callback should NOT be stored in `IRB.conf` as it's recreated every time `IRB.setup` is called, which would happen when nesting IRB sessions. https://.com/ruby/irb/commit/0fef0ae160
-rw-r--r-- | lib/irb/context.rb | 10 |
1 files changed, 0 insertions, 10 deletions
@@ -8,7 +8,6 @@ require_relative "workspace" require_relative "inspector" require_relative "input-method" require_relative "output-method" -require_relative "history" module IRB # A class that wraps the current state of the irb session, including the @@ -130,8 +129,6 @@ module IRB else @io = input_method end - self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY] - @extra_doc_dirs = IRB.conf[:EXTRA_DOC_DIRS] @echo = IRB.conf[:ECHO] @@ -154,13 +151,6 @@ module IRB def save_history=(val) IRB.conf[:SAVE_HISTORY] = val - - if val - context = (IRB.conf[:MAIN_CONTEXT] || self) - if context.io.support_history_saving? && !context.io.singleton_class.include?(HistorySavingAbility) - context.io.extend(HistorySavingAbility) - end - end end def save_history |