Skip to content

Commit

Permalink
+ Avoid too lenthy object names in document
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 29, 2013
1 parent c1d14ea commit 5b66541
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/App/Document.cpp
Expand Up @@ -1800,6 +1800,12 @@ std::string Document::getUniqueObjectName(const char *Name) const
if (!Name || *Name == '\0')
return std::string();
std::string CleanName = Base::Tools::getIdentifier(Name);
// remove also trailing digits from clean name which is to avoid to create lengthy names
// like 'Box001001'
std::string::size_type index = CleanName.find_last_not_of("0123456789");
if (index+1 < CleanName.size()) {
CleanName = CleanName.substr(0,index+1);
}

// name in use?
std::map<std::string,DocumentObject*>::const_iterator pos;
Expand Down

0 comments on commit 5b66541

Please sign in to comment.