fix: Enable 'n' key navigation across change blocks regardless of focus
This commit is contained in:
parent
84073402e4
commit
d86be60b40
17
gtm
17
gtm
|
|
@ -174,6 +174,14 @@ def calculate_change_blocks(state: AppState) -> AppState:
|
|||
# Add the last block
|
||||
blocks.append((current_block_start, current_block_end))
|
||||
|
||||
# Add debug output to a log file
|
||||
with open("/tmp/gtm_debug.log", "a") as f:
|
||||
f.write(f"Found {len(blocks)} change blocks\n")
|
||||
for i, (start, end) in enumerate(blocks):
|
||||
f.write(f" Block {i+1}: lines {start}-{end}\n")
|
||||
f.write(f"Added lines: {state.added_lines}\n")
|
||||
f.write(f"Deleted lines: {state.deleted_lines}\n")
|
||||
|
||||
return replace(state, change_blocks=blocks, current_change_idx=-1)
|
||||
|
||||
def load_commit_content(state: AppState) -> AppState:
|
||||
|
|
@ -304,6 +312,9 @@ def jump_to_next_change(state: AppState) -> AppState:
|
|||
if next_idx != -1:
|
||||
# Get the start position of the change block
|
||||
new_scroll = max(0, state.change_blocks[next_idx][0] - 3) # Show 3 lines of context above
|
||||
# Add debug output to a log file
|
||||
with open("/tmp/gtm_debug.log", "a") as f:
|
||||
f.write(f"Jumping to change block {next_idx+1}/{len(state.change_blocks)}, line {state.change_blocks[next_idx][0]}\n")
|
||||
return replace(state, right_scroll_offset=new_scroll, current_change_idx=next_idx)
|
||||
return state
|
||||
|
||||
|
|
@ -740,10 +751,12 @@ def handle_keyboard_input(key, state: AppState) -> AppState:
|
|||
elif key == ord('w'):
|
||||
return replace(state, wrap_lines=not state.wrap_lines)
|
||||
elif key == ord('n'):
|
||||
if state.focus == "right" and (state.show_whole_diff or state.show_additions or state.show_deletions):
|
||||
# Remove the focus check to allow 'n' to work regardless of focus
|
||||
if state.show_whole_diff or state.show_additions or state.show_deletions:
|
||||
return jump_to_next_change(state)
|
||||
elif key == ord('p'):
|
||||
if state.focus == "right" and (state.show_whole_diff or state.show_additions or state.show_deletions):
|
||||
# Remove the focus check to allow 'p' to work regardless of focus
|
||||
if state.show_whole_diff or state.show_additions or state.show_deletions:
|
||||
return jump_to_prev_change(state)
|
||||
elif key in [curses.KEY_LEFT, ord('h')]:
|
||||
if state.show_sidebar:
|
||||
|
|
|
|||
Loading…
Reference in New Issue