# Path: app/curses_util.py
# def column_width(string):
#     """When rendering |string| how many character cells will be used? For ASCII
#     characters this will equal len(string). For many Chinese characters and
#     emoji the value will be greater than len(string), since many of them use two
#     cells.
#     """
#     if app.config.strict_debug:
#         assert isinstance(string, unicode)
#     width = 0
#     for i in string:
#         width += char_width(i, width)
#     return width


import os
import re
import app.buffer_file
import app.log
import app.selectable
from app.curses_util import column_width
        assert 0 <= self.redoIndex <= len(self.redo_chain)
        if self.stallNextRedo:
            self.stallNextRedo = False
            return
        if self.processTempChange:
            self.processTempChange = False
            self.__redo_move(self.tempChange)
            self.update_basic_scroll_position()
            return
        if self.tempChange:
            self.__undo_move(self.tempChange)
            self.tempChange = None
            self.update_basic_scroll_position()
        while self.redoIndex < len(self.redo_chain):
            changes = self.redo_chain[self.redoIndex]
            self.redoIndex += 1
            for change in changes:
                self.__redo_change(change)
            # Stop redoing if we redo a non-trivial action
            if not (
                (changes[0][0] == "f" or changes[0][0] == "m") and len(changes) == 1
            ):
                self.shouldReparse = True
                break
        self.update_basic_scroll_position()

    def __redo_change(self, change):
        if change[0] == "b":  # Redo backspace.
            self.penRow, self.penCol = self.parser.backspace(self.penRow, self.penCol)
        elif change[0] == "bw":  # Redo backspace word.

# Path: app/curses_util.py
# def column_width(string):
#     """When rendering |string| how many character cells will be used? For ASCII
#     characters this will equal len(string). For many Chinese characters and
#     emoji the value will be greater than len(string), since many of them use two
#     cells.
#     """
#     if app.config.strict_debug:
#         assert isinstance(string, unicode)
#     width = 0
#     for i in string:
#         width += char_width(i, width)
#     return width


# Path: app/mutator.py
import os
import re
import app.buffer_file
import app.log
import app.selectable
from app.curses_util import column_width

        assert 0 <= self.redoIndex <= len(self.redo_chain)
        if self.stallNextRedo:
            self.stallNextRedo = False
            return
        if self.processTempChange:
            self.processTempChange = False
            self.__redo_move(self.tempChange)
            self.update_basic_scroll_position()
            return
        if self.tempChange:
            self.__undo_move(self.tempChange)
            self.tempChange = None
            self.update_basic_scroll_position()
        while self.redoIndex < len(self.redo_chain):
            changes = self.redo_chain[self.redoIndex]
            self.redoIndex += 1
            for change in changes:
                self.__redo_change(change)
            # Stop redoing if we redo a non-trivial action
            if not (
                (changes[0][0] == "f" or changes[0][0] == "m") and len(changes) == 1
            ):
                self.shouldReparse = True
                break
        self.update_basic_scroll_position()

    def __redo_change(self, change):
        if change[0] == "b":  # Redo backspace.
            self.penRow, self.penCol = self.parser.backspace(self.penRow, self.penCol)
        elif change[0] == "bw":  # Redo backspace word.

            width = column_width(change[1])