Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. void TextEdit::onCtrl8() { //поиск следующего слова
  2. TextLine& line = text.getLine(cursorY);
  3. int x = cursorX;
  4. int y = cursorY;
  5. int k = 0;
  6. if (line.length() && (line.length() > cursorX) && line[cursorX] != ' '){
  7. while (cursorX < line.length() - 1){
  8. cursorX++;
  9. if ((cursorX == line.length() - 1) || (line[cursorX] == ' ')){
  10. break;
  11. }
  12. }
  13. }
  14. if (line.length() <= cursorX + 1){
  15. if (cursorY + 1 == text.size()){
  16. cursorX = x;
  17. cursorY = y;
  18. return;
  19. }
  20. else cursorY++;
  21. cursorX = 0;
  22. TextLine& line2 = text.getLine(cursorY);
  23. if (line2.length())
  24. if (line2[cursorX] != ' '){
  25. cursorX = 0;
  26.  
  27. return;
  28. }
  29. }
  30. TextLine& line3 = text.getLine(cursorY);
  31. if (!line3.length() || line3[cursorX] == ' ')
  32. while (cursorY <= text.size()){
  33. TextLine& line1 = text.getLine(cursorY);
  34. if (!line1.length()){
  35. if (cursorY + 1 == text.size()){
  36. cursorX = x;
  37. cursorY = y;
  38. return;
  39. }
  40. else cursorY++;
  41. cursorX = 0;
  42. continue;
  43. }
  44. while (line1[cursorX] == ' '){
  45. if (cursorX == line1.length() - 1){
  46. if (cursorY + 1 == text.size()){
  47. cursorX = x;
  48. cursorY = y;
  49. return;
  50. }
  51. else cursorY++;
  52. cursorX = 0;
  53. break;
  54. }
  55. else cursorX++;
  56. }
  57. return;
  58. }
  59. cursorX = 0;
  60. cursorY = y;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement