Lines Matching defs:undo
67 XawTextUndoList *undo, *redo;
71 XawTextUndoBuffer **undo;
309 src->textSrc.undo = (XawTextUndo*)XtCalloc(1, sizeof(XawTextUndo));
310 src->textSrc.undo->dir = XawsdLeft;
313 src->textSrc.undo = NULL;
338 FreeUndoBuffer(src->textSrc.undo);
339 XtFree((char*)src->textSrc.undo);
372 newtw->textSrc.undo = (XawTextUndo*)
374 newtw->textSrc.undo->dir = XawsdLeft;
377 FreeUndoBuffer(newtw->textSrc.undo);
378 XtFree((char*)newtw->textSrc.undo);
379 newtw->textSrc.undo = NULL;
384 if (newtw->textSrc.undo->list) {
385 newtw->textSrc.undo->l_no_change =
386 newtw->textSrc.undo->list->left;
387 newtw->textSrc.undo->r_no_change =
388 newtw->textSrc.undo->list->right;
391 newtw->textSrc.undo->l_no_change =
392 newtw->textSrc.undo->r_no_change = NULL;
692 src->textSrc.undo->erase = value;
702 src->textSrc.undo->merge += state ? 1 : -1;
734 XawTextUndoList *undo;
747 if (src->textSrc.undo->l_save) {
748 l_state = src->textSrc.undo->l_save;
749 src->textSrc.undo->l_save = NULL;
783 if (src->textSrc.undo->r_save) {
784 r_state = src->textSrc.undo->r_save;
785 src->textSrc.undo->r_save = NULL;
808 if (src->textSrc.undo->u_save) {
809 undo = src->textSrc.undo->u_save;
810 src->textSrc.undo->u_save = NULL;
813 undo = XtNew(XawTextUndoList);
814 undo->left = l_state;
815 undo->right = r_state;
816 undo->undo = src->textSrc.undo->list;
817 undo->redo = NULL;
820 undo = NULL;
866 src->textSrc.undo->l_save = l_state;
872 src->textSrc.undo->r_save = r_state;
874 src->textSrc.undo->u_save = undo;
878 XawTextUndoList *list = src->textSrc.undo->list;
880 int erase = undo->right->length == 0 && undo->left->length == 1 && list
884 erase = list->left->position - 1 == undo->left->position ? -1 :
885 list->left->position == undo->left->position ? 1 : 0;
886 if (src->textSrc.undo->erase && erase != src->textSrc.undo->erase)
889 src->textSrc.undo->erase = erase;
901 /* Try to merge the undo buffers */
902 if (src->textSrc.undo->merge > 0 && ((erase ||
903 (list && ((list->left->length == 0 && undo->left->length == 0) ||
905 undo->left->length == 1)) &&
906 undo->right->length == 1 &&
908 == undo->right->position))
909 && src->textSrc.undo->pointer == list
924 undo->right->buffer, size);
933 src->textSrc.undo->l_save = l_state;
934 src->textSrc.undo->r_save = r_state;
935 src->textSrc.undo->u_save = undo;
942 undo->left->buffer, size);
947 memcpy(list->left->buffer, undo->left->buffer, size);
954 if (src->textSrc.undo->num_list >= UNDO_DEPTH)
955 UndoGC(src->textSrc.undo);
958 src->textSrc.undo->undo = (XawTextUndoBuffer**)
959 XtRealloc((char*)src->textSrc.undo->undo,
960 (Cardinal)((2 + src->textSrc.undo->num_undo)
962 src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = l_state;
963 src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = r_state;
965 if (src->textSrc.undo->list)
966 src->textSrc.undo->list->redo = undo;
968 src->textSrc.undo->head = undo;
970 src->textSrc.undo->merge = l_state->length <= 1 &&
973 src->textSrc.undo->list = src->textSrc.undo->pointer =
974 src->textSrc.undo->end_mark = undo;
976 if (++src->textSrc.undo->num_list >= UNDO_DEPTH)
977 UndoGC(src->textSrc.undo);
979 src->textSrc.undo->dir = XawsdLeft;
981 src->textSrc.undo->l_no_change = src->textSrc.undo->list->right;
982 src->textSrc.undo->r_no_change = src->textSrc.undo->list->left;
1219 if (!src->textSrc.enable_undo || !src->textSrc.undo->num_undo)
1222 list = src->textSrc.undo->pointer;
1224 if (src->textSrc.undo->dir == XawsdLeft) {
1233 if (src->textSrc.undo->l_no_change == l_state
1234 && src->textSrc.undo->r_no_change == r_state)
1258 nlist->undo = src->textSrc.undo->list;
1261 if (list == src->textSrc.undo->list)
1262 src->textSrc.undo->end_mark = nlist;
1264 if (src->textSrc.undo->dir == XawsdLeft) {
1265 if (list->undo == NULL)
1266 src->textSrc.undo->dir = XawsdRight;
1268 list = list->undo;
1271 if (list->redo == NULL || list->redo == src->textSrc.undo->end_mark)
1272 src->textSrc.undo->dir = XawsdLeft;
1277 src->textSrc.undo->pointer = list;
1278 src->textSrc.undo->list->redo = nlist;
1279 src->textSrc.undo->list = nlist;
1280 src->textSrc.undo->merge = src->textSrc.undo->erase = 0;
1282 if (++src->textSrc.undo->num_list >= UNDO_DEPTH)
1283 UndoGC(src->textSrc.undo);
1291 if (!src->textSrc.enable_undo || !src->textSrc.undo->num_undo)
1294 if (src->textSrc.undo->pointer != src->textSrc.undo->list) {
1295 if (src->textSrc.undo->dir == XawsdLeft) {
1296 if (src->textSrc.undo->pointer->redo
1297 && (src->textSrc.undo->pointer->redo
1298 != src->textSrc.undo->end_mark)) {
1299 src->textSrc.undo->pointer = src->textSrc.undo->pointer->redo;
1300 src->textSrc.undo->dir = XawsdRight;
1304 if (src->textSrc.undo->pointer->undo
1305 && (src->textSrc.undo->pointer != src->textSrc.undo->head)) {
1306 src->textSrc.undo->pointer = src->textSrc.undo->pointer->undo;
1307 src->textSrc.undo->dir = XawsdLeft;
1316 FreeUndoBuffer(XawTextUndo *undo)
1321 for (i = 0; i < undo->num_undo; i++) {
1322 if (undo->undo[i]->buffer && undo->undo[i]->buffer != SrcNL &&
1323 undo->undo[i]->buffer != (char*)SrcWNL)
1324 XtFree(undo->undo[i]->buffer);
1325 XtFree((char*)undo->undo[i]);
1327 XtFree((char*)undo->undo);
1328 head = undo->head;
1337 if (undo->l_save) {
1338 XtFree((char*)undo->l_save);
1339 undo->l_save = NULL;
1341 if (undo->r_save) {
1342 XtFree((char*)undo->r_save);
1343 undo->r_save = NULL;
1345 if (undo->u_save) {
1346 XtFree((char*)undo->u_save);
1347 undo->u_save = NULL;
1350 undo->list = undo->pointer = undo->head = undo->end_mark = NULL;
1351 undo->l_no_change = undo->r_no_change = NULL;
1352 undo->undo = NULL;
1353 undo->dir = XawsdLeft;
1354 undo->num_undo = undo->num_list = (unsigned)(undo->erase = undo->merge = 0);
1358 UndoGC(XawTextUndo *undo)
1360 XawTextUndoList *head = undo->head, *redo = head->redo;
1362 if (head == undo->pointer || head == undo->end_mark
1363 || undo->l_no_change == NULL
1364 || head->left == undo->l_no_change || head->right == undo->l_no_change)
1367 undo->head = redo;
1368 redo->undo = NULL;
1374 for (i = 0; i < undo->num_undo; i+= 2)
1375 if (head->left == undo->undo[i] || head->left == undo->undo[i+1]) {
1376 if (head->left == undo->undo[i+1]) {
1391 undo->num_undo -= 2;
1392 memmove(&undo->undo[i], &undo->undo[i + 2],
1393 (undo->num_undo - i) * sizeof(XawTextUndoBuffer*));
1398 --undo->num_list;