PageRenderTime 43ms CodeModel.GetById 39ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/macros/Clipboard/Copy_Selection_or_Line.bsh

#
Unknown | 34 lines | 29 code | 5 blank | 0 comment | 0 complexity | 0aa4b0beab9076d5599f6feb84954d6f MD5 | raw file
 1/*
 2* Copy_Selection_or_Line.bsh - a BeanShell macro for jEdit
 3* which copies either the selected text, or the current line 
 4* if no text is selected, to the clipboard.
 5*
 6* Copyright (C) 2003 Ollie Rutherfurd <oliver@jedit.org>
 7*
 8* $Id: Copy_Selection_or_Line.bsh 5098 2004-08-03 21:31:48Z orutherfurd $
 9*/
10
11copySelectionOrLine(){
12	selections = textArea.getSelection();
13	if(selections.length == 0){
14		textArea.smartHome(false);
15		textArea.smartEnd(true);
16	}
17	Registers.copy(textArea,'$');
18}
19
20copySelectionOrLine();
21
22/*
23	Macro index data (in DocBook format)
24
25<listitem>
26	<para><filename>Copy_Selection_or_Line.bsh</filename>
27	<abstract><para>
28		If no text is selected, the current line is copied to 
29		the clipboard, otherwise the selected text is copied 
30		to the clipboard.
31	</para></abstract>
32</listitem>
33
34*/