Guest User

Untitled

a guest
May 27th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. /*=============================
  2. * upperCase.ms
  3. ==============================*/
  4.  
  5. #command upperCaseKeyword "Keyword"
  6. var FgKeyword = 8;
  7.  
  8. switch(command){
  9. case "upperCaseKeyword":
  10. upperCaseKeyword();
  11. break;
  12. default:
  13. error("command [" + command + "] not found");
  14. break;
  15. }
  16. exit();
  17.  
  18. function upperCaseKeyword(){
  19. if(view){
  20. var selection = getSelection();
  21. var cur, to;
  22. if(selection[0].line == selection[1].line &&
  23. selection[0].index == selection[1].index){
  24. cur = EP(1);
  25. to = EP(getLineCount(), getLine(getLineCount()).length);
  26. }else{
  27. cur = EP(selection[0].line);
  28. to = EP(selection[1].line, getLine(selection[1].line).length);
  29. }
  30.  
  31. enterUndoGroup();
  32. gotoPoint(cur);
  33. while(cur.line < to.line ||
  34. (cur.line == to.line && cur.index < to.index)){
  35. var prev = new Point(cur);
  36. if(getColorCode() == FgKeyword){
  37. upperCaseWord();
  38. }
  39. if(/^[\r\n]/.test(getText())){
  40. charRight();
  41. }else{
  42. wordRight();
  43. }
  44. cur = getCurrentPoint();
  45. }
  46. leaveUndoGroup();
  47. }
  48. }
Add Comment
Please, Sign In to add comment