diff --git a/application.py b/application.py index 75a048c..4f7c1cd 100755 --- a/application.py +++ b/application.py @@ -517,7 +517,7 @@ class Application(object): count = 0 (x, y) = w.first.xy() while count < slot.height: - if p.y == y and p.x >= x and p.x < x + slot.width: + if p.y == y and p.x >= x and p.x <= x + slot.width: self.highlight_char(slot.offset + count, p.x - x) break if x + slot.width > len(w.buffer.lines[y]): @@ -539,14 +539,17 @@ class Application(object): while count < slot.height: if y >= len(lines): self.win.addstr(slot.offset + count, 0, '~', redattr) - else: - line = lines[y][x:x + slot.width] - self.win.addstr(slot.offset + count, 0, line) - + count += 1 + continue + + line = lines[y] + s = line[x:x + slot.width] + self.win.addstr(slot.offset + count, 0, s) if x + slot.width >= len(line): x = 0 y += 1 else: + self.win.addch(slot.offset + count, slot.width, '\\', redattr) x += slot.width count += 1 @@ -586,7 +589,7 @@ class Application(object): c = self._get_token_color(w, token) s = token.string[s_offset:] token_done = x_offset + len(s) <= slot.width - token_wrap = x_offset + len(s) >= slot.width + token_wrap = x_offset + len(s) > slot.width self.win.addstr(slot.offset + count, x_offset, s[:slot.width], c) if token_wrap: