diff --git a/src/text-editing.cpp b/src/text-editing.cpp
index 482f6faebec07e79a5f52e65007dc32a6ac45d2d..5b9db13d4532a29c2926344b9f5e0322133afa45 100644 (file)
--- a/src/text-editing.cpp
+++ b/src/text-editing.cpp
@@ -109,6 +109,14 @@ sp_te_get_cursor_coords (SPItem const *item, Inkscape::Text::Layout::iterator co
}
SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position)
+{
+ SPObject const *pos_obj = sp_te_object_at_position(text, position);
+ if (pos_obj)
+ return SP_OBJECT_STYLE(pos_obj);
+ return NULL;
+}
+
+SPObject const * sp_te_object_at_position(SPItem const *text, Inkscape::Text::Layout::iterator const &position)
{
Inkscape::Text::Layout const *layout = te_get_layout(text);
if (layout == NULL)
@@ -119,8 +127,8 @@ SPStyle const * sp_te_style_at_position(SPItem const *text, Inkscape::Text::Layo
pos_obj = SP_OBJECT(rawptr);
if (pos_obj == 0) pos_obj = text;
while (SP_OBJECT_STYLE(pos_obj) == NULL)
- pos_obj = SP_OBJECT_PARENT(pos_obj); // SPStrings don't have style
- return SP_OBJECT_STYLE(pos_obj);
+ pos_obj = SP_OBJECT_PARENT(pos_obj); // not interested in SPStrings
+ return pos_obj;
}
/*
}
}
- while (tidy_xml_tree_recursively(common_ancestor));
+ while (tidy_xml_tree_recursively(common_ancestor)){};
te_update_layout_now(item);
item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
layout->validateIterator(&iter_pair.first);
@@ -1828,7 +1836,7 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta
and neither option can be made to work, a fallback could be to reduce
everything to a single level of nesting and drop all pretence of
roundtrippability. */
- while (tidy_xml_tree_recursively(common_ancestor));
+ while (tidy_xml_tree_recursively(common_ancestor)){};
// if we only modified subobjects this won't have been automatically sent
text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);