Sha256: 26ffe51b5d7314f6fb160efd9b4b87053c0beffed6cc2db3e22f913f0b640d91
Contents?: true
Size: 1.61 KB
Versions: 14
Compression:
Stored size: 1.61 KB
Contents
require 'repl/internal_mirror' module Redcar class REPL def self.sensitivities [ 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 def self.keymaps osx = Keymap.build("main", :osx) do link "Cmd+Shift+M", REPL::OpenInternalREPL link "Cmd+M", REPL::CommitREPL end linwin = Keymap.build("main", [:linux, :windows]) do link "Ctrl+Shift+M", REPL::OpenInternalREPL link "Ctrl+M", REPL::CommitREPL end [linwin, osx] end def self.menus Menu::Builder.build do sub_menu "Plugins" do sub_menu "REPL" do item "Open", REPL::OpenInternalREPL item "Execute", REPL::CommitREPL end end end end class OpenInternalREPL < Command def execute tab = win.new_tab(Redcar::EditTab) edit_view = tab.edit_view edit_view.document.mirror = REPL::InternalMirror.new edit_view.cursor_offset = edit_view.document.length tab.focus end end class ReplCommand < Command sensitize :open_repl_tab end class CommitREPL < ReplCommand 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
14 entries across 14 versions & 1 rubygems