Mercurial > vim
comparison src/fold.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 | 03831e5ea0de |
children | 1ec942f1b648 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
408 * closed fold. */ | 408 * closed fold. */ |
409 if (!opening && !recurse) | 409 if (!opening && !recurse) |
410 (void)hasFolding(lnum, NULL, &lnum_next); | 410 (void)hasFolding(lnum, NULL, &lnum_next); |
411 } | 411 } |
412 if (done == DONE_NOTHING) | 412 if (done == DONE_NOTHING) |
413 EMSG(_(e_nofold)); | 413 emsg(_(e_nofold)); |
414 /* Force a redraw to remove the Visual highlighting. */ | 414 /* Force a redraw to remove the Visual highlighting. */ |
415 if (had_visual) | 415 if (had_visual) |
416 redraw_curbuf_later(INVERTED); | 416 redraw_curbuf_later(INVERTED); |
417 } | 417 } |
418 | 418 |
559 foldManualAllowed(int create) | 559 foldManualAllowed(int create) |
560 { | 560 { |
561 if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) | 561 if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) |
562 return TRUE; | 562 return TRUE; |
563 if (create) | 563 if (create) |
564 EMSG(_("E350: Cannot create fold with current 'foldmethod'")); | 564 emsg(_("E350: Cannot create fold with current 'foldmethod'")); |
565 else | 565 else |
566 EMSG(_("E351: Cannot delete fold with current 'foldmethod'")); | 566 emsg(_("E351: Cannot delete fold with current 'foldmethod'")); |
567 return FALSE; | 567 return FALSE; |
568 } | 568 } |
569 | 569 |
570 /* foldCreate() {{{2 */ | 570 /* foldCreate() {{{2 */ |
571 /* | 571 /* |
773 changed_window_setting(); | 773 changed_window_setting(); |
774 } | 774 } |
775 } | 775 } |
776 if (!did_one) | 776 if (!did_one) |
777 { | 777 { |
778 EMSG(_(e_nofold)); | 778 emsg(_(e_nofold)); |
779 /* Force a redraw to remove the Visual highlighting. */ | 779 /* Force a redraw to remove the Visual highlighting. */ |
780 if (had_visual) | 780 if (had_visual) |
781 redraw_curbuf_later(INVERTED); | 781 redraw_curbuf_later(INVERTED); |
782 } | 782 } |
783 else | 783 else |
1209 (void)setManualFold(lnum, do_open, FALSE, &done); | 1209 (void)setManualFold(lnum, do_open, FALSE, &done); |
1210 if (!(done & DONE_ACTION)) | 1210 if (!(done & DONE_ACTION)) |
1211 { | 1211 { |
1212 /* Only give an error message when no fold could be opened. */ | 1212 /* Only give an error message when no fold could be opened. */ |
1213 if (n == 0 && !(done & DONE_FOLD)) | 1213 if (n == 0 && !(done & DONE_FOLD)) |
1214 EMSG(_(e_nofold)); | 1214 emsg(_(e_nofold)); |
1215 break; | 1215 break; |
1216 } | 1216 } |
1217 } | 1217 } |
1218 } | 1218 } |
1219 | 1219 |
1361 if (done & DONE_ACTION) | 1361 if (done & DONE_ACTION) |
1362 changed_window_setting_win(wp); | 1362 changed_window_setting_win(wp); |
1363 done |= DONE_FOLD; | 1363 done |= DONE_FOLD; |
1364 } | 1364 } |
1365 else if (donep == NULL && wp == curwin) | 1365 else if (donep == NULL && wp == curwin) |
1366 EMSG(_(e_nofold)); | 1366 emsg(_(e_nofold)); |
1367 | 1367 |
1368 if (donep != NULL) | 1368 if (donep != NULL) |
1369 *donep |= done; | 1369 *donep |= done; |
1370 | 1370 |
1371 return next; | 1371 return next; |
1733 static void | 1733 static void |
1734 foldCreateMarkers(linenr_T start, linenr_T end) | 1734 foldCreateMarkers(linenr_T start, linenr_T end) |
1735 { | 1735 { |
1736 if (!curbuf->b_p_ma) | 1736 if (!curbuf->b_p_ma) |
1737 { | 1737 { |
1738 EMSG(_(e_modifiable)); | 1738 emsg(_(e_modifiable)); |
1739 return; | 1739 return; |
1740 } | 1740 } |
1741 parseMarker(curwin); | 1741 parseMarker(curwin); |
1742 | 1742 |
1743 foldAddMarker(start, curwin->w_p_fmr, foldstartmarkerlen); | 1743 foldAddMarker(start, curwin->w_p_fmr, foldstartmarkerlen); |