コード例 #1
0
 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')
コード例 #2
0
ファイル: xsupport.py プロジェクト: xlinkerz/Vintageous
 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")
コード例 #3
0
ファイル: xsupport.py プロジェクト: alex-carr/Vintageous
 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")
コード例 #4
0
ファイル: xsupport.py プロジェクト: xlinkerz/Vintageous
 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
コード例 #5
0
ファイル: xsupport.py プロジェクト: alex-carr/Vintageous
 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
コード例 #6
0
ファイル: xsupport.py プロジェクト: fenduru/Vintageous
 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()))
コード例 #7
0
ファイル: xsupport.py プロジェクト: simianhacker/Vintageous
 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()))
コード例 #8
0
 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')
コード例 #9
0
 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')
コード例 #10
0
 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)
コード例 #11
0
 def testResets(self):
     self.state.action = 'foo'
     _init_vintageous(self.state.view)
     self.assertEqual(self.state.action, None)
コード例 #12
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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)
コード例 #13
0
ファイル: xsupport.py プロジェクト: simianhacker/Vintageous
 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)
コード例 #14
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 def testAbortsIfPassedViewWithoutSettings(self):
     self.state.action = 'foo'
     _init_vintageous(object())
     self.assertEqual(self.state.action, 'foo')
コード例 #15
0
ファイル: xsupport.py プロジェクト: scoates/Vintageous
 def on_load(self, view):
     _init_vintageous(view)
コード例 #16
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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')
コード例 #17
0
ファイル: xsupport.py プロジェクト: scoates/Vintageous
 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")
コード例 #18
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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')
コード例 #19
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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')
コード例 #20
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 def testResets(self):
     self.state.action = 'foo'
     _init_vintageous(self.state.view)
     self.assertEqual(self.state.action, None)
コード例 #21
0
 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')
コード例 #22
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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')
コード例 #23
0
ファイル: xsupport.py プロジェクト: hindman/Vintageous
 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)
コード例 #24
0
 def testAbortsIfPassedViewWithoutSettings(self):
     self.state.action = 'foo'
     _init_vintageous(object())
     self.assertEqual(self.state.action, 'foo')
コード例 #25
0
 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')
コード例 #26
0
ファイル: test_state.py プロジェクト: trkoch/Vintageous
 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')