Advertisement
Guest User

StrafeSelection.py

a guest
Jun 27th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.89 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement