mirror of
https://github.com/atom/atom.git
synced 2026-02-06 12:44:59 -05:00
Associate TokenizedLines with an ::indentLevel
This can be used to render the appropriate number of indent guide spans for empty lines.
This commit is contained in:
committed by
Nathan Sobo
parent
d0a917ed14
commit
6997adece9
@@ -405,13 +405,7 @@ class Editor extends Model
|
||||
#
|
||||
# Returns a {Number}.
|
||||
indentLevelForLine: (line) ->
|
||||
if match = line.match(/^[\t ]+/)
|
||||
leadingWhitespace = match[0]
|
||||
tabCount = leadingWhitespace.match(/\t/g)?.length ? 0
|
||||
spaceCount = leadingWhitespace.match(/[ ]/g)?.length ? 0
|
||||
tabCount + (spaceCount / @getTabLength())
|
||||
else
|
||||
0
|
||||
@displayBuffer.indentLevelForLine(line)
|
||||
|
||||
# Constructs the string used for tabs.
|
||||
buildIndentString: (number) ->
|
||||
|
||||
Reference in New Issue
Block a user