/*
* Copy_Lines.bsh - a BeanShell macro for jEdit
* which copies either the selected lines of text, or the current line 
* if no text is selected, to the clipboard.
*
* Copyright (C) 2003 Ollie Rutherfurd <oliver@jedit.org>
*
* $Id: Copy_Lines.bsh 11860 2008-02-24 23:43:28Z ezust $
*/

copyLines(){
	selections = textArea.getSelectedLines();
	
	if(selections.length == 0){
		selections = new int [] {textArea.getCaretLine()};
	}
	start = textArea.getLineStartOffset(selections[0]);
	stop = textArea.getLineEndOffset(selections[selections.length-1]);
	Registers.getRegister('$').setValue(textArea.getText(start,stop-start+1));
}

copyLines();

/*
	Macro index data (in DocBook format)

<listitem>
	<para><filename>Copy_Lines.bsh</filename>
	<abstract><para>
		If no text is selected, the current line is copied to 
		the clipboard, otherwise otherwise, all lines that contain the selection 
		are copied to the clipboard.
	</para></abstract>
</listitem>

*/
