projects
/
m17n
/
m17n-lib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*** empty log message ***
[m17n/m17n-lib.git]
/
src
/
textprop.c
diff --git
a/src/textprop.c
b/src/textprop.c
index
3d84043
..
12fa41f
100644
(file)
--- a/
src/textprop.c
+++ b/
src/textprop.c
@@
-1444,23
+1444,26
@@
mtext__adjust_plist_for_change (MText *mt, int pos, int len1, int len2)
for (plist = mt->plist; plist; plist = plist->next)
{
MInterval *head = find_interval (plist, pos2);
for (plist = mt->plist; plist; plist = plist->next)
{
MInterval *head = find_interval (plist, pos2);
- MInterval *tail = mt->plist->tail;
+ MInterval *tail = plist->tail;
MTextProperty *prop;
int i;
MTextProperty *prop;
int i;
- if (head->start == pos2)
- head = head->prev;
- while (tail != head)
+ if (head)
{
{
- for (i = 0; i < tail->nprops; i++)
+ if (head->start == pos2)
+ head = head->prev;
+ while (tail != head)
{
{
- prop = tail->stack[i];
- if (prop->start == tail->start)
- prop->start += diff, prop->end += diff;
+ for (i = 0; i < tail->nprops; i++)
+ {
+ prop = tail->stack[i];
+ if (prop->start == tail->start)
+ prop->start += diff, prop->end += diff;
+ }
+ tail->start += diff;
+ tail->end += diff;
+ tail = tail->prev;
}
}
- tail->start += diff;
- tail->end += diff;
- tail = tail->prev;
}
for (i = 0; i < tail->nprops; i++)
tail->stack[i]->end += diff;
}
for (i = 0; i < tail->nprops; i++)
tail->stack[i]->end += diff;
@@
-2852,6
+2855,11
@@
mtext_serialize (MText *mt, int from, int to, MPlist *property_list)
int n;
M_CHECK_RANGE (mt, from, to, NULL, NULL);
int n;
M_CHECK_RANGE (mt, from, to, NULL, NULL);
+ if (mt->format != MTEXT_FORMAT_US_ASCII
+ && mt->format != MTEXT_FORMAT_UTF_8)
+ mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+ if (MTEXT_DATA (mt)[mtext_nbytes (mt)] != 0)
+ MTEXT_DATA (mt)[mtext_nbytes (mt)] = 0;
doc = xmlParseMemory (XML_TEMPLATE, strlen (XML_TEMPLATE) + 1);
node = xmlDocGetRootElement (doc);
doc = xmlParseMemory (XML_TEMPLATE, strlen (XML_TEMPLATE) + 1);
node = xmlDocGetRootElement (doc);