278 mgr->cur = mgr->cur->prev; |
276 mgr->cur = mgr->cur->prev; |
279 } |
277 } |
280 } |
278 } |
281 |
279 |
282 void ui_text_redo(UiText *value) { |
280 void ui_text_redo(UiText *value) { |
283 |
281 UiUndoMgr *mgr = value->undomgr; |
284 } |
282 |
|
283 UcxList *elm = NULL; |
|
284 if(mgr->cur) { |
|
285 if(mgr->cur->next) { |
|
286 elm = mgr->cur->next; |
|
287 } |
|
288 } else if(mgr->begin) { |
|
289 elm = mgr->begin; |
|
290 } |
|
291 |
|
292 if(elm) { |
|
293 UiTextBufOp *op = elm->data; |
|
294 mgr->event = 0; |
|
295 switch(op->type) { |
|
296 case UI_TEXTBUF_INSERT: { |
|
297 GtkTextIter begin; |
|
298 GtkTextIter end; |
|
299 gtk_text_buffer_get_iter_at_offset(value->obj, &begin, op->start); |
|
300 gtk_text_buffer_get_iter_at_offset(value->obj, &end, op->end); |
|
301 gtk_text_buffer_insert(value->obj, &begin, op->text, op->len); |
|
302 break; |
|
303 } |
|
304 case UI_TEXTBUF_DELETE: { |
|
305 GtkTextIter begin; |
|
306 GtkTextIter end; |
|
307 gtk_text_buffer_get_iter_at_offset(value->obj, &begin, op->start); |
|
308 gtk_text_buffer_get_iter_at_offset(value->obj, &end, op->end); |
|
309 gtk_text_buffer_delete(value->obj, &begin, &end); |
|
310 break; |
|
311 } |
|
312 } |
|
313 mgr->event = 1; |
|
314 mgr->cur = elm; |
|
315 } |
|
316 } |