tabsToSpacesLine replaces tabs with spaces in the given line.
(ln int)
| 1749 | |
| 1750 | // tabsToSpacesLine replaces tabs with spaces in the given line. |
| 1751 | func (ls *Lines) tabsToSpacesLine(ln int) { |
| 1752 | tabSz := ls.Options.TabSize |
| 1753 | |
| 1754 | lr := ls.lines[ln] |
| 1755 | st := lexer.Pos{Ln: ln} |
| 1756 | ed := lexer.Pos{Ln: ln} |
| 1757 | i := 0 |
| 1758 | for { |
| 1759 | if i >= len(lr) { |
| 1760 | break |
| 1761 | } |
| 1762 | r := lr[i] |
| 1763 | if r == '\t' { |
| 1764 | po := i % tabSz |
| 1765 | nspc := tabSz - po |
| 1766 | st.Ch = i |
| 1767 | ed.Ch = i + 1 |
| 1768 | ls.replaceText(st, ed, st, indent.Spaces(1, nspc), ReplaceNoMatchCase) |
| 1769 | i += nspc |
| 1770 | lr = ls.lines[ln] |
| 1771 | } else { |
| 1772 | i++ |
| 1773 | } |
| 1774 | } |
| 1775 | } |
| 1776 | |
| 1777 | // tabsToSpaces replaces tabs with spaces over given region; end is *exclusive*. |
| 1778 | func (ls *Lines) tabsToSpaces(start, end int) { |
no test coverage detected