Esempio n. 1
0
static void bufed_select(EditState *s, int temp)
{
    BufedState *bs = s->mode_data;
    StringItem *item;
    EditBuffer *b;
    EditState *e;
    int index;

    index = list_get_pos(s);
    if (index < 0 || index >= bs->items.nb_items)
        return;

    if (temp && index == bs->last_index)
        return;

    item = bs->items.items[index];
    b = eb_find(item->str);
    if (!b)
        return;
    e = find_window(s, KEY_RIGHT);
    if (temp) {
        if (e) {
            bs->last_index = index;
            switch_to_buffer(e, b);
        }
        return;
    }
    if (e) {
        /* delete dired window */
        do_delete_window(s, 1);
        switch_to_buffer(e, b);
    } else {
        switch_to_buffer(s, b);
    }
}
Esempio n. 2
0
static void bufed_kill_buffer(EditState *s)
{
    BufedState *hs = s->mode_data;
    string_selection_iterate(&hs->items, list_get_pos(s),
                             bufed_kill_item, s);
    build_bufed_list(s);
}
Esempio n. 3
0
static void build_bufed_list(EditState *s)
{
    QEmacsState *qs = s->qe_state;
    EditBuffer *b, *b1;
    BufedState *hs;
    int last_index = list_get_pos(s);
    int i, flags;

    hs = s->mode_data;

    free_strings(&hs->items);
    for (b = qs->first_buffer; b != NULL; b = b->next) {
        if (!(b->flags & BF_SYSTEM) || (hs->flags & BUFED_ALL_VISIBLE))
            add_string(&hs->items, b->name);
    }

    /* build buffer */
    b = s->b;
    flags = b->flags;
    b->flags &= ~BF_READONLY;
    eb_delete(b, 0, b->total_size);
    for (i = 0; i < hs->items.nb_items; i++) {
        eb_printf(b, " %-20s", hs->items.items[i]->str);
        b1 = eb_find(hs->items.items[i]->str);
        if (b1) {
            /* CG: should also display mode */
            eb_printf(b, " %10d  %s", b1->total_size, b1->filename);
        }
        eb_printf(b, "\n");
    }
    b->flags = flags;
    s->offset = eb_goto_pos(s->b, last_index, 0);
}
Esempio n. 4
0
static EditBuffer *bufed_get_buffer(EditState *s)
{
    BufedState *bs = s->mode_data;
    int index;

    index = list_get_pos(s);
    if (index < 0 || index >= bs->items.nb_items)
        return NULL;

    return eb_find(bs->items.items[index]->str);
}
Esempio n. 5
0
static void bufed_select(EditState *s)
{
    BufedState *bs = s->mode_data;
    StringItem *item;
    EditBuffer *b;
    EditState *e;
    int index;

    index = list_get_pos(s);
    if (index < 0 || index >= bs->items.nb_items)
        return;
    item = bs->items.items[index];
    b = eb_find(item->str);
    if (!b)
        return;
    e = find_window_right(s);
    if (!e) 
        return;
    /* delete dired window */
    do_delete_window(s, 1);
    switch_to_buffer(e, b);
}