@himamshus06/git-auto 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tree.js +7 -3
package/package.json
CHANGED
package/src/tree.js
CHANGED
|
@@ -27,9 +27,13 @@ async function parseAndCreateTree(text) {
|
|
|
27
27
|
|
|
28
28
|
if (!name) continue;
|
|
29
29
|
|
|
30
|
-
// Depth is determined by the number of
|
|
31
|
-
//
|
|
32
|
-
|
|
30
|
+
// Depth is determined by the number of 4-character blocks in the prefix.
|
|
31
|
+
// For most visual trees, each level of nesting is 4 characters (e.g., "│ " or "├── ").
|
|
32
|
+
// We strip the final tree symbol (├ or └) from the length if it's there.
|
|
33
|
+
const effectivePrefixLength = prefix.endsWith('├') || prefix.endsWith('└')
|
|
34
|
+
? prefix.length - 1
|
|
35
|
+
: prefix.length;
|
|
36
|
+
const depth = Math.floor(effectivePrefixLength / 4);
|
|
33
37
|
|
|
34
38
|
// 2. Adjust stack to current depth
|
|
35
39
|
while (stack.length > depth) {
|