Improving the visibility of the undo-related debugging messages.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5255 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
86cbd959f6
commit
3021a04c1c
|
@ -11,6 +11,8 @@
|
||||||
comments. And try to put the more frequent condition first.
|
comments. And try to put the more frequent condition first.
|
||||||
* src/text.c (add_undo): Rename the parameter 'current_action' to
|
* src/text.c (add_undo): Rename the parameter 'current_action' to
|
||||||
'action', to match the other functions.
|
'action', to match the other functions.
|
||||||
|
* src/text.c (do_undo, add_undo, update_undo): Improve the visibility
|
||||||
|
of the undo-related debugging messages.
|
||||||
|
|
||||||
2015-06-14 Benno Schulenberg <bensberg@justemail.net>
|
2015-06-14 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/winio.c (edit_draw): Add some debugging code to track which
|
* src/winio.c (edit_draw): Add some debugging code to track which
|
||||||
|
|
25
src/text.c
25
src/text.c
|
@ -458,8 +458,8 @@ void do_undo(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "data we're about to undo = \"%s\"\n", f->data);
|
fprintf(stderr, " >> Undoing a type %d...\n", u->type);
|
||||||
fprintf(stderr, "Undo running for type %d\n", u->type);
|
fprintf(stderr, " >> Data we're about to undo = \"%s\"\n", f->data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
openfile->current_x = u->begin;
|
openfile->current_x = u->begin;
|
||||||
|
@ -899,6 +899,10 @@ void add_undo(undo_type action)
|
||||||
free(u2);
|
free(u2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, " >> Adding an undo...\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allocate and initialize a new undo type. */
|
/* Allocate and initialize a new undo type. */
|
||||||
u = (undo *) nmalloc(sizeof(undo));
|
u = (undo *) nmalloc(sizeof(undo));
|
||||||
u->type = action;
|
u->type = action;
|
||||||
|
@ -1003,9 +1007,8 @@ void add_undo(undo_type action)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "fs->current->data = \"%s\", current_x = %lu, u->begin = %lu, type = %d\n",
|
fprintf(stderr, " >> fs->current->data = \"%s\", current_x = %lu, u->begin = %lu, type = %d\n",
|
||||||
fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin, action);
|
fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin, action);
|
||||||
fprintf(stderr, "left add_undo...\n");
|
|
||||||
#endif
|
#endif
|
||||||
fs->last_action = action;
|
fs->last_action = action;
|
||||||
}
|
}
|
||||||
|
@ -1020,10 +1023,10 @@ void update_undo(undo_type action)
|
||||||
openfilestruct *fs = openfile;
|
openfilestruct *fs = openfile;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %ld",
|
fprintf(stderr, " >> Updating... action = %d, fs->last_action = %d, openfile->current->lineno = %ld",
|
||||||
action, fs->last_action, (long)openfile->current->lineno);
|
action, fs->last_action, (long)openfile->current->lineno);
|
||||||
if (fs->current_undo)
|
if (fs->current_undo)
|
||||||
fprintf(stderr, "fs->current_undo->lineno = %ld\n", (long)fs->current_undo->lineno);
|
fprintf(stderr, ", fs->current_undo->lineno = %ld\n", (long)fs->current_undo->lineno);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1043,14 +1046,14 @@ fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno =
|
||||||
switch (u->type) {
|
switch (u->type) {
|
||||||
case ADD: {
|
case ADD: {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "fs->current->data = \"%s\", current_x = %lu, u->begin = %lu\n",
|
fprintf(stderr, " >> fs->current->data = \"%s\", current_x = %lu, u->begin = %lu\n",
|
||||||
fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin);
|
fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin);
|
||||||
#endif
|
#endif
|
||||||
char *char_buf = charalloc(mb_cur_max());
|
char *char_buf = charalloc(mb_cur_max());
|
||||||
size_t char_buf_len = parse_mbchar(&fs->current->data[u->mark_begin_x], char_buf, NULL);
|
size_t char_buf_len = parse_mbchar(&fs->current->data[u->mark_begin_x], char_buf, NULL);
|
||||||
u->strdata = addstrings(u->strdata, u->strdata ? strlen(u->strdata) : 0, char_buf, char_buf_len);
|
u->strdata = addstrings(u->strdata, u->strdata ? strlen(u->strdata) : 0, char_buf, char_buf_len);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "current undo data now \"%s\"\n", u->strdata);
|
fprintf(stderr, " >> current undo data is \"%s\"\n", u->strdata);
|
||||||
#endif
|
#endif
|
||||||
u->mark_begin_lineno = fs->current->lineno;
|
u->mark_begin_lineno = fs->current->lineno;
|
||||||
u->mark_begin_x = fs->current_x;
|
u->mark_begin_x = fs->current_x;
|
||||||
|
@ -1075,7 +1078,7 @@ fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno =
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "current undo data now \"%s\"\nu->begin = %lu\n", u->strdata, (unsigned long)u->begin);
|
fprintf(stderr, " >> current undo data is \"%s\"\nu->begin = %lu\n", u->strdata, (unsigned long)u->begin);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1138,7 @@ fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno =
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "Done in update_undo (type was %d)\n", action);
|
fprintf(stderr, " >> Done in update_undo (type was %d)\n", action);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
Loading…
Reference in New Issue