(&mut self, window: &mut Window, cx: &mut Context<Self>)
| 222 | } |
| 223 | |
| 224 | if line_end == line_start { |
| 225 | rows.push(VirtualTextRow { |
| 226 | line_number, |
| 227 | continuation: false, |
| 228 | byte_range: line_start..line_start, |
| 229 | }); |
| 230 | } else { |
| 231 | let mut chunk_start = line_start; |
| 232 | let mut continuation = false; |
| 233 | while chunk_start < line_end { |
| 234 | let mut chunk_end = (chunk_start + VIRTUAL_TEXT_ROW_MAX_BYTES).min(line_end); |
| 235 | while chunk_end > chunk_start && !content.is_char_boundary(chunk_end) { |
| 236 | chunk_end -= 1; |
| 237 | } |
| 238 | if chunk_end == chunk_start { |
| 239 | chunk_end = line_end; |
| 240 | } |
| 241 | rows.push(VirtualTextRow { |
| 242 | line_number, |
| 243 | continuation, |
| 244 | byte_range: chunk_start..chunk_end, |
| 245 | }); |
| 246 | continuation = true; |
| 247 | chunk_start = chunk_end; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | line_number += 1; |
| 252 | line_start = line_end_with_newline; |
| 253 | } |
| 254 | |
| 255 | if content.ends_with('\n') { |
| 256 | rows.push(VirtualTextRow { |
| 257 | line_number, |
| 258 | continuation: false, |
| 259 | byte_range: content.len()..content.len(), |
no test coverage detected