/*--------------------------------------------------------------------------*/ void killLastWord(void) { reallocLineBuffer(); while ((cur_pos > 0) && (cur_line[cur_pos - 1] == VK_SPACE)) { cur_pos -= 1; backSpace (); } while ((cur_pos > 0) && (cur_line[cur_pos - 1] != VK_SPACE)) { cur_pos -= 1; backSpace (); } killCurrentPositionToEndLine(); }
/*--------------------------------------------------------------------------*/ 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; }