Sha256: d353b364411bc8ed107f7eeef01a51f4478a46bfa03e1d37ef34f8f6a3c64925

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'repl/internal_mirror'

module Redcar
  class REPL
    class OpenInternalREPL < Command
      
      def execute
        tab = win.new_tab(Redcar::EditTab)
        edit_view = tab.edit_view
        edit_view.document.mirror = InternalMirror.new
        edit_view.cursor_offset = edit_view.document.length
        tab.focus
      end
    end
    
    class ReplCommand < Command
      sensitize :open_repl_tab
    end
    
    def self.start
      Sensitivity.new(:open_repl_tab, Redcar.app, false, [:tab_focussed]) do |tab|
        tab and 
        tab.is_a?(EditTab) and 
        tab.edit_view.document.mirror.is_a?(REPL::InternalMirror)
      end
    end
    
    class CommitREPL < ReplCommand
      key :linux   => "Ctrl+M",
          :osx     => "Cmd+M",
          :windows => "Ctrl+M"

      def execute
        edit_view = win.focussed_notebook.focussed_tab.edit_view
        edit_view.document.save!
        edit_view.cursor_offset = edit_view.document.length
        edit_view.scroll_to_line(edit_view.document.line_count)
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redcar-0.3.0dev plugins/repl/lib/repl.rb
redcar-0.2.9dev plugins/repl/lib/repl.rb