diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp index addcd520df8a198d1bb25df81204532de398fed8..97d8a0ab1abcfcecd6ec85de089019709ba8e845 100644 --- a/src/object/sp-text.cpp +++ b/src/object/sp-text.cpp @@ -394,6 +394,9 @@ void SPText::snappoints(std::vector &p, Inkscape:: void SPText::hide_shape_inside() { SPText *text = dynamic_cast(this); + if (text && !text->has_shape_inside()) { + return; + } SPStyle *item_style = this->style; if (item_style && text && item_style->shape_inside.set) { SPCSSAttr *css_unset = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET); @@ -409,6 +412,9 @@ void SPText::hide_shape_inside() void SPText::show_shape_inside() { SPText *text = dynamic_cast(this); + if (text && !text->has_shape_inside()) { + return; + } if (text && css) { this->changeCSS(css, "style"); } diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp index 7b75b2b80755989bb1cf3ac00a8ddbefec984f14..c2b72f9ac19af485e043ac575e03697f588a0867 100644 --- a/src/ui/tools/text-tool.cpp +++ b/src/ui/tools/text-tool.cpp @@ -272,19 +272,22 @@ bool TextTool::item_handler(SPItem* item, GdkEvent* event) { if (SP_IS_TEXT(item_ungrouped) || SP_IS_FLOWTEXT(item_ungrouped)) { desktop->getSelection()->set(item_ungrouped); if (this->text) { - // find out click point in document coordinates - Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y)); - // set the cursor closest to that point - if (event->button.state & GDK_SHIFT_MASK) { - this->text_sel_start = old_start; - this->text_sel_end = sp_te_get_position_by_coords(this->text, p); - } else { - this->text_sel_start = this->text_sel_end = sp_te_get_position_by_coords(this->text, p); + Inkscape::Text::Layout const *layout = te_get_layout(this->text); + if (layout && this->text_sel_start != layout->begin()) { + // find out click point in document coordinates + Geom::Point p = desktop->w2d(Geom::Point(event->button.x, event->button.y)); + // set the cursor closest to that point + if (event->button.state & GDK_SHIFT_MASK) { + this->text_sel_start = old_start; + this->text_sel_end = sp_te_get_position_by_coords(this->text, p); + } else { + this->text_sel_start = this->text_sel_end = sp_te_get_position_by_coords(this->text, p); + } + // update display + sp_text_context_update_cursor(this); + sp_text_context_update_text_selection(this); + this->dragging = 1; } - // update display - sp_text_context_update_cursor(this); - sp_text_context_update_text_selection(this); - this->dragging = 1; } ret = TRUE; } @@ -368,8 +371,8 @@ static void sp_text_context_setup_text(TextTool *tc) Inkscape::GC::release(rtext); text_item->transform = SP_ITEM(ec->desktop->currentLayer())->i2doc_affine().inverse(); + text_item->doWriteTransform(text_item->transform); text_item->updateRepr(); - text_item->doWriteTransform(text_item->transform, nullptr, true); DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT, _("Create text")); }