Sha256: 6d6c257a3a945cd3945cebfae549cdf3ad3c2bf95d3d0b9b2a2563921413f815
Contents?: true
Size: 996 Bytes
Versions: 5
Compression:
Stored size: 996 Bytes
Contents
require 'rib/core/history' # dependency require 'rib/core/multiline' # dependency module Rib; module MultilineHistory extend Plugin Shell.use(self) # --------------- Rib API --------------- def before_loop @multiline_trash = 0 super end def loop_eval input return super if MultilineHistory.disabled? super ensure # SyntaxError might mean we're multiline editing handle_multiline unless multiline?($!) end def handle_interrupt return super if MultilineHistory.disabled? if multiline_buffer.size > 1 multiline_trash @multiline_trash += 1 end super end private def handle_multiline if multiline_buffer.size > 1 # so multiline editing is considering done here # TODO: there's no history.pop(size) (multiline_buffer.size + multiline_trash).times{ history.pop } history << "\n" + multiline_buffer.join("\n") end end def multiline_trash @multiline_trash ||= 0 end end; end
Version data entries
5 entries across 5 versions & 1 rubygems