diff options
Diffstat (limited to 'src/ui/dialog/attrdialog.cpp')
| -rw-r--r-- | src/ui/dialog/attrdialog.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ui/dialog/attrdialog.cpp b/src/ui/dialog/attrdialog.cpp index ce24e3272..0403f9b7c 100644 --- a/src/ui/dialog/attrdialog.cpp +++ b/src/ui/dialog/attrdialog.cpp @@ -18,6 +18,7 @@ #include "message-context.h" #include "message-stack.h" +#include "style.h" #include "ui/icon-loader.h" #include "ui/widget/iconrenderer.h" @@ -234,7 +235,7 @@ void AttrDialog::onAttrChanged(Inkscape::XML::Node *repr, const gchar * name, co } } } - if (new_value) { + if (new_value && strcmp(new_value, "") != 0) { if ((repr->type() == Inkscape::XML::TEXT_NODE || repr->type() == Inkscape::XML::COMMENT_NODE) && strcmp(name, "content") != 0) { @@ -335,9 +336,16 @@ bool AttrDialog::onKeyPressed(GdkEventKey *event) */ void AttrDialog::nameEdited (const Glib::ustring& path, const Glib::ustring& name) { - Gtk::TreeModel::Row row = *_store->get_iter(path); + Gtk::TreeIter iter = *_store->get_iter(path); + Gtk::TreeModel::Path modelpath = (Gtk::TreeModel::Path)iter; + Gtk::TreeModel::Row row = *iter; if(row && this->_repr) { Glib::ustring old_name = row[_attrColumns._attributeName]; + if (old_name == name) { + _treeView.set_cursor(modelpath, *_valueCol, true); + grab_focus(); + return; + } if (old_name == "content" || old_name == name) { @@ -350,8 +358,10 @@ void AttrDialog::nameEdited (const Glib::ustring& path, const Glib::ustring& nam _repr->setAttribute(old_name.c_str(), nullptr, false); } if (!name.empty()) { - _repr->setAttribute(name.c_str(), value, false); row[_attrColumns._attributeName] = name; + _repr->setAttribute(name.c_str(), value, false); + _treeView.set_cursor(modelpath, *_valueCol, true); + grab_focus(); } this->setUndo(_("Rename attribute")); } |
