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