teco

Check-in [48baaa179d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add undo hook for search/replace
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:48baaa179df4ea87276623613dee18a7a25ccbb34743602c685b16f9b5f501bc
User & Date: ajv-899-334-8894@vsta.org 2013-12-17 21:47:05
Context
2013-12-18
20:29
Undo/redo bringup check-in: 60afa1285f user: ajv-899-334-8894@vsta.org tags: master, trunk
2013-12-17
21:47
Add undo hook for search/replace check-in: 48baaa179d user: ajv-899-334-8894@vsta.org tags: master, trunk
21:36
Bringup, phase 1: undo. Make some undo stuff private to undo.c check-in: 8e111f84f0 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to exec2.c.

1281
1282
1283
1284
1285
1286
1287






1288
1289
1290
1291
1292
1293
1294
....
1361
1362
1363
1364
1365
1366
1367



1368
1369
1370
1371
1372
1373
1374

        /* save a pointer to the current spot */
        set_pointer(dot, &cc);

        /* back dot up over the string */
        dot += ctrl_s;







        /* code from "insert1": convert dot to a qp */
        set_pointer(dot, &aa);

        /* save beginning of original cell */
        delete_p = aa.p;

        /* update earliest char loc touched */
................................................................................
            /*
             * Squeeze buffer, return unused cells, end buffer
             */
            movenchars(&cc, &bb, z-dot);
            free_blist(bb.p->f);
            bb.p->f = NULL;
        }




        /* add # of chars inserted */
        z += ins_count;
        dot += ins_count;
        ctrl_s = -ins_count;		/* save string length */
        esp->flag1 = esp->flag2 = 0;	/* and consume arguments */
        esp->op = OP_START;







>
>
>
>
>
>







 







>
>
>







1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
....
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383

        /* save a pointer to the current spot */
        set_pointer(dot, &cc);

        /* back dot up over the string */
        dot += ctrl_s;

	/*
	 * Record replace as delete+insert.
	 * Here, we note the part being removed.
	 */
	undo_del(dot, -ctrl_s);

        /* code from "insert1": convert dot to a qp */
        set_pointer(dot, &aa);

        /* save beginning of original cell */
        delete_p = aa.p;

        /* update earliest char loc touched */
................................................................................
            /*
             * Squeeze buffer, return unused cells, end buffer
             */
            movenchars(&cc, &bb, z-dot);
            free_blist(bb.p->f);
            bb.p->f = NULL;
        }

	/* Second part of undo: note amount inserted */
	undo_insert(dot, ins_count);

        /* add # of chars inserted */
        z += ins_count;
        dot += ins_count;
        ctrl_s = -ins_count;		/* save string length */
        esp->flag1 = esp->flag2 = 0;	/* and consume arguments */
        esp->op = OP_START;