Example #1
0
doc_pos_t doc_cprintf(doc_ptr doc, byte a, const char *fmt, ...)
{
    string_ptr s = string_alloc();
    va_list vp;

    va_start(vp, fmt);
    string_vprintf(s, fmt, vp);
    va_end(vp);

    doc_insert_text(doc, a, string_buffer(s));
    string_free(s);
    return doc->cursor;
}
Example #2
0
static void msg_line_display(byte color, cptr msg)
{
    int len = strlen(msg);

    /* Quick and dirty test for -more- ... This means _msg_line_display_rect
       is just a suggested limit, and we'll surpass this for long messages. */
    if (doc_cursor(_msg_line_doc).y >= _msg_line_rect.cy && len > 1)
        msg_line_flush();

    /* Append this message to the last? */
    else if (!_msg_append && !msg_line_is_empty() && doc_cursor(_msg_line_doc).x > 0)
        doc_newline(_msg_line_doc);

    if (doc_cursor(_msg_line_doc).x > 0 && len > 1)
        doc_insert_char(_msg_line_doc, TERM_WHITE, ' ');
    doc_insert_text(_msg_line_doc, color, msg);
    msg_line_sync();
}
Example #3
0
static void msg_line_flush(void)
{
    if (auto_more_state == AUTO_MORE_PROMPT)
    {
        doc_insert_text(_msg_line_doc, TERM_L_BLUE, "-more-");
        msg_line_sync();

        for(;;)
        {
            int cmd;
            flush();
            cmd = inkey();
            if (cmd == ESCAPE)
            {
                auto_more_state = AUTO_MORE_SKIP_ALL;
                break;
            }
            else if (cmd == '\n' || cmd == '\r' || cmd == 'n')
            {
                auto_more_state = AUTO_MORE_SKIP_BLOCK;
                break;
            }
            else if (cmd == '?')
            {
                screen_save_aux();
                show_file(TRUE, "context_more_prompt.txt", NULL, 0, 0);
                screen_load_aux();
                continue;
            }
            else if (cmd == ' ' || cmd == 'm' || quick_messages)
            {
                break;
            }
            bell();
        }
    }
    msg_line_clear();
}