X Tutup
Skip to content

Commit cb9bdca

Browse files
committed
Improve spacestotabs.py to handle some common cases
1 parent 407e97c commit cb9bdca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

development/spacestotabs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ def max_compatible(distribution, threshold=.8, possible=[8,4,3,2]):
5555
compat += count
5656
else:
5757
incompat += count
58+
# unambiguous case
59+
if compat > 0 and incompat == 0:
60+
return poss
5861
# require sufficient lines with spaces
5962
if threshold < 1 and (compat+incompat)*(1-threshold) < 2:
60-
return None
63+
continue
6164
if compat >= (compat+incompat)*threshold:
6265
return poss
6366

0 commit comments

Comments
 (0)
X Tutup