예제 #1
0
파일: __init__.py 프로젝트: bigdrum/snaked
def delete_line(editor):
    from util import get_line_bounds, line_is_empty

    bounds = get_line_bounds(editor.cursor)
    if not line_is_empty(editor.cursor) and editor.snaked_conf['COPY_DELETED_LINE']:
        clipboard = editor.view.get_clipboard(gtk.gdk.SELECTION_CLIPBOARD)
        editor.buffer.select_range(*bounds)
        editor.buffer.copy_clipboard(clipboard)

    editor.buffer.begin_user_action()
    editor.buffer.delete(*bounds)
    editor.buffer.end_user_action()
예제 #2
0
def get_smart_select(editor):
    if editor.buffer.get_has_selection():
        start, end = editor.buffer.get_selection_bounds()
        if start.starts_line() and ( end.starts_line() or end.is_end() ):
            return block_smart_extend(True, start, end)
        else:
            return line_smart_extend(True, start, end)
    else:
        cursor = editor.cursor

        if cursor_on_start_or_end_whitespace(cursor):
            return block_smart_extend(False, *get_line_bounds(cursor))
        else:
            return line_smart_extend(False, cursor, cursor.copy())