@@ -161,7 +161,8 @@ def setup_logging():
161161 logging .basicConfig (
162162 filename = log_file ,
163163 level = logging .DEBUG ,
164- format = f'%(asctime)s - %(levelname)s - { "CURSE" if USE_CURSES else "ANSI" } - %(message)s'
164+ format = f'%(asctime)s - %(levelname)s - {
165+ "CURSE" if USE_CURSES else "ANSI" } - %(message)s'
165166 )
166167
167168
@@ -305,13 +306,6 @@ def get_terminal_size():
305306 return width , height - 1 # Subtract 1 from height
306307
307308
308- def to_terminal_coords (y : int , x : int ) -> tuple [int , int ]:
309- """
310- Convert 0-based coordinate system to terminal's 1-based coordinate system
311- """
312- return y + 1 , x + 1
313-
314-
315309def getch ():
316310 """Get a single character from terminal"""
317311 fd = sys .stdin .fileno ()
@@ -417,22 +411,18 @@ def draw_all_panes(panes, max_x, padding_cache, terminal_height, screen):
417411 if padding_size not in padding_cache :
418412 padding_cache [padding_size ] = ' ' * padding_size
419413 line = line + padding_cache [padding_size ]
420- term_y , term_x = to_terminal_coords (pane .start_y + y , pane .start_x )
421- screen .addstr (term_y - 1 , term_x - 1 , line [:pane .width ])
414+ screen .addstr (pane .start_y + y , pane .start_x , line [:pane .width ])
422415
423416 # Draw vertical borders
424417 if pane .start_x + pane .width < max_x :
425418 for y in range (pane .start_y , pane .start_y + visible_height ):
426- term_y , term_x = to_terminal_coords (
427- y , pane .start_x + pane .width )
428- screen .addstr (term_y - 1 , term_x - 1 ,
419+ screen .addstr (y , pane .start_x + pane .width ,
429420 VERTICAL_BORDER , screen .A_DIM )
430421
431422 # Draw horizontal borders
432423 end_y = pane .start_y + visible_height
433424 if end_y < terminal_height and pane != sorted_panes [- 1 ]:
434- term_y , term_x = to_terminal_coords (end_y , pane .start_x )
435- screen .addstr (term_y - 1 , term_x - 1 , HORIZONTAL_BORDER *
425+ screen .addstr (end_y , pane .start_x , HORIZONTAL_BORDER *
436426 pane .width , screen .A_DIM )
437427
438428 screen .refresh ()
@@ -467,12 +457,10 @@ def draw_all_hints(panes, terminal_height, screen):
467457 y = pane .start_y + line_num
468458 x = pane .start_x + col
469459 if (y < min (pane .start_y + pane .height , terminal_height ) and x + get_char_width (char ) <= pane .start_x + pane .width ):
470- term_y , term_x = to_terminal_coords (y , x )
471- screen .addstr (term_y - 1 , term_x - 1 , hint [0 ], screen .A_HINT1 )
460+ screen .addstr (y , x , hint [0 ], screen .A_HINT1 )
472461 char_width = get_char_width (char )
473462 if x + char_width < pane .start_x + pane .width :
474- term_y , term_x = to_terminal_coords (y , x + char_width )
475- screen .addstr (term_y - 1 , term_x - 1 , hint [1 ], screen .A_HINT2 )
463+ screen .addstr (y , x + char_width , hint [1 ], screen .A_HINT2 )
476464 sys .stdout .flush ()
477465
478466
@@ -507,10 +495,9 @@ def main(screen: Screen):
507495 char_width = get_char_width (char )
508496 if (y < min (pane .start_y + pane .height , terminal_height ) and
509497 x + char_width <= pane .start_x + pane .width ):
510- term_y , term_x = to_terminal_coords (y , x )
511- screen .addstr (term_y - 1 , term_x - 1 , hint [1 ], screen .A_HINT2 )
498+ screen .addstr (y , x , hint [1 ], screen .A_HINT2 )
512499 if x + char_width + 1 < pane .start_x + pane .width :
513- screen .addstr (term_y - 1 , term_x - 1 + char_width , char )
500+ screen .addstr (y , x , char )
514501
515502 screen .refresh ()
516503
0 commit comments