Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
projects
:
sysutils
>
joe
> joe-3.7-indent-ow.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File joe-3.7-indent-ow.patch of Package joe
diff -up joe-3.7/uformat.c.pom joe-3.7/uformat.c --- joe-3.7/uformat.c.pom 2008-10-28 05:13:56.000000000 +0100 +++ joe-3.7/uformat.c 2011-01-03 12:58:53.000000000 +0100 @@ -330,6 +330,7 @@ void wrapword(BW *bw, P *p, long int ind int c; long to = p->byte; int my_indents = 0; + off_t indents_size = 0; /* autoindent when called by utype */ if (!indents) { @@ -347,7 +348,8 @@ void wrapword(BW *bw, P *p, long int ind indent = nindent(bw, q, 0); pcol(r, indent); - indents = brs(q, r->byte - q->byte); + indents_size = r->byte - q->byte; + indents = brs(q, indents_size); prm(r); } else { /* First line */ @@ -356,14 +358,15 @@ void wrapword(BW *bw, P *p, long int ind indent = nindent(bw, s, 1); pcol(r, indent); - indents = brs(s, r->byte - s->byte); + indents_size = r->byte - s->byte; + indents = brs(s, indents_size); prm(r); if (!bw->o.autoindent) { /* Don't indent second line of single-line paragraphs if autoindent is off */ int x = zlen(indents); while (x && (indents[x - 1] == ' ' || indents[x - 1] == '\t')) indents[--x] = 0; - if (x) { + if ((x) && (x < indents_size)) { indents[x++] = ' '; indents[x] = 0; } @@ -522,6 +525,7 @@ int uformat(BW *bw) long curoff; int c; P *p, *q; + off_t indents_size = 0; p = pdup(bw->cursor, USTR "uformat"); p_goto_bol(p); @@ -552,21 +556,23 @@ int uformat(BW *bw) indent = nindent(bw, q, 0); pcol(r, indent); - indents = brs(q, r->byte - q->byte); + indents_size = r->byte - q->byte; + indents = brs(q, indents_size); prm(r); } else { P *r = pdup(p, USTR "uformat"); int x, y; indent = nindent(bw, p, 1); /* allowing * and - here */ pcol(r, indent); - indents = brs(p, r->byte - p->byte); + indents_size = r->byte - p->byte; + indents = brs(p, indents_size); prm(r); if (!bw->o.autoindent) { /* Don't indent second line of single-line paragraphs if autoindent is off */ int x = zlen(indents); while (x && (indents[x - 1] == ' ' || indents[x - 1] == '\t')) indents[--x] = 0; - if (x) { + if ((x) && (x < indents_size)) { indents[x++] = ' '; indents[x] = 0; }