Change how path completion suggests nodes

Path completions now include module names only if the top-level module
is different. Module names in the middle of paths are redundant and it
makes auto-completed paths shorter. Ideally, the program should be able
to complete nodes without module prefixes and, optionally, if the user
started typing a module name, be able to complete nodes with module
prefixes. However, I don't think it is such an important feature,
because, as was said, module names are redundant (if equal to top-level
module), so the completion doesn't suggest it.

Change-Id: Iedabd017d0415a919a45be4aca30a5b353193f28
diff --git a/src/yang_schema.cpp b/src/yang_schema.cpp
index 8b870fc..28ef7d6 100644
--- a/src/yang_schema.cpp
+++ b/src/yang_schema.cpp
@@ -245,7 +245,13 @@
                 res.insert(it->path(LYS_PATH_FIRST_PREFIX));
             }
         } else {
-            res.insert(std::string(node->module()->name()) + ":" + node->name());
+            std::string toInsert;
+            if (path.m_nodes.empty() || path.m_nodes.front().m_prefix.get().m_name != node->module()->name()) {
+                toInsert += node->module()->name();
+                toInsert += ":";
+            }
+            toInsert += node->name();
+            res.insert(toInsert);
         }
     }