/* -- Ctrl+cursor right key: to beginning of next word -- */ static void NextWord(WINDOW wnd) { int savetop = wnd->wtop; int saveleft = wnd->wleft; ClearVisible(wnd); while (!isWhite(*CurrChar)) { char *cc = CurrChar+1; if (*cc == '\0') break; Forward(wnd); } while (isWhite(*CurrChar)) { char *cc = CurrChar+1; if (*cc == '\0') break; Forward(wnd); } SetVisible(wnd); SendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); if (wnd->wtop != savetop || wnd->wleft != saveleft) SendMessage(wnd, PAINT, 0, 0); }
/* -- Ctrl+cursor left key: to beginning of previous word -- */ static void PrevWord(WINDOW wnd) { int savetop = wnd->wtop; int saveleft = wnd->wleft; ClearVisible(wnd); Backward(wnd); while (isWhite(*CurrChar)) { if (wnd->CurrLine == 0 && wnd->CurrCol == 0) break; Backward(wnd); } while (wnd->CurrCol != 0 && !isWhite(*CurrChar)) Backward(wnd); if (isWhite(*CurrChar)) Forward(wnd); SetVisible(wnd); if (wnd->wleft != saveleft) if (wnd->CurrCol >= saveleft) if (wnd->CurrCol - saveleft < ClientWidth(wnd)) wnd->wleft = saveleft; SendMessage(wnd, KEYBOARD_CURSOR, WndCol, wnd->WndRow); if (wnd->wtop != savetop || wnd->wleft != saveleft) SendMessage(wnd, PAINT, 0, 0); }
static void TurnOffDisplay(WINDOW wnd) { SendMessage(NULL, HIDE_CURSOR, 0, 0); ClearVisible(wnd); }