Example #1
0
int GViewPeer::UpdateCursor() {
    ConSetCursorPos(cX, cY);
    ConSetInsertState(insertState);
    if (cVisible)
        ConShowCursor();
    else
        ConHideCursor();
    return 0;
}
Example #2
0
void ExComplete::RepaintStatus() {
  TDrawBuffer B;
  int W, H;

  // Currently use this fixed colors - maybe there are some better defines??
#define COM_NORM 0x17
#define COM_ORIG 0x1C
#define COM_HIGH 0x1E
#define COM_MARK 0x2E
#define COM_ERR  0x1C

  ConQuerySize(&W, &H);
  MoveCh(B, ' ', COM_NORM, W);

  if ((WordsLast > 0) && (WordBegin != NULL) && (Words != NULL)
      && ((Words[WordPos]) != NULL)) {
    const char *sc = STRCOMPLETE;
    int p          = sizeof(STRCOMPLETE) - 1;

    if (W < 35) {
      // if the width is quite small
      sc += p - 1; // jump to last character
      p   = 1;
    }
      MoveStr(B, 0, W, sc,        COM_NORM, W);

    // int cur = p;
      MoveStr(B, p, W, WordBegin, COM_ORIG, W);
    p += strlen(WordBegin);
    int l = strlen(Words[WordPos]);

    if (WordFixed > 0) {
      MoveStr(B, p, W, Words[WordPos], COM_MARK, W);
      p += WordFixed;
      l -= WordFixed;
    }
      MoveStr(B, p, W, Words[WordPos] + WordFixed,
            (WordFixedCount == 1) ? COM_ORIG : COM_HIGH, W);
    p += l;
    char s[100];
    sprintf(s, "] (T:%d/%d  S:%d)", WordPos + 1, WordsLast,
            (int)WordFixedCount);
    MoveStr(B, p, W, s, COM_NORM, W);

    // ConSetCursorPos(cur + WordFixed, H - 1);
  } else MoveStr(B, 0, W, STRNOCOMPLETE, COM_ERR, W);
  ConPutBox(0, H - 1, W, 1, B);
  ConShowCursor();
}
Example #3
0
void ExISearch::RepaintStatus() {
    TDrawBuffer B;
    char s[MAXISEARCH + 1];
    const char *p;
    int W, H;
    
    ConQuerySize(&W, &H);
    
    switch (state) {
    case INoMatch: p = " No Match. "; break;
    case INoPrev: p = " No Prev Match. "; break;
    case INoNext: p = " No Next Match. "; break;
    case IOk: default: p = ""; break;
    }
    
    sprintf(s, "ISearch [%s]%s", ISearchStr, p);
    MoveCh(B, ' ', 0x17, W);
    MoveStr(B, 0, W, s, 0x17, W);
    ConPutBox(0, H - 1, W, 1, B);
    ConSetCursorPos(strlen(s) - 1, H - 1);
    ConShowCursor();
}
Example #4
0
void ExASCII::RepaintStatus() {
  TDrawBuffer B;
  int W, H;

  ConQuerySize(&W, &H);

  if (Pos > 255) Pos = 255;

  if (Pos < 0) Pos = 0;

  if (LPos + W < Pos) LPos = Pos - W + 1;

  if (LPos > 255 - W) LPos = 255 - W + 1;

  if (LPos > Pos) LPos = Pos;

  if (LPos < 0) LPos = 0;

  for (int i = 0; i < W; i++) MoveCh(B + i, char(i + LPos), hcAsciiChars, 1);
  ConSetCursorPos(Pos - LPos, H - 1);
  ConShowCursor();
  ConPutBox(0, H - 1, W, 1, B);
}