mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-08-27 20:36:29 -04:00
Reduce unneeded iterations in indentSubtractor
This commit is contained in:
+3
-3
@@ -20,11 +20,11 @@ const (
|
||||
)
|
||||
|
||||
// calculates and returns the final visual indentation multiplier (needed to adjust indentation for skipped parent directories)
|
||||
func indentSubtractor(indent int, skippedDirList []bool, currentIndex int) int {
|
||||
func indentSubtractor(indent int, skippedDirList []bool, currentDirIndex int) int {
|
||||
var subtractor int // tracks how much to subtract from expected indentation multiplier
|
||||
|
||||
for i, skipped := range skippedDirList { // checks each skipped directory to determine if it is a parent to the current directory
|
||||
if skipped && strings.HasPrefix(dirList[currentIndex], dirList[i]+PathSeparator) {
|
||||
for i := len(skippedDirList[:currentDirIndex]) - 1; i >= 0; i-- { // checks each skipped directory to determine if it is a parent to the current directory
|
||||
if skippedDirList[i] && strings.HasPrefix(dirList[currentDirIndex], dirList[i]+PathSeparator) {
|
||||
subtractor++ // if the skipped directory is a parent, increment the subtractor
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user