PageRenderTime 57ms CodeModel.GetById 54ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Unknown | 34 lines | 28 code | 6 blank | 0 comment | 0 complexity | 70dae83f5fd3bc39fb7637e7e6bcb045 MD5 | raw file
 1/*
 2 * Copy_Visible_Lines.bsh - Copies visible (non-folded) lines from
 3 * the current buffer to the clipboard.
 4 *
 5 * Copyright (C) 2002-2004 Ollie Rutherfurd <oliver@jedit.org>
 6 *
 7 * $Id: Copy_Visible_Lines.bsh 5098 2004-08-03 21:31:48Z orutherfurd $
 8 */
 9
10void copyVisibleLines(View view){
11	JEditTextArea textArea = view.getTextArea();
12	DisplayManager dm = textArea.getDisplayManager();
13
14	StringBuffer buff = new StringBuffer();
15	for(int i=0; i < buffer.getLineCount(); i++){
16		if(dm.isLineVisible(i))
17			buff.append(textArea.getLineText(i)).append('\n');
18	}
19	Registers.setRegister('$', buff.toString());
20}
21
22copyVisibleLines(view);
23
24/*
25
26<listitem>
27	<para><filename>Copy_Visible_Lines.bsh</filename></para>
28	<abstract><para>Copies the visible lines from the current
29		buffer to the Clipboard.  Lines that are not visible
30		becuase they are folded are not copied.
31	</para></abstract>
32</listitem>
33
34*/