version 1.12, 2002/07/24 14:08:33 |
version 1.13, 2002/08/22 23:28:19 |
|
|
* |
* |
* Find an absolute dot in the buffer from a line/offset pair, and vice-versa. |
* Find an absolute dot in the buffer from a line/offset pair, and vice-versa. |
* |
* |
* Since lines can be deleted while they are referenced by undo record, we |
* Since lines can be deleted while they are referenced by undo record, we |
* need to have an absolute dot to have something reliable. |
* need to have an absolute dot to have something reliable. |
*/ |
*/ |
|
|
|
|
return (TRUE); |
return (TRUE); |
} |
} |
|
|
/* |
/* |
* If asocial is true, we arrange for this record to be let alone. forever. |
* If asocial is true, we arrange for this record to be let alone. forever. |
* Yes, this is a bit of a hack... |
* Yes, this is a bit of a hack... |
*/ |
*/ |
|
|
|
|
/* |
/* |
* We try to reuse the last undo record to `compress' things. |
* We try to reuse the last undo record to `compress' things. |
*/ |
*/ |
rec = LIST_FIRST(&curbp->b_undo); |
rec = LIST_FIRST(&curbp->b_undo); |
if (rec != NULL) { |
if (rec != NULL) { |
/* this will be hit like, 80% of the time... */ |
/* this will be hit like, 80% of the time... */ |
|
|
|
|
num = 0; |
num = 0; |
for (rec = LIST_FIRST(&curbp->b_undo); rec != NULL; |
for (rec = LIST_FIRST(&curbp->b_undo); rec != NULL; |
rec = LIST_NEXT(rec, next)) { |
rec = LIST_NEXT(rec, next)) { |
num++; |
num++; |
snprintf(buf, sizeof buf, |
snprintf(buf, sizeof buf, |
"Record %d =>\t %s at %d ", num, |
"Record %d =>\t %s at %d ", num, |
|
|
* [action1] |
* [action1] |
* ------ |
* ------ |
* [undo] |
* [undo] |
* |
* |
* After another undo: |
* After another undo: |
* |
* |
* |
* |
|
|
* [action1] <--- Undoptr |
* [action1] <--- Undoptr |
* ------ |
* ------ |
* [undo] |
* [undo] |
* |
* |
* Note that the "undo of actionX" have no special meaning. Only when, |
* Note that the "undo of actionX" have no special meaning. Only when, |
* say, we undo a deletion, the insertion will be recorded just as if it |
* say, we undo a deletion, the insertion will be recorded just as if it |
* was typed on the keyboard. Resulting in the inverse operation being |
* was typed on the keyboard. Resulting in the inverse operation being |
|
|
break; |
break; |
} |
} |
|
|
/* |
/* |
* Loop while we don't get a boundary specifying we've |
* Loop while we don't get a boundary specifying we've |
* finished the current action... |
* finished the current action... |
*/ |
*/ |
|
|
ldelete(ptr->region.r_size, KFORW); |
ldelete(ptr->region.r_size, KFORW); |
break; |
break; |
case DELETE: |
case DELETE: |
region_put_data(ptr->content, |
region_put_data(ptr->content, |
ptr->region.r_size); |
ptr->region.r_size); |
break; |
break; |
case BOUNDARY: |
case BOUNDARY: |
|
|
curbp->b_undopos.r_linep = curwp->w_dotp; |
curbp->b_undopos.r_linep = curwp->w_dotp; |
curbp->b_undopos.r_offset = curwp->w_doto; |
curbp->b_undopos.r_offset = curwp->w_doto; |
|
|
return (rval); |
return (rval); |
} |
} |