Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TextEdit::onCtrl8() { //поиск следующего слова
- TextLine& line = text.getLine(cursorY);
- int x = cursorX;
- int y = cursorY;
- int k = 0;
- if (line.length() && (line.length() > cursorX) && line[cursorX] != ' '){
- while (cursorX < line.length() - 1){
- cursorX++;
- if ((cursorX == line.length() - 1) || (line[cursorX] == ' ')){
- break;
- }
- }
- }
- if (line.length() <= cursorX + 1){
- if (cursorY + 1 == text.size()){
- cursorX = x;
- cursorY = y;
- return;
- }
- else cursorY++;
- cursorX = 0;
- TextLine& line2 = text.getLine(cursorY);
- if (line2.length())
- if (line2[cursorX] != ' '){
- cursorX = 0;
- return;
- }
- }
- TextLine& line3 = text.getLine(cursorY);
- if (!line3.length() || line3[cursorX] == ' ')
- while (cursorY <= text.size()){
- TextLine& line1 = text.getLine(cursorY);
- if (!line1.length()){
- if (cursorY + 1 == text.size()){
- cursorX = x;
- cursorY = y;
- return;
- }
- else cursorY++;
- cursorX = 0;
- continue;
- }
- while (line1[cursorX] == ' '){
- if (cursorX == line1.length() - 1){
- if (cursorY + 1 == text.size()){
- cursorX = x;
- cursorY = y;
- return;
- }
- else cursorY++;
- cursorX = 0;
- break;
- }
- else cursorX++;
- }
- return;
- }
- cursorX = 0;
- cursorY = y;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement