/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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /*
- * 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>
- */