PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 0ms 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
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
  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. void copyVisibleLines(View view){
  10. JEditTextArea textArea = view.getTextArea();
  11. DisplayManager dm = textArea.getDisplayManager();
  12. StringBuffer buff = new StringBuffer();
  13. for(int i=0; i < buffer.getLineCount(); i++){
  14. if(dm.isLineVisible(i))
  15. buff.append(textArea.getLineText(i)).append('\n');
  16. }
  17. Registers.setRegister('$', buff.toString());
  18. }
  19. copyVisibleLines(view);
  20. /*
  21. <listitem>
  22. <para><filename>Copy_Visible_Lines.bsh</filename></para>
  23. <abstract><para>Copies the visible lines from the current
  24. buffer to the Clipboard. Lines that are not visible
  25. becuase they are folded are not copied.
  26. </para></abstract>
  27. </listitem>
  28. */