def redisplay(): global suggest_handle if buffer_handle: if show_suggestions and suggest_hook: suggestions = suggest_hook(buffer_left, buffer_right) if suggest_handle is None: h = prompt_handle or buffer_handle suggest_handle = term.output(before=h) s = fmt_suggestions(suggestions) suggest_handle.update(s) elif suggest_handle: suggest_handle.update('') if search_idx is None: s = None if buffer_right: s = buffer_left + cursor(buffer_right[0]) + buffer_right[1:] elif show_completion and complete_hook: ret = complete_hook(buffer_left, buffer_right) if ret: s = buffer_left + \ text.underline(cursor(ret[0])) + \ text.underline(ret[1:]) s = s or buffer_left + cursor(' ') buffer_handle.update(s) else: if search_results != []: idx, i, j = search_results[search_idx] buf = history[idx] a, b, c = buf[:i], buf[i:j], buf[j:] s = a + text.bold_green(b) + c else: s = text.white_on_red(buffer_left) buffer_handle.update('(search) ' + s)
def redisplay(): global suggest_handle if buffer_handle: if show_suggestions and suggest_hook: suggestions = suggest_hook(buffer_left, buffer_right) if suggest_handle is None: h = prompt_handle or buffer_handle suggest_handle = term.output(before = h) s = fmt_suggestions(suggestions) suggest_handle.update(s) elif suggest_handle: suggest_handle.update('') if search_idx is None: s = None if buffer_right: s = buffer_left + cursor(buffer_right[0]) + buffer_right[1:] elif show_completion and complete_hook: ret = complete_hook(buffer_left, buffer_right) if ret: s = buffer_left + \ text.underline(cursor(ret[0])) + \ text.underline(ret[1:]) s = s or buffer_left + cursor(' ') buffer_handle.update(s) else: if search_results != []: idx, i, j = search_results[search_idx] buf = history[idx] a, b, c = buf[:i], buf[i:j], buf[j:] s = a + text.bold_green(b) + c else: s = text.white_on_red(buffer_left) buffer_handle.update('(search) ' + s)