Пример #1
0
    def move_tabs(self, args):
        """
        This command allows to close tabs and move them around.

        It lists current tabs, opens an editor, and when editor is done, it
        detects which tabs where deleted and which where moved. It closes/
        removes tabs, and moves the rest accordingly.

        Alg:
        1. find maximum sequence of ordered tabs in the output
        2. take another tab from the input,
            - find a position in the output where to put that new tab,
              using binary search
            - insert that tab
        3. continue until no input tabs out of order are left
        """
        tabs_before = self.list_tabs(args, print_error=True)
        tabs_after = edit_tabs_in_editor(tabs_before)
        if tabs_after is None:
            return

        for api in self._apis:
            self._move_tabs_if_changed(
                api,
                api.filter_tabs(tabs_before),
                api.filter_tabs(tabs_after))
Пример #2
0
 def test_run_editor_windows_custom(self, _system_mock, _run_editor_mock):
     assert ['1'] == edit_tabs_in_editor(['1'])
     editor, filename = _run_editor_mock.call_args[0]
     assert editor == 'custom'
     assert not os.path.exists(filename)