예제 #1
0
파일: latex-mode.c 프로젝트: deeice/Qemacs
static void do_tex_insert_quote(EditState *s)
{
    int offset_bol, len, offset1;
    unsigned int buf[MAX_BUF_SIZE];
    int p;

    offset_bol = eb_goto_bol(s->b, s->offset);
    offset1 = offset_bol;
    len = eb_get_line(s->b, buf, MAX_BUF_SIZE - 1, &offset1);
    p = s->offset - offset_bol;

    if(p >= 1 && buf[p-1] == '\"') {
        eb_insert(s->b, s->offset, (unsigned char *)"\"", 1);
        s->offset++;
    } else if(p >= 2 && (buf[p-1] == '`' || buf[p-1] == '\'') &&
              buf[p-1] == buf[p-2])
    {
        eb_delete(s->b, s->offset - 2, 2);
        eb_insert(s->b, s->offset, (unsigned char *)"\"", 1);
        s->offset++;
    } else {
        if(p == 0 || buf[p-1] == ' ') {
            eb_insert(s->b, s->offset, (unsigned char *)"``", 2);
            s->offset += 2;
        } else {
            eb_insert(s->b, s->offset, (unsigned char *)"''", 2);
            s->offset += 2;
        }
    }
}
예제 #2
0
파일: list.c 프로젝트: dgdunix/qemacs-tmp
static int list_get_colorized_line(EditState *s,
                                   unsigned int *buf, int buf_size,
                                   int *offsetp, __unused__ int line_num)
{
    QEmacsState *qs = s->qe_state;
    int offset, len;

    offset = *offsetp;
    len = eb_get_line(s->b, buf, buf_size, offsetp);

    if (((qs->active_window == s) || s->force_highlight) &&
          s->offset >= offset && s->offset < *offsetp)
    {
        /* highlight the line if the cursor is inside */
        set_color(buf, buf + len, QE_STYLE_HIGHLIGHT);
    } else
    if (buf[0] == '*') {
        /* selection */
        set_color(buf, buf + len, QE_STYLE_SELECTION);
    }
    return len;
}