File: Copy_Visible_Lines.bsh

package info (click to toggle)
jedit 5.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,252 kB
  • ctags: 11,190
  • sloc: java: 98,480; xml: 94,070; makefile: 52; sh: 42; cpp: 6; python: 6
file content (34 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copy_Visible_Lines.bsh - Copies visible (non-folded) lines from
 * the current buffer to the clipboard.
 *
 * Copyright (C) 2002-2004 Ollie Rutherfurd <oliver@jedit.org>
 *
 * $Id: Copy_Visible_Lines.bsh 5098 2004-08-03 21:31:48Z orutherfurd $
 */

void copyVisibleLines(View view){
	JEditTextArea textArea = view.getTextArea();
	DisplayManager dm = textArea.getDisplayManager();

	StringBuffer buff = new StringBuffer();
	for(int i=0; i < buffer.getLineCount(); i++){
		if(dm.isLineVisible(i))
			buff.append(textArea.getLineText(i)).append('\n');
	}
	Registers.setRegister('$', buff.toString());
}

copyVisibleLines(view);

/*

<listitem>
	<para><filename>Copy_Visible_Lines.bsh</filename></para>
	<abstract><para>Copies the visible lines from the current
		buffer to the Clipboard.  Lines that are not visible
		becuase they are folded are not copied.
	</para></abstract>
</listitem>

*/