コード例 #1
0
ファイル: interaction_manager.py プロジェクト: rayleyva/shim
def visual_yank(graphics_state, local_state, global_state):
    """
    Place in copy buffer the text
    currently selected under visual mode
    """
    px, py, pt = local_state.get_visual_anchors()
    nx, ny, nt = local_state.get_page_state()
    txt = text_logic.get_text_range(px, py, pt, nx, ny, nt, local_state)
    global_state.add_copy_buffer(txt)
    global_state.curr_state = 'Default'
    render_page([], [], graphics_state, local_state, global_state)
コード例 #2
0
ファイル: interaction_manager.py プロジェクト: rayleyva/shim
def delete_text_highlight(graphics_state, local_state, global_state):
    """
    Delete text under highlight.
    Cursor corresponds to a highlight over a single character
    i.e Calling delete_text_highlight without visual mode on corresponds to
    deleting a single character or x in vim
    TODO: In the visual mode case this adds the deleted text to the copy buffer
    This should be mirrored in the non visual mode case
    """
    if global_state.curr_state == 'Visual':
        px, py, pt = local_state.get_visual_anchors()
        nx, ny, nt = local_state.get_page_state()
        txt = text_logic.get_text_range(px, py, pt, nx, ny, nt, local_state)
        global_state.add_copy_buffer(txt)
        text_logic.delete_text_range(px, py, pt, nx, ny, nt, local_state)
        global_state.curr_state = 'Default'
    else:
        text_logic.delete_text_highlight(local_state)

    render_page([], [], graphics_state, local_state, global_state)