diff --git a/kittens/hints/main.py b/kittens/hints/main.py index 8c4d3ec5a..f4c1ec037 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -213,7 +213,7 @@ def url(text, s, e): @postprocessor def brackets(text, s, e): # Remove matching brackets - if e > s and e <= len(text): + if s < e <= len(text): before = text[s] if before in '({[<' and text[e-1] == closing_bracket_map[before]: s += 1 @@ -224,7 +224,7 @@ def brackets(text, s, e): @postprocessor def quotes(text, s, e): # Remove matching quotes - if e > s and e <= len(text): + if s < e <= len(text): before = text[s] if before in '\'"' and text[e-1] == before: s += 1 diff --git a/kitty/fonts/render.py b/kitty/fonts/render.py index b3333d102..245fa669e 100644 --- a/kitty/fonts/render.py +++ b/kitty/fonts/render.py @@ -88,7 +88,7 @@ def set_font_family(opts=None, override_font_size=None, debug_font_matching=Fals def add_line(buf, cell_width, position, thickness, cell_height): y = position - thickness // 2 - while thickness > 0 and y > -1 and y < cell_height: + while thickness > 0 and -1 < y < cell_height: thickness -= 1 ctypes.memset(ctypes.addressof(buf) + (cell_width * y), 255, cell_width) y += 1 diff --git a/kitty/layout.py b/kitty/layout.py index 5ce756288..5be8933f9 100644 --- a/kitty/layout.py +++ b/kitty/layout.py @@ -54,7 +54,7 @@ def layout_dimension(start_at, length, cell_length, decoration_pairs, left_align inner_length = cells_in_window * cell_length return inner_length + decoration_pairs[i][1] - if bias is not None and number_of_windows > 1 and len(bias) == number_of_windows and cells_per_window > 5: + if bias is not None and 1 < number_of_windows == len(bias) and cells_per_window > 5: cells_map = [int(b * number_of_cells) for b in bias] while min(cells_map) < 5: maxi, mini = map(cells_map.index, (max(cells_map), min(cells_map))) diff --git a/kitty/tabs.py b/kitty/tabs.py index 5ffb93d1c..d252de010 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -480,7 +480,7 @@ class TabManager: # {{{ self.set_active_tab_idx((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs)) def goto_tab(self, tab_num): - if tab_num < len(self.tabs) and 0 <= tab_num: + if 0 <= tab_num < len(self.tabs): self.set_active_tab_idx(tab_num) elif tab_num < 0: try: