Exemplo n.º 1
0
int EBuffer::KillWord() {
    int Y = VToR(CP.Row);
    if (CP.Col >= LineLen()) {
        if (KillChar() == 0) return 0;
    } else {
        PELine L = RLine(Y);
        int P = CharOffset(L, CP.Col);
        int C;
        int Class = ChClassK(L->Chars[P]);

        while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++;
        C = ScreenPos(L, P);
        if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0;
    }
    return 1;
}
Exemplo n.º 2
0
int EBuffer::KillWordOrCap() {
    int Y = VToR(CP.Row);
    if (CP.Col >= LineLen()) {
        if (KillChar() == 0) return 0;
    } else {
        PELine L = VLine(CP.Row);
        int P = CharOffset(L, CP.Col);
        int C;
        int Class = ChClassK(L->Chars[P]);

        if (Class == 1) {
            if (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)
                while ((P < L->Count) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 1)) P++;
            while ((P < L->Count) && (WGETBIT(Flags.WordChars, L->Chars[P]) == 1) && (WGETBIT(Flags.CapitalChars, L->Chars[P]) == 0)) P++;
        } else while ((P < L->Count) && (ChClassK(L->Chars[P]) == Class)) P++;
        C = ScreenPos(L, P);
        if (DelText(Y, CP.Col, C - CP.Col) == 0) return 0;
    }
    return 1;
}
Exemplo n.º 3
0
int EBuffer::KillWordPrev() {
    int Y = VToR(CP.Row);

    if (CP.Col == 0) {
        if (KillCharPrev() == 0) return 0;
    } else if (CP.Col > LineLen()) {
        if (SetPos(LineLen(), CP.Row) == 0) return 0;
    } else {
        PELine L = RLine(Y);
        int P = CharOffset(L, CP.Col);
        int C;
        int Class = ChClassK(L->Chars[P - 1]);

        while ((P > 0) && (ChClassK(L->Chars[P - 1]) == Class)) P--;
        C = ScreenPos(L, P);
        if (DelText(Y, C, CP.Col - C) == 0) return 0;
        if (SetPos(C, CP.Row) == 0) return 0;
    }
    return 1;
}
Exemplo n.º 4
0
int EBuffer::BlockSelectWord() {
    int Y = VToR(CP.Row);
    PELine L = RLine(Y);
    int P;
    int C;

    if (BlockUnmark() == 0) return 0;
    BlockMode = bmStream;

    P = CharOffset(L, CP.Col);

    if (P >= L->Count) return 0;
    C = ChClassK(L->Chars[P]);

    while ((P > 0) && (C == ChClassK(L->Chars[P - 1]))) P--;
    if (SetBB(EPoint(Y, ScreenPos(L, P))) == 0) return 0;
    while ((P < L->Count) && (C == ChClassK(L->Chars[P]))) P++;
    if (SetBE(EPoint(Y, ScreenPos(L, P))) == 0) return 0;
    return 1;
}