while(gtk_text_iter_forward_line(&next_line)) {
GtkTextIter begin = next_line;
GtkTextIter end = next_line;
+ // gtk3 and gtk4 have different behavior here
+ // with gtk3, when the following line is empty, the end iter is set
+ // to the next line
gtk_text_iter_set_line_offset(&begin, 0);
gtk_text_iter_forward_to_line_end(&end);
-
+
char *line_str = gtk_text_buffer_get_slice(buffer, &begin, &end, TRUE);
char *str = line_str;
int blank = TRUE;
while(*str) {
char c = *str;
- if(!isspace(*str)) {
+ // necessary check for gtk3
+ if(c == '\n') {
+ break;
+ }
+ if(!isspace(c)) {
blank = FALSE;
break;
}
if(var_ctx->vars_unbound && cxMapSize(var_ctx->vars_unbound) > 0) {
CxMapIterator i = cxMapIterator(var_ctx->vars_unbound);
cx_foreach(CxMapEntry*, entry, i) {
- printf("attach %s\n", entry->key->data);
+ printf("attach %.*s\n", (int)entry->key->len, entry->key->data);
UiVar *var = entry->value;
UiVar *docvar = cxMapGet(doc_ctx->vars, *entry->key);
if(docvar) {