def prompt(state):
    while True:
        c = readchar.get_symbol()
        if c == keys.ENTER:
            if state.get_matches():
                state.append_match_to_input()
            break
        elif c == keys.CTRL_F:
            break
        elif c == keys.TAB:
            if state.get_matches():
                state.append_match_to_input()
        elif c == keys.CTRL_C or c == keys.ESC:
            state.reset_input()
            break
        elif c == keys.CTRL_U:
            state.clear_input()
        elif c == keys.BACKSPACE:
            state.set_input(state.input[0:-1])
        elif c == keys.UP or c == keys.CTRL_K:
            state.select_previous()
        elif c == keys.DOWN or c == keys.CTRL_J:
            state.select_next()
        elif c == keys.LEFT or c == keys.CTRL_H:
            state.go_back()
        elif c == keys.RIGHT or c == keys.CTRL_L:
            if state.get_matches():
                state.append_match_to_input()
        elif c < 256 and c >= 32:
            state.set_input(state.input + chr(c))
        ui.refresh(state)
dataset/ETHPy150Open pindexis/qfc/qfc/core.py/prompt/original