Skip to content

Commit

Permalink
Merge pull request #209 from enaboapps/iss207
Browse files Browse the repository at this point in the history
Fix to escape row
  • Loading branch information
enaboapps committed Mar 9, 2024
2 parents 07038bf + d0e87af commit 4ab3729
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,36 @@ class ScanTree(
}

/**
* This function checks if escaping the current row is necessary
* @return True if escaping the current row is necessary, false otherwise
* This function checks if the current row should be escaped
* @return Whether the current row should be escaped
*/
private fun shouldEscapeCurrentRow(): Boolean {
// If at the last node, activate the escape row
if (currentColumn == tree[currentRow].nodes.size - 1 && !shouldEscapeRow && scanDirection == ScanDirection.RIGHT) {
shouldEscapeRow = true
highlightCurrentRow()

return true
} else if (currentColumn == 0 && !shouldEscapeRow && scanDirection == ScanDirection.LEFT) {
shouldEscapeRow = true
highlightCurrentRow()

return true
} else if (shouldEscapeRow) {
shouldEscapeRow = false
unhighlightCurrentRow()

// Ensure that the index is correct
currentColumn = if (scanDirection == ScanDirection.RIGHT) {
0
} else {
tree[currentRow].nodes.size - 1
}
highlightCurrentNode()

return true
}
return shouldEscapeRow
return false
}

/**
Expand Down

0 comments on commit 4ab3729

Please sign in to comment.