()
| 117 | } |
| 118 | |
| 119 | func (w *BufWindow) updateDisplayInfo() { |
| 120 | b := w.Buf |
| 121 | |
| 122 | w.drawDivider = false |
| 123 | if !b.Settings["statusline"].(bool) { |
| 124 | _, h := screen.Screen.Size() |
| 125 | infoY := h |
| 126 | if config.GetGlobalOption("infobar").(bool) { |
| 127 | infoY-- |
| 128 | } |
| 129 | if w.Y+w.Height != infoY { |
| 130 | w.drawDivider = true |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | w.bufHeight = w.Height |
| 135 | if b.Settings["statusline"].(bool) || w.drawDivider { |
| 136 | w.bufHeight-- |
| 137 | } |
| 138 | |
| 139 | scrollbarWidth := 0 |
| 140 | if w.Buf.Settings["scrollbar"].(bool) && w.Buf.LinesNum() > w.Height && w.Width > 0 { |
| 141 | scrollbarWidth = 1 |
| 142 | } |
| 143 | |
| 144 | w.hasMessage = len(b.Messages) > 0 |
| 145 | |
| 146 | // We need to know the string length of the largest line number |
| 147 | // so we can pad appropriately when displaying line numbers |
| 148 | w.maxLineNumLength = len(strconv.Itoa(b.LinesNum())) |
| 149 | |
| 150 | w.gutterOffset = 0 |
| 151 | if w.hasMessage { |
| 152 | w.gutterOffset += 2 |
| 153 | } |
| 154 | if b.Settings["diffgutter"].(bool) { |
| 155 | w.gutterOffset++ |
| 156 | } |
| 157 | if b.Settings["ruler"].(bool) { |
| 158 | w.gutterOffset += w.maxLineNumLength + 1 |
| 159 | } |
| 160 | |
| 161 | if w.gutterOffset > w.Width-scrollbarWidth { |
| 162 | w.gutterOffset = w.Width - scrollbarWidth |
| 163 | } |
| 164 | |
| 165 | prevBufWidth := w.bufWidth |
| 166 | w.bufWidth = w.Width - w.gutterOffset - scrollbarWidth |
| 167 | |
| 168 | if w.bufWidth != prevBufWidth && w.Buf.Settings["softwrap"].(bool) { |
| 169 | for _, c := range w.Buf.GetCursors() { |
| 170 | c.LastWrappedVisualX = c.GetVisualX(true) |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | func (w *BufWindow) getStartInfo(n, lineN int) ([]byte, int, int, *tcell.Style) { |
| 176 | tabsize := util.IntOpt(w.Buf.Settings["tabsize"]) |
no test coverage detected