mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
acme: do not trim spaces during Put
The commit that introduced this was pushed accidentally. It is not a good idea to do this. (It breaks programs that think that a clean window means the body matches the on-disk file.)
This commit is contained in:
parent
9179fdaaf4
commit
3197719090
1 changed files with 8 additions and 4 deletions
|
@ -192,7 +192,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt)
|
||||||
f |= 2;
|
f |= 2;
|
||||||
}
|
}
|
||||||
aa = getbytearg(argt, TRUE, TRUE, &a);
|
aa = getbytearg(argt, TRUE, TRUE, &a);
|
||||||
if(a){
|
if(a){
|
||||||
if(strlen(a) > EVENTSIZE){ /* too big; too bad */
|
if(strlen(a) > EVENTSIZE){ /* too big; too bad */
|
||||||
free(r);
|
free(r);
|
||||||
free(aa);
|
free(aa);
|
||||||
|
@ -674,7 +674,7 @@ checksha1(char *name, File *f, Dir *d)
|
||||||
DigestState *h;
|
DigestState *h;
|
||||||
uchar out[20];
|
uchar out[20];
|
||||||
uchar *buf;
|
uchar *buf;
|
||||||
|
|
||||||
fd = open(name, OREAD);
|
fd = open(name, OREAD);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -700,7 +700,7 @@ trimspaces(Rune *r, uint *np, int eof)
|
||||||
|
|
||||||
nonspace = 0;
|
nonspace = 0;
|
||||||
w = 0;
|
w = 0;
|
||||||
n = *np;
|
n = *np;
|
||||||
for(i=0; i<n; i++) {
|
for(i=0; i<n; i++) {
|
||||||
c = r[i];
|
c = r[i];
|
||||||
if(c == '\n')
|
if(c == '\n')
|
||||||
|
@ -783,7 +783,11 @@ putfile(File *f, int q0, int q1, Rune *namer, int nname)
|
||||||
n = BUFSIZE/UTFmax;
|
n = BUFSIZE/UTFmax;
|
||||||
bufread(&f->b, q, r, n);
|
bufread(&f->b, q, r, n);
|
||||||
nn = n;
|
nn = n;
|
||||||
if(w->autoindent)
|
// An attempt at automatically trimming trailing spaces.
|
||||||
|
// Breaks programs that inspect body file and think it will match on-disk file
|
||||||
|
// when window is clean. Should apply the changes to the actual window instead.
|
||||||
|
// Later.
|
||||||
|
if(0 && w->autoindent)
|
||||||
nn = trimspaces(r, &n, q+n==q1);
|
nn = trimspaces(r, &n, q+n==q1);
|
||||||
m = snprint(s, BUFSIZE+1, "%.*S", nn, r);
|
m = snprint(s, BUFSIZE+1, "%.*S", nn, r);
|
||||||
sha1((uchar*)s, m, nil, h);
|
sha1((uchar*)s, m, nil, h);
|
||||||
|
|
Loading…
Reference in a new issue