Commit a79863f
committed
fix: Recover PS1 before command execution.
Before this change, when doing completion in the same process PS1 was
modified to be able to detect the end of the completion command output
and it was recovered later on from PROMPT_COMMAND, just *after*
executing the user command, before building the next prompt.
The effect was not visible, unless the user command included $PS1, so if
you did:
> echo $PS1
and ran completion while editing that command, the PS1 that would be
output would be the one from bash-completion.
This change switches to another approach for recovering the prompt that
allows recovering it before executing the user command: a DEBUG trap is
registered which restores PS1 and PROMPT_COMMAND if the previous command
included __ebrcet. This change also adds __ebcret after the last command
issued by completion.
This way, the last command issued by completion uses the fake prompt,
but the command run just after that sees the real prompt in its
variable.
issue #771 parent a4c8fbc commit a79863f
File tree
2 files changed
+42
-18
lines changed- test
2 files changed
+42
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
| 1536 | + | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
| |||
1548 | 1548 | | |
1549 | 1549 | | |
1550 | 1550 | | |
1551 | | - | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
1552 | 1562 | | |
1553 | 1563 | | |
1554 | 1564 | | |
1555 | 1565 | | |
1556 | 1566 | | |
1557 | | - | |
1558 | | - | |
1559 | | - | |
1560 | | - | |
1561 | | - | |
1562 | | - | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
1568 | | - | |
1569 | | - | |
1570 | | - | |
| 1567 | + | |
| 1568 | + | |
1571 | 1569 | | |
1572 | | - | |
| 1570 | + | |
1573 | 1571 | | |
1574 | 1572 | | |
1575 | 1573 | | |
| |||
1591 | 1589 | | |
1592 | 1590 | | |
1593 | 1591 | | |
1594 | | - | |
| 1592 | + | |
1595 | 1593 | | |
1596 | 1594 | | |
1597 | 1595 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
903 | 929 | | |
0 commit comments