Exemple #1
0
    def _move_tabs_if_changed(self, api, tabs_before, tabs_after):
        delete_commands, move_commands = infer_delete_and_move_commands(
            parse_tab_lines(tabs_before), parse_tab_lines(tabs_after))

        if delete_commands:
            print('DELETE', delete_commands)
            api.close_tabs(delete_commands)

        if move_commands:
            print('MOVE', move_commands)
            api.move_tabs(move_commands)
Exemple #2
0
 def test_move_one_to_another_existing_window_same_index(self):
     before = parse_tab_lines([
         'f.0.0\ta\turl',
         'f.1.1\ta\turl',
     ])
     after = parse_tab_lines([
         'f.1.0\ta\turl',
         'f.1.1\ta\turl',
     ])
     delete_commands, move_commands = infer_delete_and_move_commands(before, after)
     self.assertGreater(len(move_commands), 0)
     actual_after = apply_move_commands(before, move_commands)
     self.assertEqual(actual_after, after)
Exemple #3
0
 def test_move_one_to_another_existing_window_above_2(self):
     before = parse_tab_lines([
         'f.0.0\ta1\turl1',
         'f.0.1\ta2\turl2',
         'f.1.2\ta3\turl3',
         'f.1.3\ta4\turl4',
     ])
     after = parse_tab_lines([
         'f.0.0\ta1\turl1',
         'f.0.1\ta2\turl2',
         'f.0.3\ta4\turl4',
         'f.1.2\ta3\turl3',
     ])
     delete_commands, move_commands = infer_delete_and_move_commands(before, after)
     self.assertGreater(len(move_commands), 0)
     actual_after = apply_move_commands(before, move_commands)
     self.assertEqual(actual_after, after)
Exemple #4
0
    def _move_tabs_if_changed(self, api, tabs_before, tabs_after):
        # if tabs_after is None:
        # return

        # from pprint import pprint
        # print('_move_tabs_if_changed tabs_before')
        # pprint(tabs_before)
        # print('_move_tabs_if_changed tabs_after')
        # pprint(tabs_after)

        delete_commands, move_commands = infer_delete_and_move_commands(
            parse_tab_lines(tabs_before), parse_tab_lines(tabs_after))

        if delete_commands:
            api.close_tabs(delete_commands)
            # raise RuntimeError('DELETE COMMANDS ARE NOT SUPPORTED YET')

        api.move_tabs(move_commands)
Exemple #5
0
 def _eq(self, tabs_before, tabs_after, expected_deletes, expected_moves):
     deletes, moves = infer_delete_and_move_commands(
         parse_tab_lines(tabs_before),
         parse_tab_lines( tabs_after))
     self.assertEqual(expected_deletes, deletes)
     self.assertEqual(expected_moves, moves)