/jEdit/branches/4.4.x-merge-request-for-r19201/macros/Clipboard/Copy_Lines.bsh

#
Unknown | 36 lines | 30 code | 6 blank | 0 comment | 0 complexity | eb41f9f5202cf879ec4fff38d58faabd MD5 | raw file
  1. /*
  2. * Copy_Lines.bsh - a BeanShell macro for jEdit
  3. * which copies either the selected lines of text, or the current line
  4. * if no text is selected, to the clipboard.
  5. *
  6. * Copyright (C) 2003 Ollie Rutherfurd <oliver@jedit.org>
  7. *
  8. * $Id: Copy_Lines.bsh 11860 2008-02-24 23:43:28Z ezust $
  9. */
  10. copyLines(){
  11. selections = textArea.getSelectedLines();
  12. if(selections.length == 0){
  13. selections = new int [] {textArea.getCaretLine()};
  14. }
  15. start = textArea.getLineStartOffset(selections[0]);
  16. stop = textArea.getLineEndOffset(selections[selections.length-1]);
  17. Registers.getRegister('$').setValue(textArea.getText(start,stop-start+1));
  18. }
  19. copyLines();
  20. /*
  21. Macro index data (in DocBook format)
  22. <listitem>
  23. <para><filename>Copy_Lines.bsh</filename>
  24. <abstract><para>
  25. If no text is selected, the current line is copied to
  26. the clipboard, otherwise otherwise, all lines that contain the selection
  27. are copied to the clipboard.
  28. </para></abstract>
  29. </listitem>
  30. */