Want more features on Pastebin? Sign Up, it's FREE!
Guest

StrafeSelection.py

By: a guest on Jun 27th, 2011  |  syntax: Python  |  size: 0.89 KB  |  views: 68  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #standard modules
  2. import pn
  3. import scintilla
  4.  
  5. ##
  6. # @brief Move selection to the right
  7. # @note Add ALT+Right Arrow Shortcut
  8. @script("Strafe Selection Right", "Text")
  9. def StrafeSelectionRight():
  10.         sct = scintilla.Scintilla(pn.CurrentDoc())
  11.         #pn.AddOutput("\n Selections:"+str(sct.SelectionCount))
  12.         for i in range(sct.SelectionCount):
  13.                 (a, c) = (sct.GetSelectionNAnchor(i), sct.GetSelectionNCaret(i))
  14.                 sct.SetSelectionNAnchor (i, a+1)
  15.                 sct.SetSelectionNCaret (i, c+1)
  16. ##
  17. # @brief Move selection to the left
  18. # @note Add ALT+Left Arrow Shortcut
  19. @script("Strafe Selection Left", "Text")
  20. def StrafeSelectionLeft():
  21.         sct = scintilla.Scintilla(pn.CurrentDoc())
  22.         #pn.AddOutput("\n Selections:"+str(sct.SelectionCount))
  23.         for i in range(sct.SelectionCount):
  24.                 (a, c) = (sct.GetSelectionNAnchor(i), sct.GetSelectionNCaret(i))
  25.                 sct.SetSelectionNAnchor (i, a-1)
  26.                 sct.SetSelectionNCaret (i, c-1)
clone this paste RAW Paste Data