130 return; |
130 return; |
131 } |
131 } |
132 |
132 |
133 if(mgr->cur) { |
133 if(mgr->cur) { |
134 UcxList *elm = mgr->cur->next; |
134 UcxList *elm = mgr->cur->next; |
135 while(elm) { |
135 if(elm) { |
136 ui_free_textbuf_op(elm->data); |
136 mgr->cur->next = NULL; |
137 UcxList *next = elm->next; |
137 while(elm) { |
138 ucx_list_remove(mgr->begin, elm); |
138 elm->prev = NULL; |
139 elm = next; |
139 UcxList *next = elm->next; |
|
140 ui_free_textbuf_op(elm->data); |
|
141 free(elm); |
|
142 elm = next; |
|
143 } |
140 } |
144 } |
141 |
145 |
142 UiTextBufOp *last_op = mgr->cur->data; |
146 UiTextBufOp *last_op = mgr->cur->data; |
143 if(ui_check_insertstr(last_op->text, last_op->len, text, length) == 0) { |
147 if( |
|
148 last_op->type == UI_TEXTBUF_INSERT && |
|
149 ui_check_insertstr(last_op->text, last_op->len, text, length) == 0) |
|
150 { |
144 // append text to last op |
151 // append text to last op |
145 int ln = last_op->len; |
152 int ln = last_op->len; |
146 char *newtext = malloc(ln + length + 1); |
153 char *newtext = malloc(ln + length + 1); |
147 memcpy(newtext, last_op->text, ln); |
154 memcpy(newtext, last_op->text, ln); |
148 memcpy(newtext+ln, text, length); |
155 memcpy(newtext+ln, text, length); |
184 return; |
191 return; |
185 } |
192 } |
186 |
193 |
187 if(mgr->cur) { |
194 if(mgr->cur) { |
188 UcxList *elm = mgr->cur->next; |
195 UcxList *elm = mgr->cur->next; |
189 while(elm) { |
196 if(elm) { |
190 ui_free_textbuf_op(elm->data); |
197 mgr->cur->next = NULL; |
191 UcxList *next = elm->next; |
198 while(elm) { |
192 ucx_list_remove(mgr->begin, elm); |
199 elm->prev = NULL; |
193 elm = next; |
200 UcxList *next = elm->next; |
|
201 ui_free_textbuf_op(elm->data); |
|
202 free(elm); |
|
203 elm = next; |
|
204 } |
194 } |
205 } |
195 } |
206 } |
196 |
207 |
197 char *text = gtk_text_buffer_get_text(value->obj, start, end, FALSE); |
208 char *text = gtk_text_buffer_get_text(value->obj, start, end, FALSE); |
198 |
209 |