#undef WRAP_DEBUG
#ifdef WRAP_DEBUG
/* Darko: used when I debug wrapping */
-void dump_text(GtkTextBuffer textbuf, int pos, int tlen, int breakoncr)
+void dump_text(GtkTextBuffer *textbuf, int pos, int tlen, int breakoncr)
{
gint i, clen;
gchar cbuf[CHAR_BUF_SIZE];
+ GtkTextIter iter, end_iter;
printf("%d [", pos);
gtk_text_buffer_get_iter_at_offset(textbuf, &iter, pos);
gtk_text_buffer_get_iter_at_offset(textbuf, &end_iter, pos + tlen);
for (; gtk_text_iter_forward_char(&iter) &&
- gtk_text_iter_compare(&iter, &end_iter) < 0;)
+ gtk_text_iter_compare(&iter, &end_iter) < 0;) {
GET_CHAR(&iter, cbuf, clen);
if (clen < 0) break;
if (breakoncr && clen == 1 && cbuf[0] == '\n')
is_new_line = TRUE;
#ifdef WRAP_DEBUG
g_print("after delete l_pos=");
- dump_text(text, line_pos, tlen, 1);
+ dump_text(textbuf, line_pos, tlen, 1);
#endif
/* move beginning of line if we are on LF */
gtk_text_buffer_get_iter_at_offset(textbuf,
#ifdef WRAP_DEBUG
g_print("should wrap cur_pos=%d ", cur_pos);
- dump_text(text, p_pos, tlen, 1);
- dump_text(text, line_pos, tlen, 1);
+ dump_text(textbuf, p_pos, tlen, 1);
+ dump_text(textbuf, line_pos, tlen, 1);
#endif
/* force wrapping if it is one long word but not URL */
if (line_pos - p_pos <= i_len)
gtkut_text_buffer_is_uri_string(textbuf, line_pos, tlen)) {
#ifdef WRAP_DEBUG
g_print("found URL at ");
- dump_text(text, line_pos, tlen, 1);
+ dump_text(textbuf, line_pos, tlen, 1);
#endif
continue;
}
do_delete = FALSE;
#ifdef WRAP_DEBUG
g_print("after CR insert ");
- dump_text(text, line_pos, tlen, 1);
- dump_text(text, cur_pos, tlen, 1);
+ dump_text(textbuf, line_pos, tlen, 1);
+ dump_text(textbuf, cur_pos, tlen, 1);
#endif
/* should we insert quotation ? */
}
#ifdef WRAP_DEBUG
g_print("after quote insert ");
- dump_text(text, line_pos, tlen, 1);
+ dump_text(textbuf, line_pos, tlen, 1);
#endif
}
}