Mercurial > vim
comparison src/mark.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | fe428bee74b3 |
children | dd725a8ab112 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
604 int | 604 int |
605 check_mark(pos_T *pos) | 605 check_mark(pos_T *pos) |
606 { | 606 { |
607 if (pos == NULL) | 607 if (pos == NULL) |
608 { | 608 { |
609 EMSG(_(e_umark)); | 609 emsg(_(e_umark)); |
610 return FAIL; | 610 return FAIL; |
611 } | 611 } |
612 if (pos->lnum <= 0) | 612 if (pos->lnum <= 0) |
613 { | 613 { |
614 /* lnum is negative if mark is in another file can can't get that | 614 /* lnum is negative if mark is in another file can can't get that |
615 * file, error message already give then. */ | 615 * file, error message already give then. */ |
616 if (pos->lnum == 0) | 616 if (pos->lnum == 0) |
617 EMSG(_(e_marknotset)); | 617 emsg(_(e_marknotset)); |
618 return FAIL; | 618 return FAIL; |
619 } | 619 } |
620 if (pos->lnum > curbuf->b_ml.ml_line_count) | 620 if (pos->lnum > curbuf->b_ml.ml_line_count) |
621 { | 621 { |
622 EMSG(_(e_markinval)); | 622 emsg(_(e_markinval)); |
623 return FAIL; | 623 return FAIL; |
624 } | 624 } |
625 return OK; | 625 return OK; |
626 } | 626 } |
627 | 627 |
761 else | 761 else |
762 { | 762 { |
763 if (arg == NULL) | 763 if (arg == NULL) |
764 MSG(_("No marks set")); | 764 MSG(_("No marks set")); |
765 else | 765 else |
766 EMSG2(_("E283: No marks matching \"%s\""), arg); | 766 semsg(_("E283: No marks matching \"%s\""), arg); |
767 } | 767 } |
768 } | 768 } |
769 /* don't output anything if 'q' typed at --more-- prompt */ | 769 /* don't output anything if 'q' typed at --more-- prompt */ |
770 else if (!got_int | 770 else if (!got_int |
771 && (arg == NULL || vim_strchr(arg, c) != NULL) | 771 && (arg == NULL || vim_strchr(arg, c) != NULL) |
813 | 813 |
814 if (*eap->arg == NUL && eap->forceit) | 814 if (*eap->arg == NUL && eap->forceit) |
815 /* clear all marks */ | 815 /* clear all marks */ |
816 clrallmarks(curbuf); | 816 clrallmarks(curbuf); |
817 else if (eap->forceit) | 817 else if (eap->forceit) |
818 EMSG(_(e_invarg)); | 818 emsg(_(e_invarg)); |
819 else if (*eap->arg == NUL) | 819 else if (*eap->arg == NUL) |
820 EMSG(_(e_argreq)); | 820 emsg(_(e_argreq)); |
821 else | 821 else |
822 { | 822 { |
823 /* clear specified marks only */ | 823 /* clear specified marks only */ |
824 for (p = eap->arg; *p != NUL; ++p) | 824 for (p = eap->arg; *p != NUL; ++p) |
825 { | 825 { |
835 if (!(lower ? ASCII_ISLOWER(p[2]) | 835 if (!(lower ? ASCII_ISLOWER(p[2]) |
836 : (digit ? VIM_ISDIGIT(p[2]) | 836 : (digit ? VIM_ISDIGIT(p[2]) |
837 : ASCII_ISUPPER(p[2]))) | 837 : ASCII_ISUPPER(p[2]))) |
838 || to < from) | 838 || to < from) |
839 { | 839 { |
840 EMSG2(_(e_invarg2), p); | 840 semsg(_(e_invarg2), p); |
841 return; | 841 return; |
842 } | 842 } |
843 p += 2; | 843 p += 2; |
844 } | 844 } |
845 else | 845 else |
873 case '[': curbuf->b_op_start.lnum = 0; break; | 873 case '[': curbuf->b_op_start.lnum = 0; break; |
874 case ']': curbuf->b_op_end.lnum = 0; break; | 874 case ']': curbuf->b_op_end.lnum = 0; break; |
875 case '<': curbuf->b_visual.vi_start.lnum = 0; break; | 875 case '<': curbuf->b_visual.vi_start.lnum = 0; break; |
876 case '>': curbuf->b_visual.vi_end.lnum = 0; break; | 876 case '>': curbuf->b_visual.vi_end.lnum = 0; break; |
877 case ' ': break; | 877 case ' ': break; |
878 default: EMSG2(_(e_invarg2), p); | 878 default: semsg(_(e_invarg2), p); |
879 return; | 879 return; |
880 } | 880 } |
881 } | 881 } |
882 } | 882 } |
883 } | 883 } |