From: Guido van Rossum Date: Mon, 19 Sep 1994 08:08:50 +0000 (+0000) Subject: * Python/pythonrun.c (print_error): print only last line of X-Git-Tag: v1.1~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=798199d8a60528a0c565926fbf21a299fd3adbf5;p=thirdparty%2FPython%2Fcpython.git * Python/pythonrun.c (print_error): print only last line of multi-line source line --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index e547f9238a0c..978e4b866bdf 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -286,6 +286,18 @@ print_error() writestring(buf, f); writestring("\n", f); if (text != NULL) { + char *nl; + if (offset > 0 && + offset == strlen(text)) + offset--; + for (;;) { + nl = strchr(text, '\n'); + if (nl == NULL || + nl-text >= offset) + break; + offset -= (nl+1-text); + text = nl+1; + } while (*text == ' ' || *text == '\t') { text++; offset--;