@@ -317,7 +317,7 @@ contains |
| 317 | 317 | read(*, '(a)', iostat=ios) commit_msg |
| 318 | 318 | |
| 319 | 319 | ! Restore raw mode |
| 320 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 320 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null", wait=.true.) |
| 321 | 321 | |
| 322 | 322 | if (ios == 0 .and. len_trim(commit_msg) > 0) then |
| 323 | 323 | ! Execute git commit (use single quotes for message to avoid escaping issues) |
@@ -367,7 +367,7 @@ contains |
| 367 | 367 | write(output_unit, '(a)') RED // "No upstream selected." // RESET |
| 368 | 368 | call execute_command_line("sleep 1") |
| 369 | 369 | ! Re-enable raw mode |
| 370 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 370 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null", wait=.true.) |
| 371 | 371 | call execute_command_line("rm -f " // trim(temp_file) // " 2>/dev/null") |
| 372 | 372 | return |
| 373 | 373 | end if |
@@ -395,7 +395,7 @@ contains |
| 395 | 395 | |
| 396 | 396 | call execute_command_line("rm -f " // trim(temp_file) // " 2>/dev/null") |
| 397 | 397 | ! Re-enable raw mode |
| 398 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 398 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null", wait=.true.) |
| 399 | 399 | end subroutine prompt_upstream_selection |
| 400 | 400 | |
| 401 | 401 | subroutine git_push_prompt(dir, repo_name) |
@@ -472,7 +472,7 @@ contains |
| 472 | 472 | read(*, '(a)', iostat=ios) tag_message |
| 473 | 473 | |
| 474 | 474 | ! Restore raw mode |
| 475 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 475 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null", wait=.true.) |
| 476 | 476 | |
| 477 | 477 | if (ios == 0) then |
| 478 | 478 | ! Execute git tag |
@@ -501,7 +501,7 @@ contains |
| 501 | 501 | end if |
| 502 | 502 | else |
| 503 | 503 | ! Restore raw mode if tag name was empty |
| 504 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 504 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null", wait=.true.) |
| 505 | 505 | end if |
| 506 | 506 | end subroutine git_tag_prompt |
| 507 | 507 | |
@@ -510,6 +510,7 @@ contains |
| 510 | 510 | logical, intent(in) :: is_staged, is_unstaged |
| 511 | 511 | character(len=MAX_PATH*2) :: git_cmd |
| 512 | 512 | character(len=1) :: key |
| 513 | + integer :: ios |
| 513 | 514 | |
| 514 | 515 | ! Clear screen |
| 515 | 516 | write(output_unit, '(a)', advance='no') CLEAR |
@@ -538,9 +539,11 @@ contains |
| 538 | 539 | write(output_unit, *) |
| 539 | 540 | write(output_unit, '(a)') GREY // "Press any key to return..." // RESET |
| 540 | 541 | |
| 541 | | - ! Restore raw mode before reading |
| 542 | | - call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null") |
| 543 | | - read(*, '(a1)', advance='no') key |
| 542 | + ! Restore raw mode and give terminal time to settle |
| 543 | + call execute_command_line("stty -icanon -echo min 1 time 0 2>/dev/null && sleep 0.05", wait=.true.) |
| 544 | + |
| 545 | + ! Read keypress with error handling for any buffering issues |
| 546 | + read(*, '(a1)', advance='no', iostat=ios) key |
| 544 | 547 | end subroutine show_git_diff_fullscreen |
| 545 | 548 | |
| 546 | 549 | subroutine git_fetch_prompt(dir, repo_name) |