mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-03 14:58:51 -06:00
fix: count a wrapped path as part of its path
This commit is contained in:
1 parent
58b4842c3f
commit
15af2ebb5a
1 file changed
+13
-3
@@ -92,9 +92,19 @@ LINE_TEXT = {
|
||||
|
||||
|
||||
def words(text: str) -> int:
|
||||
"""Words a reader reads, a path left out."""
|
||||
return sum(1 for token in text.split() if re.search(r"[A-Za-z0-9]", token)
|
||||
and "/" not in token)
|
||||
"""Words a reader reads, a path left out, the part a long path wraps onto
|
||||
the next line included: the scratch folder's length is the machine's, and
|
||||
a worktree's longer one cut the path after its last slash."""
|
||||
count = 0
|
||||
previous = ""
|
||||
for line in text.splitlines():
|
||||
tokens = line.split()
|
||||
if tokens and "/" in previous and re.fullmatch(r"[\w.\-]+", tokens[0]):
|
||||
tokens = tokens[1:]
|
||||
count += sum(1 for token in tokens if re.search(r"[A-Za-z0-9]", token)
|
||||
and "/" not in token)
|
||||
previous = line.split()[-1] if line.split() else ""
|
||||
return count
|
||||
|
||||
|
||||
def lines(text: str) -> int:
|
||||
|
||||
Reference in new issue
Block a user