comparison src/message.c @ 167:c93c9cad9618

updated for version 7.0051
author vimboss
date Tue, 22 Feb 2005 08:39:57 +0000
parents 616289ecb7c8
children 7e70fc748752
comparison
equal deleted inserted replaced
166:3a28ed993bbe 167:c93c9cad9618
516 int ignore = FALSE; 516 int ignore = FALSE;
517 int severe; 517 int severe;
518 #endif 518 #endif
519 519
520 called_emsg = TRUE; 520 called_emsg = TRUE;
521 ex_exitval = 1;
521 522
522 /* 523 /*
523 * If "emsg_severe" is TRUE: When an error exception is to be thrown, 524 * If "emsg_severe" is TRUE: When an error exception is to be thrown,
524 * prefer this message over previous messages for the same command. 525 * prefer this message over previous messages for the same command.
525 */ 526 */
531 /* 532 /*
532 * If "emsg_off" is set: no error messages at the moment. 533 * If "emsg_off" is set: no error messages at the moment.
533 * If 'debug' is set: do error message anyway, but without side effects. 534 * If 'debug' is set: do error message anyway, but without side effects.
534 * If "emsg_skip" is set: never do error messages. 535 * If "emsg_skip" is set: never do error messages.
535 */ 536 */
536 if ((emsg_off > 0 && *p_debug == NUL) 537 if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL)
537 #ifdef FEAT_EVAL 538 #ifdef FEAT_EVAL
538 || emsg_skip > 0 539 || emsg_skip > 0
539 #endif 540 #endif
540 ) 541 )
541 return TRUE; 542 return TRUE;
636 */ 637 */
637 int 638 int
638 emsg3(s, a1, a2) 639 emsg3(s, a1, a2)
639 char_u *s, *a1, *a2; 640 char_u *s, *a1, *a2;
640 { 641 {
641 if ((emsg_off > 0 && *p_debug == NUL) 642 if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL)
642 #ifdef FEAT_EVAL 643 #ifdef FEAT_EVAL
643 || emsg_skip > 0 644 || emsg_skip > 0
644 #endif 645 #endif
645 ) 646 )
646 return TRUE; /* no error messages at the moment */ 647 return TRUE; /* no error messages at the moment */
665 int 666 int
666 emsgn(s, n) 667 emsgn(s, n)
667 char_u *s; 668 char_u *s;
668 long n; 669 long n;
669 { 670 {
670 if ((emsg_off > 0 && *p_debug == NUL) 671 if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL)
671 #ifdef FEAT_EVAL 672 #ifdef FEAT_EVAL
672 || emsg_skip > 0 673 || emsg_skip > 0
673 #endif 674 #endif
674 ) 675 )
675 return TRUE; /* no error messages at the moment */ 676 return TRUE; /* no error messages at the moment */
676 sprintf((char *)IObuff, (char *)s, n); 677 sprintf((char *)IObuff, (char *)s, n);
677 return emsg(IObuff); 678 return emsg(IObuff);
679 }
680
681 void
682 emsg_invreg(name)
683 int name;
684 {
685 EMSG2(_("E354: Invalid register name: '%s'"), transchar(name));
678 } 686 }
679 687
680 /* 688 /*
681 * Like msg(), but truncate to a single line if p_shm contains 't', or when 689 * Like msg(), but truncate to a single line if p_shm contains 't', or when
682 * "force" is TRUE. This truncates in another way as for normal messages. 690 * "force" is TRUE. This truncates in another way as for normal messages.
1479 1487
1480 /* 1488 /*
1481 * print line for :print or :list command 1489 * print line for :print or :list command
1482 */ 1490 */
1483 void 1491 void
1484 msg_prt_line(s) 1492 msg_prt_line(s, list)
1485 char_u *s; 1493 char_u *s;
1494 int list;
1486 { 1495 {
1487 int c; 1496 int c;
1488 int col = 0; 1497 int col = 0;
1489 int n_extra = 0; 1498 int n_extra = 0;
1490 int c_extra = 0; 1499 int c_extra = 0;
1495 #ifdef FEAT_MBYTE 1504 #ifdef FEAT_MBYTE
1496 int l; 1505 int l;
1497 char_u buf[MB_MAXBYTES + 1]; 1506 char_u buf[MB_MAXBYTES + 1];
1498 #endif 1507 #endif
1499 1508
1509 if (curwin->w_p_list)
1510 list = TRUE;
1511
1500 /* find start of trailing whitespace */ 1512 /* find start of trailing whitespace */
1501 if (curwin->w_p_list && lcs_trail) 1513 if (list && lcs_trail)
1502 { 1514 {
1503 trail = s + STRLEN(s); 1515 trail = s + STRLEN(s);
1504 while (trail > s && vim_iswhite(trail[-1])) 1516 while (trail > s && vim_iswhite(trail[-1]))
1505 --trail; 1517 --trail;
1506 } 1518 }
1507 1519
1508 /* output a space for an empty line, otherwise the line will be 1520 /* output a space for an empty line, otherwise the line will be
1509 * overwritten */ 1521 * overwritten */
1510 if (*s == NUL && !(curwin->w_p_list && lcs_eol != NUL)) 1522 if (*s == NUL && !(list && lcs_eol != NUL))
1511 msg_putchar(' '); 1523 msg_putchar(' ');
1512 1524
1513 for (;;) 1525 for (;;)
1514 { 1526 {
1515 if (n_extra) 1527 if (n_extra)
1533 #endif 1545 #endif
1534 else 1546 else
1535 { 1547 {
1536 attr = 0; 1548 attr = 0;
1537 c = *s++; 1549 c = *s++;
1538 if (c == TAB && (!curwin->w_p_list || lcs_tab1)) 1550 if (c == TAB && (!list || lcs_tab1))
1539 { 1551 {
1540 /* tab amount depends on current column */ 1552 /* tab amount depends on current column */
1541 n_extra = curbuf->b_p_ts - col % curbuf->b_p_ts - 1; 1553 n_extra = curbuf->b_p_ts - col % curbuf->b_p_ts - 1;
1542 if (!curwin->w_p_list) 1554 if (!list)
1543 { 1555 {
1544 c = ' '; 1556 c = ' ';
1545 c_extra = ' '; 1557 c_extra = ' ';
1546 } 1558 }
1547 else 1559 else
1549 c = lcs_tab1; 1561 c = lcs_tab1;
1550 c_extra = lcs_tab2; 1562 c_extra = lcs_tab2;
1551 attr = hl_attr(HLF_8); 1563 attr = hl_attr(HLF_8);
1552 } 1564 }
1553 } 1565 }
1554 else if (c == NUL && curwin->w_p_list && lcs_eol != NUL) 1566 else if (c == NUL && list && lcs_eol != NUL)
1555 { 1567 {
1556 p_extra = (char_u *)""; 1568 p_extra = (char_u *)"";
1557 c_extra = NUL; 1569 c_extra = NUL;
1558 n_extra = 1; 1570 n_extra = 1;
1559 c = lcs_eol; 1571 c = lcs_eol;
2519 char_u *s = str; 2531 char_u *s = str;
2520 static int cur_col = 0; 2532 static int cur_col = 0;
2521 2533
2522 if ((redir_fd != NULL 2534 if ((redir_fd != NULL
2523 #ifdef FEAT_EVAL 2535 #ifdef FEAT_EVAL
2524 || redir_reg 2536 || redir_reg || redir_vname
2525 #endif 2537 #endif
2526 ) && !redir_off) 2538 ) && !redir_off)
2527 { 2539 {
2528 /* If the string doesn't start with CR or NL, go to msg_col */ 2540 /* If the string doesn't start with CR or NL, go to msg_col */
2529 if (*s != '\n' && *s != '\r') 2541 if (*s != '\n' && *s != '\r')
2531 while (cur_col < msg_col) 2543 while (cur_col < msg_col)
2532 { 2544 {
2533 #ifdef FEAT_EVAL 2545 #ifdef FEAT_EVAL
2534 if (redir_reg) 2546 if (redir_reg)
2535 write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE); 2547 write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
2548 else if (redir_vname)
2549 var_redir_str((char_u *)" ", -1);
2536 else if (redir_fd) 2550 else if (redir_fd)
2537 #endif 2551 #endif
2538 fputs(" ", redir_fd); 2552 fputs(" ", redir_fd);
2539 ++cur_col; 2553 ++cur_col;
2540 } 2554 }
2541 } 2555 }
2542 2556
2543 #ifdef FEAT_EVAL 2557 #ifdef FEAT_EVAL
2544 if (redir_reg) 2558 if (redir_reg)
2545 write_reg_contents(redir_reg, s, maxlen, TRUE); 2559 write_reg_contents(redir_reg, s, maxlen, TRUE);
2560 if (redir_vname)
2561 var_redir_str(s, maxlen);
2546 #endif 2562 #endif
2547 2563
2548 /* Adjust the current column */ 2564 /* Adjust the current column */
2549 while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) 2565 while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
2550 { 2566 {
2551 #ifdef FEAT_EVAL 2567 #ifdef FEAT_EVAL
2552 if (!redir_reg && redir_fd != NULL) 2568 if (!redir_reg && !redir_vname && redir_fd != NULL)
2553 #endif 2569 #endif
2554 putc(*s, redir_fd); 2570 putc(*s, redir_fd);
2555 if (*s == '\r' || *s == '\n') 2571 if (*s == '\r' || *s == '\n')
2556 cur_col = 0; 2572 cur_col = 0;
2557 else if (*s == '\t') 2573 else if (*s == '\t')