(n, lineN int)
| 173 | } |
| 174 | |
| 175 | func (w *BufWindow) getStartInfo(n, lineN int) ([]byte, int, int, *tcell.Style) { |
| 176 | tabsize := util.IntOpt(w.Buf.Settings["tabsize"]) |
| 177 | width := 0 |
| 178 | bloc := buffer.Loc{0, lineN} |
| 179 | b := w.Buf.LineBytes(lineN) |
| 180 | curStyle := config.DefStyle |
| 181 | var s *tcell.Style |
| 182 | for len(b) > 0 { |
| 183 | r, _, size := util.DecodeCharacter(b) |
| 184 | |
| 185 | curStyle, found := w.getStyle(curStyle, bloc) |
| 186 | if found { |
| 187 | s = &curStyle |
| 188 | } |
| 189 | |
| 190 | w := 0 |
| 191 | switch r { |
| 192 | case '\t': |
| 193 | ts := tabsize - (width % tabsize) |
| 194 | w = ts |
| 195 | default: |
| 196 | w = runewidth.RuneWidth(r) |
| 197 | } |
| 198 | if width+w > n { |
| 199 | return b, n - width, bloc.X, s |
| 200 | } |
| 201 | width += w |
| 202 | b = b[size:] |
| 203 | bloc.X++ |
| 204 | } |
| 205 | return b, n - width, bloc.X, s |
| 206 | } |
| 207 | |
| 208 | // Clear resets all cells in this window to the default style |
| 209 | func (w *BufWindow) Clear() { |
no test coverage detected