int nextWord(wchar_t * CommandLine, unsigned int *cursorLocation) { /* Passing current word... */ while (CommandLine[*cursorLocation] && !isAWideCharToJump(CommandLine[*cursorLocation])) { gotoRight(CommandLine, cursorLocation); } /* ... then passing through characters to jump */ while (CommandLine[*cursorLocation] && isAWideCharToJump(CommandLine[*cursorLocation])) { gotoRight(CommandLine, cursorLocation); } /* what is the point of the two declaration ? */ return *cursorLocation; }
/* Move cursor to the end of a line */ int endLine(wchar_t * CommandLine, unsigned int *cursorLocation) { int sizeOfCmd = 0; sizeOfCmd = wcslen(CommandLine); /* While the index is different of the size of the line */ while (sizeOfCmd - (*cursorLocation)) { gotoRight(CommandLine, cursorLocation); } return *cursorLocation; }
//================================================================== void KCharSelectTable::keyPressEvent( QKeyEvent *e ) { switch ( e->key() ) { case Key_Left: gotoLeft(); break; case Key_Right: gotoRight(); break; case Key_Up: gotoUp(); break; case Key_Down: gotoDown(); break; case Key_Next: emit tableDown(); break; case Key_Prior: emit tableUp(); break; case Key_Space: emit activated( ' ' ); emit activated(); emit highlighted( ' ' ); emit highlighted(); break; case Key_Enter: case Key_Return: { const QPoint oldPos = vPos; vPos = focusPos; vChr = focusItem; repaintCell( oldPos.y(), oldPos.x(), true ); repaintCell( vPos.y(), vPos.x(), true ); emit activated( vChr ); emit activated(); emit highlighted( vChr ); emit highlighted(); } break; } }