예제 #1
0
void ConsoleDialog::specialKeys(int keycode) {
	switch (keycode) {
	case Common::KEYCODE_a:
		_currentPos = _promptStartPos;
		draw();
		break;
	case Common::KEYCODE_d:
		if (_currentPos < _promptEndPos) {
			killChar();
			draw();
		}
		break;
	case Common::KEYCODE_e:
		_currentPos = _promptEndPos;
		draw();
		break;
	case Common::KEYCODE_k:
		killLine();
		draw();
		break;
	case Common::KEYCODE_w:
		killLastWord();
		draw();
		break;
	}
}
예제 #2
0
/*--------------------------------------------------------------------------*/
static char actionControlKey(void)
{
    if ( isCTRL_VKEY('X') || isCTRL_VKEY('C') )
    {
        ControlC_Command();
        return '\n';
    }
    else if (isCTRL_VKEY('A')) /* moves to the beginning of the line */
    {
        moveBeginningLine();
    }
    else if (isCTRL_VKEY('B')) /* moves back a single character */
    {
        moveBackSingleChar();
    }
    else if (isCTRL_VKEY('D')) /* deletes the current character */
    {
        deleteCurrentChar();
    }
    else if (isCTRL_VKEY('E')) /* moves to the end of the line */
    {
        moveEndLine();
    }
    else if (isCTRL_VKEY('F')) /* moves forward a single character */
    {
        moveForwardSingleChar();
    }
    else if (isCTRL_VKEY('H')) /* delete the previous character */
    {
        deletePreviousChar();
    }
    else if (isCTRL_VKEY('K')) /* kills from current position to the end of line */
    {
        killCurrentPositionToEndLine();
    }
    else if (isCTRL_VKEY('N')) /* moves forward through history */
    {
        moveForwardHistory();
    }
    else if (isCTRL_VKEY('P')) /* moves back through history */
    {
        moveBackHistory();
    }
    else if ( isCTRL_VKEY('R') || isCTRL_VKEY('L') ) /* redraw line in case it gets trashed */
    {
        redrawLine();
    }
    else if (isCTRL_VKEY('U')) /* kills the entire line */
    {
        clearCurrentLine();
    }
    else if (isCTRL_VKEY('V'))
    {
        pasteClipBoard();
    }
    else if (isCTRL_VKEY('W')) /* kills last word */
    {
        killLastWord();
    }
    else if (isCTRL_VKEY(VK_TAB) || isCTRL_VKEY(VK_SPACE)) /* Completion */
    {
        TermCompletion();
    }
    else if (isCTRL_VKEY(VK_LEFT)) /* */
    {
        moveBackSingleWord();
    }
    else if (isCTRL_VKEY(VK_RIGHT)) /* */
    {
        moveForwardSingleWord();
    }
    return 0;
}