def testAbortsIfAskedToNotResetDuringInit(self): self.state.action = 'foo' with mock.patch.object(Vintageous.state, '_dont_reset_during_init') as x: x.return_value = True _init_vintageous(self.state.view) self.assertEqual(self.state.action, 'foo')
def run(self): v = self.window.active_view() v.settings().erase("vintage") _init_vintageous(v) DotFile.from_user().run() print("Package.Vintageous: State reset.") sublime.status_message("Vintageous: State reset")
def run(self): v = self.window.active_view() v.settings().erase('vintage') _init_vintageous(v) DotFile.from_user().run() print("Package.Vintageous: State reset.") sublime.status_message("Vintageous: State reset")
def on_activated(self, view): if self.timer: self.timer.cancel() # Switching to a different view; enter normal mode. _init_vintageous(view) else: # Switching back from another application. Ignore. pass
def on_load(self, view): # Without this, on OS X Vintageous might not initialize correctly if the user leaves # the application in a windowless state and then creates a new buffer. if sublime.platform() == 'osx': try: _init_vintageous(view) except AttributeError: _logger().error( '[VintageStateTracker] .settings() missing during .on_load() for {0}' .format(view.file_name()))
def testCallsEnterNormalModeCommandIfStateIsInVisualLineMode(self): self.state.mode = MODE_VISUAL_LINE with mock.patch.object(self.state.view, 'run_command') as m: _init_vintageous(self.state.view) m.assert_called_once_with('enter_normal_mode')
def testCallsEnterNormalModeFromInsertModeCommandIfStateIsInReplaceMode( self): self.state.mode = MODE_REPLACE with mock.patch.object(self.state.view, 'run_command') as m: _init_vintageous(self.state.view) m.assert_called_once_with('vi_enter_normal_mode_from_insert_mode')
def testResetIsCalled(self): self.state.action = 'foo' with mock.patch.object(VintageState, 'reset') as m: _init_vintageous(self.state.view) self.assertEqual(m.call_count, 1)
def testResets(self): self.state.action = 'foo' _init_vintageous(self.state.view) self.assertEqual(self.state.action, None)
def on_new(self, view): # Without this, on OS X Vintageous might not initialize correctly if the user leaves # the application in a windowless state and then creates a new buffer. if sublime.platform() == 'osx': _init_vintageous(view)
def testAbortsIfPassedViewWithoutSettings(self): self.state.action = 'foo' _init_vintageous(object()) self.assertEqual(self.state.action, 'foo')
def on_load(self, view): _init_vintageous(view)
def testCallsRunNormalInsertModeActionsCommandIfStateIsInNormalInsertMode(self): self.state.mode = MODE_NORMAL_INSERT with mock.patch.object(self.state.view, 'run_command') as m: _init_vintageous(self.state.view) m.assert_called_once_with('vi_run_normal_insert_mode_actions')
def run(self): v = self.window.active_view() v.settings().erase('vintage') _init_vintageous(v) print("Package.Vintageous: State reset.") sublime.status_message("Vintageous: State reset")
def testCallsEnterNormalModeFromInsertModeCommandIfStateIsInReplaceMode(self): self.state.mode = MODE_REPLACE with mock.patch.object(self.state.view, 'run_command') as m: _init_vintageous(self.state.view) m.assert_called_once_with('vi_enter_normal_mode_from_insert_mode')
def testCallsRunNormalInsertModeActionsCommandIfStateIsInNormalInsertMode( self): self.state.mode = MODE_NORMAL_INSERT with mock.patch.object(self.state.view, 'run_command') as m: _init_vintageous(self.state.view) m.assert_called_once_with('vi_run_normal_insert_mode_actions')
def testAbortsIfPassedWidget(self): self.state.action = 'foo' self.state.view.settings().set('is_widget', True) _init_vintageous(self.state.view) self.assertEqual(self.state.action, 'foo')
def on_new(self, view): # Without this, on OS X Vintageous might not initialize correctly if # the user leaves the application in a windowless state and then # creates a new buffer. if sublime.platform() == 'osx': _init_vintageous(view)