aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/sam/file.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2007-01-12 15:57:34 +0000
committerrsc <devnull@localhost>2007-01-12 15:57:34 +0000
commit78439d25f8b2f6f2289e9f4e4400e0f7cdb5fa70 (patch)
tree52eeabba50ee6446174e9228a5e27f68c4fd631e /src/cmd/sam/file.c
parentad2922ef28f026b8bbd0aee30d92f703613c1486 (diff)
downloadplan9port-78439d25f8b2f6f2289e9f4e4400e0f7cdb5fa70.tar.gz
plan9port-78439d25f8b2f6f2289e9f4e4400e0f7cdb5fa70.tar.bz2
plan9port-78439d25f8b2f6f2289e9f4e4400e0f7cdb5fa70.zip
Fix 15-year-old sam protocol bug.
Diffstat (limited to 'src/cmd/sam/file.c')
-rw-r--r--src/cmd/sam/file.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/cmd/sam/file.c b/src/cmd/sam/file.c
index 875a26c7..c0771e05 100644
--- a/src/cmd/sam/file.c
+++ b/src/cmd/sam/file.c
@@ -266,18 +266,6 @@ filedeltext(File *f, Text *t)
#endif
void
-fileinsert(File *f, uint p0, Rune *s, uint ns)
-{
- if(p0 > f->b.nc)
- panic("internal error: fileinsert");
- if(f->seq > 0)
- fileuninsert(f, &f->delta, p0, ns);
- bufinsert(&f->b, p0, s, ns);
- if(ns)
- f->mod = TRUE;
-}
-
-void
fileuninsert(File *f, Buffer *delta, uint p0, uint ns)
{
Undo u;
@@ -292,18 +280,6 @@ fileuninsert(File *f, Buffer *delta, uint p0, uint ns)
}
void
-filedelete(File *f, uint p0, uint p1)
-{
- if(!(p0<=p1 && p0<=f->b.nc && p1<=f->b.nc))
- panic("internal error: filedelete");
- if(f->seq > 0)
- fileundelete(f, &f->delta, p0, p1);
- bufdelete(&f->b, p0, p1);
- if(p1 > p0)
- f->mod = TRUE;
-}
-
-void
fileundelete(File *f, Buffer *delta, uint p0, uint p1)
{
Undo u;
@@ -499,6 +475,9 @@ fileundo(File *f, int isundo, int canredo, uint *q0p, uint *q1p, int flag)
raspstart(f);
while(delta->nc > 0){
+ /* rasp and buffer are in sync; sync with wire if needed */
+ if(needoutflush())
+ raspflush(f);
up = delta->nc-Undosize;
bufread(delta, up, (Rune*)&u, Undosize);
if(isundo){