<commit_before>import curses
import curses.wrapper
import curses.textpad


def initborder(window):
    window.attrset(curses.color_pair(1))
    window.border()
    window.attrset(curses.color_pair(0))

def cursesapp(s):

    # initialize a blank window with a border
    height,width = s.getmaxyx()
    curses.use_default_colors()
    curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_WHITE)
    curses.init_pair(3, curses.COLOR_BLUE, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_WHITE)
    curses.init_pair(5, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(6, curses.COLOR_GREEN, curses.COLOR_WHITE)
    curses.init_pair(7, curses.COLOR_YELLOW, curses.COLOR_BLACK)
    curses.init_pair(8, curses.COLOR_YELLOW, curses.COLOR_WHITE)
    s.keypad(1)
    s.bkgd(' ',curses.color_pair(1))

    initborder(s)

    x=1
    y=1
    s.move(y,x)

    text_color_pair = 1

    # setup
    while True:
        height,width = s.getmaxyx()
        c = s.getch()
        if c == 10: # CR
            y += 1
            x =  1
            s.move(y,x)
        elif c == 263: # backspace
            s.addch(y,x-1,32)
            x -= 1
        elif c == 12:
           s.refresh()
        elif c == 259: # up arrow
            y -= 1
        elif c == 258: # down arrow
            y += 1
        elif c == 260: # left arrow
            x -= 1
        elif c == 261: # right arrow
            x += 1
        elif c == 273: # F9
            text_color_pair = (text_color_pair - 1) % 8
        elif c == 274: # F10
            text_color_pair = (text_color_pair + 1) % 8

        elif 255 > c  and 32 <= c :
            # printable ascii char, emit it with the current colour
            s.attrset(curses.color_pair(text_color_pair))
            s.addstr(y,x,
                curses.keyname(c)
            )
            s.attrset(curses.color_pair(0))
            x += 1

        if x < 1:<commit_msg>Clarify which color pairs affect border and such<commit_after>import curses
import curses.wrapper
import curses.textpad


def initborder(window):
    window.attrset(curses.color_pair(1))
    window.border()
    window.attrset(curses.color_pair(0))

def cursesapp(s):

    # initialize a blank window with a border
    height,width = s.getmaxyx()
    curses.use_default_colors()

    # color pair 1 is the pair that will be used for the border+background
    # the default for the text itself can be set in text_color_pair
    curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE)
    curses.init_pair(2, curses.COLOR_RED, curses.COLOR_WHITE)
    curses.init_pair(3, curses.COLOR_BLUE, curses.COLOR_BLACK)
    curses.init_pair(4, curses.COLOR_BLUE, curses.COLOR_WHITE)
    curses.init_pair(5, curses.COLOR_GREEN, curses.COLOR_BLACK)
    curses.init_pair(6, curses.COLOR_GREEN, curses.COLOR_WHITE)
    curses.init_pair(7, curses.COLOR_YELLOW, curses.COLOR_BLACK)
    curses.init_pair(8, curses.COLOR_YELLOW, curses.COLOR_WHITE)
    s.keypad(1)
    s.bkgd(' ',curses.color_pair(1))

    initborder(s)

    x=1
    y=1
    s.move(y,x)

    # default color pair for text
    # change on the fly with F9/F10
    text_color_pair = 3

    # setup
    while True:
        height,width = s.getmaxyx()
        c = s.getch()
        if c == 10: # CR
            y += 1
            x =  1
            s.move(y,x)
        elif c == 263: # backspace
            s.addch(y,x-1,32)
            x -= 1
        elif c == 12:
           s.refresh()
        elif c == 259: # up arrow
            y -= 1
        elif c == 258: # down arrow
            y += 1
        elif c == 260: # left arrow
            x -= 1
        elif c == 261: # right arrow
            x += 1
        elif c == 273: # F9
            text_color_pair = (text_color_pair - 1) % 8
        elif c == 274: # F10
            text_color_pair = (text_color_pair + 1) % 8

        elif 255 > c  and 32 <= c :
            # printable ascii char, emit it with the current color
            s.attrset(curses.color_pair(text_color_pair))
            s.addstr(y,x,
                curses.keyname(c)
            )
            s.attrset(curses.color_pair(0))
            x += 1

        if x < 1:
{'fraction_non_alphanumeric': 0.10732860520094563, 'fraction_numerical': 0.03167848699763593, 'mean_word_length': 1.9484320557491288, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5763848', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1488, 'n_words': 343}