(self)
| 265 | elif ord(in_buffer[0]) >= 32: |
| 266 | return KEY_NONE, in_buffer |
| 267 | def display_window(self): |
| 268 | self.cur_line = min(self.total_lines - 1, max(self.cur_line, 0)) |
| 269 | self.vcol = max(0, min(self.col, len(self.content[self.cur_line]))) |
| 270 | if self.vcol >= Editor.width + self.margin: |
| 271 | self.margin = self.vcol - Editor.width + (Editor.width >> 2) |
| 272 | elif self.vcol < self.margin: |
| 273 | self.margin = max(self.vcol - (Editor.width >> 2), 0) |
| 274 | if not (self.top_line <= self.cur_line < self.top_line + Editor.height): |
| 275 | self.top_line = max(self.cur_line - self.row, 0) |
| 276 | self.row = self.cur_line - self.top_line |
| 277 | self.cursor(False) |
| 278 | line = self.top_line |
| 279 | if self.mark is None: |
| 280 | flag = 0 |
| 281 | else: |
| 282 | start_line, start_col, end_line, end_col = self.mark_range() |
| 283 | start_col = max(start_col - self.margin, 0) |
| 284 | end_col = max(end_col - self.margin, 0) |
| 285 | for c in range(Editor.height): |
| 286 | if line == self.total_lines: |
| 287 | if Editor.scrbuf[c] != (False,''): |
| 288 | self.goto(c, 0) |
| 289 | self.clear_to_eol() |
| 290 | Editor.scrbuf[c] = (False,'') |
| 291 | else: |
| 292 | if self.mark is not None: |
| 293 | flag = ((start_line <= line < end_line) + |
| 294 | ((start_line == line) << 1) + |
| 295 | (((end_line - 1) == line) << 2)) |
| 296 | l = (flag, |
| 297 | self.content[line][self.margin:self.margin + Editor.width]) |
| 298 | if (flag and line == self.cur_line) or l != Editor.scrbuf[c]: |
| 299 | self.goto(c, 0) |
| 300 | if flag == 0: |
| 301 | self.wr(l[1]) |
| 302 | elif flag == 7: |
| 303 | self.wr(l[1][:start_col]) |
| 304 | self.hilite(2) |
| 305 | self.wr(l[1][start_col:end_col]) |
| 306 | self.hilite(0) |
| 307 | self.wr(l[1][end_col:]) |
| 308 | elif flag == 3: |
| 309 | self.wr(l[1][:start_col]) |
| 310 | self.hilite(2) |
| 311 | self.wr(l[1][start_col:]) |
| 312 | self.wr(' ') |
| 313 | self.hilite(0) |
| 314 | elif flag == 5: |
| 315 | self.hilite(2) |
| 316 | self.wr(l[1][:end_col]) |
| 317 | self.hilite(0) |
| 318 | self.wr(l[1][end_col:]) |
| 319 | else: |
| 320 | self.hilite(2) |
| 321 | self.wr(l[1]) |
| 322 | self.wr(' ') |
| 323 | self.hilite(0) |
| 324 | if len(l[1]) < Editor.width: |
no test coverage detected