PageRenderTime 42ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/macros/Editing/Copy_Visible_Lines.bsh

#
Unknown | 34 lines | 28 code | 6 blank | 0 comment | 0 complexity | 358951642d1764986c6342ab6b407e22 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@rutherfurd.net>
  6. *
  7. * $Id: Copy_Visible_Lines.bsh 4998 2004-03-20 06:08:50Z spestov $
  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. */