# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# def max_calls(limit = 1500, name=""):
#     """Decorator which allows its wrapped function to be called `limit` times"""
#     def decorator(func):
#         # Disable limit:
#         return func
#         @wraps(func)
#         def wrapper(*args, **kwargs):
#             calls = getattr(wrapper, 'calls', 0)
#             calls += 1
#             setattr(wrapper, 'calls', calls)
#             fname = name if name != "" else func.__name__
# 
#             if calls == limit + 1:
#                 Debug('max_calls', "LIMIT !! ## !!: Fkt %s has %i calls, stop" % (fname, calls - 1))
# 
#             if calls >= limit + 1:
#                 return None
# 
#             Debug('max_calls', "CALL: Fkt %s has %i calls -> +1" % (fname, calls - 1))
# 
#             return func(*args, **kwargs)
#         setattr(wrapper, 'calls', 0)
#         return wrapper
#     return decorator


import sublime
from ..utils import max_calls, Debug
        choices["down"] = self.adjacent_cell(window,"down",group)
        choices["left"] = self.adjacent_cell(window,"left",group)

        target_dir = None
        for dir,c in choices.items():
            if not c:
                    continue
            if dir in ["up", "down"]:
                    if c[XMIN] == current[XMIN] and c[XMAX] == current[XMAX]:
                            target_dir = dir
            elif dir in ["left", "right"]:
                    if c[YMIN] == current[YMIN] and c[YMAX] == current[YMAX]:
                            target_dir = dir

        if not target_dir: return


        direction = self.opposite_direction(target_dir)
        current_group = window.active_group()
        cell_to_remove = cells[group]

        if cell_to_remove:
            active_view = window.active_view()
            group_to_remove = cells.index(cell_to_remove)
            dupe_views = self.duplicated_views(window,current_group,group_to_remove)
            for d in dupe_views:
                Debug('focus', 'T focus view %i' % d.id())
                window.focus_view(d)
                window.run_command('close')
            if active_view:

# Path: lib/utils/debug.py
# def Debug(classification, text):
#     if 'all' in print_classifications or classification in print_classifications:
#         print("ArcticTypescript: %s: %s" % (classification.ljust(8), text))
#     if classification not in possible_classifications:
#         print("ArcticTypescript: debug: got unknown debug message classification: %s. " \
#             "Consider adding this to possible_classifications" % classification)
#     sys.stdout.flush()
# 
# def max_calls(limit = 1500, name=""):
#     """Decorator which allows its wrapped function to be called `limit` times"""
#     def decorator(func):
#         # Disable limit:
#         return func
#         @wraps(func)
#         def wrapper(*args, **kwargs):
#             calls = getattr(wrapper, 'calls', 0)
#             calls += 1
#             setattr(wrapper, 'calls', calls)
#             fname = name if name != "" else func.__name__
# 
#             if calls == limit + 1:
#                 Debug('max_calls', "LIMIT !! ## !!: Fkt %s has %i calls, stop" % (fname, calls - 1))
# 
#             if calls >= limit + 1:
#                 return None
# 
#             Debug('max_calls', "CALL: Fkt %s has %i calls -> +1" % (fname, calls - 1))
# 
#             return func(*args, **kwargs)
#         setattr(wrapper, 'calls', 0)
#         return wrapper
#     return decorator


# Path: lib/display/Layout.py
import sublime
from ..utils import max_calls, Debug

        choices["down"] = self.adjacent_cell(window,"down",group)
        choices["left"] = self.adjacent_cell(window,"left",group)

        target_dir = None
        for dir,c in choices.items():
            if not c:
                    continue
            if dir in ["up", "down"]:
                    if c[XMIN] == current[XMIN] and c[XMAX] == current[XMAX]:
                            target_dir = dir
            elif dir in ["left", "right"]:
                    if c[YMIN] == current[YMIN] and c[YMAX] == current[YMAX]:
                            target_dir = dir

        if not target_dir: return


        direction = self.opposite_direction(target_dir)
        current_group = window.active_group()
        cell_to_remove = cells[group]

        if cell_to_remove:
            active_view = window.active_view()
            group_to_remove = cells.index(cell_to_remove)
            dupe_views = self.duplicated_views(window,current_group,group_to_remove)
            for d in dupe_views:
                Debug('focus', 'T focus view %i' % d.id())
                window.focus_view(d)
                window.run_command('close')
            if active_view:

                Debug('focus', 'U focus view %i' % active_view.id())