"""
Cut_Selection_or_Line.py - A Jython macro for jEdit that
is an enhanced version of the built-in `cut` action.  If
no text is selected then the current line is cut to the
clipboard, otherwise the default cut behavior is used.

Copyright(2002) Ollie Rutherfurd <oliver@rutherfurd.net>

$Id: Cut_Selection_or_Line.py 51 2003-07-23 20:48:53Z oliver $
"""

from org.gjt.sp.jedit import Registers

def cutSelectionOrLine(textArea):

    # if nothing selected, select line
    if len(textArea.getSelection()) == 0:
        textArea.smartHome(0)
        textArea.smartEnd(1)

    Registers.cut(textArea,'$')


if __name__ in ('__main__','main'):
    cutSelectionOrLine(init.textArea)

# :indentSize=4:lineSeparator=\n:noTabs=true:tabSize=4:
