@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tree.js +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@himamshus06/git-auto",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "bin": {
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 "blocks" of indentation.
31
- // Most trees use 4 chars per level (e.g., "│ " or "├── ").
32
- const depth = Math.floor(prefix.length / 4);
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) {