refactor: Remove 'm' key mouse toggle functionality
This commit is contained in:
parent
ddb1119bb5
commit
76e0e8789c
13
gtm
13
gtm
|
|
@ -177,9 +177,6 @@ def load_commit_content(state: AppState) -> AppState:
|
||||||
def update_dimensions(state: AppState, height: int, width: int) -> AppState:
|
def update_dimensions(state: AppState, height: int, width: int) -> AppState:
|
||||||
return replace(state, height=height, width=width)
|
return replace(state, height=height, width=width)
|
||||||
|
|
||||||
def toggle_mouse(state: AppState) -> AppState:
|
|
||||||
return replace(state, enable_mouse=not state.enable_mouse)
|
|
||||||
|
|
||||||
def toggle_sidebar(state: AppState) -> AppState:
|
def toggle_sidebar(state: AppState) -> AppState:
|
||||||
new_show_sidebar = not state.show_sidebar
|
new_show_sidebar = not state.show_sidebar
|
||||||
new_focus = state.focus
|
new_focus = state.focus
|
||||||
|
|
@ -591,8 +588,6 @@ def handle_keyboard_input(key, state: AppState) -> AppState:
|
||||||
return replace(state, is_selecting=False, selection_start_coord=None, selection_end_coord=None)
|
return replace(state, is_selecting=False, selection_start_coord=None, selection_end_coord=None)
|
||||||
else:
|
else:
|
||||||
return replace(state, should_exit=True)
|
return replace(state, should_exit=True)
|
||||||
elif key == ord('m'):
|
|
||||||
return toggle_mouse(state)
|
|
||||||
elif key == ord('s'):
|
elif key == ord('s'):
|
||||||
return toggle_sidebar(state)
|
return toggle_sidebar(state)
|
||||||
elif key in [curses.KEY_LEFT, ord('h')]:
|
elif key in [curses.KEY_LEFT, ord('h')]:
|
||||||
|
|
@ -667,8 +662,6 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse):
|
||||||
try:
|
try:
|
||||||
key = stdscr.getch()
|
key = stdscr.getch()
|
||||||
|
|
||||||
old_mouse_enabled = state.enable_mouse
|
|
||||||
|
|
||||||
# Process input and update the application state
|
# Process input and update the application state
|
||||||
if key == -1: # No input available (timeout)
|
if key == -1: # No input available (timeout)
|
||||||
pass # Just redraw the UI and continue
|
pass # Just redraw the UI and continue
|
||||||
|
|
@ -680,12 +673,6 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse):
|
||||||
else:
|
else:
|
||||||
state = handle_keyboard_input(key, state)
|
state = handle_keyboard_input(key, state)
|
||||||
|
|
||||||
if old_mouse_enabled != state.enable_mouse:
|
|
||||||
if state.enable_mouse:
|
|
||||||
curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
|
|
||||||
else:
|
|
||||||
curses.mousemask(0)
|
|
||||||
|
|
||||||
# After every action, redraw the UI to reflect changes immediately.
|
# After every action, redraw the UI to reflect changes immediately.
|
||||||
# This is crucial for real-time feedback during mouse drags.
|
# This is crucial for real-time feedback during mouse drags.
|
||||||
draw_ui(stdscr, state)
|
draw_ui(stdscr, state)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue