PageRenderTime 32ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/macros/Clipboard/Copy_Selection_or_Line.bsh

#
Unknown | 34 lines | 29 code | 5 blank | 0 comment | 0 complexity | 0aa4b0beab9076d5599f6feb84954d6f 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_Selection_or_Line.bsh - a BeanShell macro for jEdit
  3. * which copies either the selected 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_Selection_or_Line.bsh 5098 2004-08-03 21:31:48Z orutherfurd $
  9. */
  10. copySelectionOrLine(){
  11. selections = textArea.getSelection();
  12. if(selections.length == 0){
  13. textArea.smartHome(false);
  14. textArea.smartEnd(true);
  15. }
  16. Registers.copy(textArea,'$');
  17. }
  18. copySelectionOrLine();
  19. /*
  20. Macro index data (in DocBook format)
  21. <listitem>
  22. <para><filename>Copy_Selection_or_Line.bsh</filename>
  23. <abstract><para>
  24. If no text is selected, the current line is copied to
  25. the clipboard, otherwise the selected text is copied
  26. to the clipboard.
  27. </para></abstract>
  28. </listitem>
  29. */