diff options
Diffstat (limited to 'eval_error.c')
-rw-r--r-- | eval_error.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/eval_error.c b/eval_error.c index d909125fbd..d630f47014 100644 --- a/eval_error.c +++ b/eval_error.c @@ -153,14 +153,16 @@ print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg, const VA write_warn2(str, "\n", 1); } if (tail) { - if (highlight) { - if (einfo[elen-1] == '\n') --elen; - write_warn(str, bold); + int eol = einfo[elen-1] == '\n'; + if (eol && highlight) --elen; + if (tail < einfo+elen) { + if (highlight) write_warn(str, bold); + write_warn2(str, tail, einfo+elen-tail); + if (highlight) write_warn(str, reset); + if (highlight || !eol) write_warn2(str, "\n", 1); } - if (tail < einfo+elen) write_warn2(str, tail, einfo+elen-tail); } - if (tail ? (highlight || einfo[elen-1] != '\n') : !epath) { - if (highlight) write_warn(str, reset); + else if (!epath) { write_warn2(str, "\n", 1); } } |