0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

updated for version 7.0077

This commit is contained in:
Bram Moolenaar
2005-05-31 22:05:58 +00:00
parent d6ec8454b0
commit 8b044b3264
5 changed files with 212 additions and 8 deletions

View File

@@ -1056,11 +1056,14 @@ do_cmdline(cmdline, getline, cookie, flags)
if (p_verbose >= 15 && sourcing_name != NULL) if (p_verbose >= 15 && sourcing_name != NULL)
{ {
++no_wait_return; ++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */ verbose_enter_scroll();
smsg((char_u *)_("line %ld: %s"), smsg((char_u *)_("line %ld: %s"),
(long)sourcing_lnum, cmdline_copy); (long)sourcing_lnum, cmdline_copy);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (msg_silent == 0)
cmdline_row = msg_row; msg_puts((char_u *)"\n"); /* don't overwrite this */
verbose_leave_scroll();
--no_wait_return; --no_wait_return;
} }

View File

@@ -34,6 +34,7 @@ static void t_puts __ARGS((int t_col, char_u *t_s, char_u *s, int attr));
static void msg_screen_putchar __ARGS((int c, int attr)); static void msg_screen_putchar __ARGS((int c, int attr));
static int msg_check_screen __ARGS((void)); static int msg_check_screen __ARGS((void));
static void redir_write __ARGS((char_u *s, int maxlen)); static void redir_write __ARGS((char_u *s, int maxlen));
static void verbose_write __ARGS((char_u *s, int maxlen));
#ifdef FEAT_CON_DIALOG #ifdef FEAT_CON_DIALOG
static char_u *msg_show_console_dialog __ARGS((char_u *message, char_u *buttons, int dfltbutton)); static char_u *msg_show_console_dialog __ARGS((char_u *message, char_u *buttons, int dfltbutton));
static int confirm_msg_used = FALSE; /* displaying confirm_msg */ static int confirm_msg_used = FALSE; /* displaying confirm_msg */
@@ -101,6 +102,25 @@ msg(s)
return msg_attr_keep(s, 0, FALSE); return msg_attr_keep(s, 0, FALSE);
} }
#if defined(FEAT_EVAL) || defined(FEAT_X11) || defined(USE_XSMP) \
|| defined(PROTO)
/*
* Like msg() but keep it silent when 'verbosefile' is set.
*/
int
verb_msg(s)
char_u *s;
{
int n;
verbose_enter();
n = msg_attr_keep(s, 0, FALSE);
verbose_leave();
return n;
}
#endif
int int
msg_attr(s, attr) msg_attr(s, attr)
char_u *s; char_u *s;
@@ -183,7 +203,7 @@ msg_strtrunc(s)
/* May truncate message to avoid a hit-return prompt */ /* May truncate message to avoid a hit-return prompt */
if (!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL) if (!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL)
&& !exmode_active) && !exmode_active && msg_silent == 0)
{ {
len = vim_strsize(s); len = vim_strsize(s);
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1; room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
@@ -2524,11 +2544,22 @@ redir_write(str, maxlen)
char_u *s = str; char_u *s = str;
static int cur_col = 0; static int cur_col = 0;
if ((redir_fd != NULL /* Don't do anything for displaying prompts and the like. */
if (redir_off)
return;
/*
* If 'verbosefile' is set write message in that file.
* Must come before the rest because of updating "msg_col".
*/
if (*p_vfile != NUL)
verbose_write(s, maxlen);
if (redir_fd != NULL
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
|| redir_reg || redir_vname || redir_reg || redir_vname
#endif #endif
) && !redir_off) )
{ {
/* If the string doesn't start with CR or NL, go to msg_col */ /* If the string doesn't start with CR or NL, go to msg_col */
if (*s != '\n' && *s != '\r') if (*s != '\n' && *s != '\r')
@@ -2575,6 +2606,139 @@ redir_write(str, maxlen)
} }
} }
/*
* Before giving verbose messsage.
* Must always be called paired with verbose_leave()!
*/
void
verbose_enter()
{
if (*p_vfile != NUL)
++msg_silent;
}
/*
* After giving verbose message.
* Must always be called paired with verbose_enter()!
*/
void
verbose_leave()
{
if (*p_vfile != NUL)
if (--msg_silent < 0)
msg_silent = 0;
}
/*
* Like verbose_enter() and set msg_scroll when displaying the message.
*/
void
verbose_enter_scroll()
{
if (*p_vfile != NUL)
++msg_silent;
else
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
}
/*
* Like verbose_leave() and set cmdline_row when displaying the message.
*/
void
verbose_leave_scroll()
{
if (*p_vfile != NUL)
{
if (--msg_silent < 0)
msg_silent = 0;
}
else
cmdline_row = msg_row;
}
static FILE *verbose_fd = NULL;
static int verbose_did_open = FALSE;
/*
* Called when 'verbosefile' is set: stop writing to the file.
*/
void
verbose_stop()
{
if (verbose_fd != NULL)
{
fclose(verbose_fd);
verbose_fd = NULL;
}
verbose_did_open = FALSE;
}
/*
* Open the file 'verbosefile'.
* Return FAIL or OK.
*/
int
verbose_open()
{
if (verbose_fd == NULL && !verbose_did_open)
{
/* Only give the error message once. */
verbose_did_open = TRUE;
verbose_fd = fopen((char *)p_vfile, "a");
if (verbose_fd == NULL)
{
EMSG2(_(e_notopen), p_vfile);
return FAIL;
}
}
return OK;
}
/*
* Write a string to 'verbosefile'.
* When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes.
*/
static void
verbose_write(str, maxlen)
char_u *str;
int maxlen;
{
char_u *s = str;
static int cur_col = 0;
/* Open the file when called the first time. */
if (verbose_fd == NULL)
verbose_open();
if (verbose_fd != NULL)
{
/* If the string doesn't start with CR or NL, go to msg_col */
if (*s != '\n' && *s != '\r')
{
while (cur_col < msg_col)
{
fputs(" ", verbose_fd);
++cur_col;
}
}
/* Adjust the current column */
while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
{
putc(*s, verbose_fd);
if (*s == '\r' || *s == '\n')
cur_col = 0;
else if (*s == '\t')
cur_col += (8 - cur_col % 8);
else
++cur_col;
++s;
}
}
}
/* /*
* Give a warning message (for searching). * Give a warning message (for searching).
* Use 'w' highlighting and may repeat the message after redrawing * Use 'w' highlighting and may repeat the message after redrawing
@@ -3206,7 +3370,7 @@ do_browse(flags, title, dflt, ext, initdir, filter, buf)
* *
* This code is based on snprintf.c - a portable implementation of snprintf * This code is based on snprintf.c - a portable implementation of snprintf
* by Mark Martinec <mark.martinec@ijs.si>, Version 2.2, 2000-10-06. * by Mark Martinec <mark.martinec@ijs.si>, Version 2.2, 2000-10-06.
* It was heavely modified to fit in Vim. * Included with permission. It was heavely modified to fit in Vim.
* The original code, including useful comments, can be found here: * The original code, including useful comments, can be found here:
* http://www.ijs.si/software/snprintf/ * http://www.ijs.si/software/snprintf/
* *

View File

@@ -40,6 +40,8 @@ void getvvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, co
void getvcols __ARGS((win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right)); void getvcols __ARGS((win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right));
char_u *skipwhite __ARGS((char_u *p)); char_u *skipwhite __ARGS((char_u *p));
char_u *skipdigits __ARGS((char_u *p)); char_u *skipdigits __ARGS((char_u *p));
char_u *skiptodigit __ARGS((char_u *p));
char_u *skiptohex __ARGS((char_u *p));
int vim_isdigit __ARGS((int c)); int vim_isdigit __ARGS((int c));
int vim_isxdigit __ARGS((int c)); int vim_isxdigit __ARGS((int c));
char_u *skiptowhite __ARGS((char_u *p)); char_u *skiptowhite __ARGS((char_u *p));

View File

@@ -24,7 +24,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test38.out test39.out test40.out test41.out test42.out \ test38.out test39.out test40.out test41.out test42.out \
test43.out test44.out test45.out test46.out test47.out \ test43.out test44.out test45.out test46.out test47.out \
test48.out test51.out test53.out test54.out test55.out \ test48.out test51.out test53.out test54.out test55.out \
test56.out test56.out test57.out
.SUFFIXES: .in .out .SUFFIXES: .in .out

35
src/testdir/test57.ok Normal file
View File

@@ -0,0 +1,35 @@
t1: alphabetical
One test
Two test
one test
two test
t2: alpha, unique
One test
Two test
Two test
one test
t3: alpha, unique, skip pattern
two: aaa
another: tuvy
one: xay
t4: number
xce 9
asdf 83 asd
one 333
t5: number and skip
one 33:4 99
:9
asdf 3 a: sd 11
t6: octal
asdf 0014
2389
111
t7: hex and skip
asd/ad 1413
0x44/1a1
sf/0x1d3
t8: wrong arguments
ccc
bbb
aaa
t8: