mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 10:00:43 +08:00
Revert "Avoid excessive polling of universal variable file"
This reverts commitb56b230076
. which somehow made us miss repaints on uvar notifications. The commit was a workaround for a polling bug which was later properly fixed by7c5b8b855
("Use the uvar notifier pipe timestamp to avoid excessive polling"), so it's no longer necessary. Add a system test. If I had a better understanding of the bug I could probably write a better test. Fixes #8088
This commit is contained in:
parent
c18f293ae2
commit
62d8f7277b
|
@ -57,7 +57,7 @@ enum {
|
|||
};
|
||||
using readb_result_t = int;
|
||||
|
||||
static readb_result_t readb(int in_fd, bool queue_is_empty) {
|
||||
static readb_result_t readb(int in_fd) {
|
||||
assert(in_fd >= 0 && "Invalid in fd");
|
||||
universal_notifier_t& notifier = universal_notifier_t::default_notifier();
|
||||
select_wrapper_t fdset;
|
||||
|
@ -98,7 +98,7 @@ static readb_result_t readb(int in_fd, bool queue_is_empty) {
|
|||
// This may come about through readability, or through a call to poll().
|
||||
if ((fdset.test(notifier_fd) && notifier.notification_fd_became_readable(notifier_fd)) ||
|
||||
notifier.poll()) {
|
||||
if (env_universal_barrier() && !queue_is_empty) {
|
||||
if (env_universal_barrier()) {
|
||||
return readb_uvar_notified;
|
||||
}
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ char_event_t input_event_queue_t::readch() {
|
|||
return mevt.acquire();
|
||||
}
|
||||
|
||||
readb_result_t rr = readb(in_, queue_.empty());
|
||||
readb_result_t rr = readb(in_);
|
||||
switch (rr) {
|
||||
case readb_eof:
|
||||
return char_event_type_t::eof;
|
||||
|
@ -180,6 +180,7 @@ char_event_t input_event_queue_t::readch() {
|
|||
break;
|
||||
|
||||
case readb_uvar_notified:
|
||||
env_universal_barrier();
|
||||
break;
|
||||
|
||||
case readb_ioport_notified:
|
||||
|
|
39
tests/checks/tmux-prompt.fish
Normal file
39
tests/checks/tmux-prompt.fish
Normal file
|
@ -0,0 +1,39 @@
|
|||
#RUN: %fish -C 'set -g fish %fish' %s
|
||||
#REQUIRES: command -v tmux
|
||||
|
||||
# Isolated tmux.
|
||||
set -g tmpdir (mktemp -d)
|
||||
set -g tmux tmux -S $tmpdir/.tmux-socket -f /dev/null
|
||||
|
||||
set -g sleep sleep .1
|
||||
set -q CI && set sleep sleep 1
|
||||
|
||||
set fish (builtin realpath $fish)
|
||||
cd $tmpdir
|
||||
|
||||
while set -e prompt_var
|
||||
end
|
||||
|
||||
$tmux new-session -x 80 -y 10 -d $fish -C '
|
||||
# This is similar to "tests/interactive.config".
|
||||
function fish_greeting; end
|
||||
function fish_prompt; printf "prompt $status_generation> <$prompt_var> "; end
|
||||
# No autosuggestion from older history.
|
||||
set fish_history ""
|
||||
function on_prompt_var --on-variable prompt_var
|
||||
commandline -f repaint
|
||||
end
|
||||
'
|
||||
|
||||
$sleep # Let fish draw a prompt.
|
||||
|
||||
$tmux capture-pane -p
|
||||
# CHECK: prompt 0> <>
|
||||
|
||||
set -U prompt_var changed
|
||||
$sleep
|
||||
$tmux capture-pane -p
|
||||
# CHECK: prompt 0> <changed>
|
||||
|
||||
$tmux kill-server
|
||||
rm -r $tmpdir
|
Loading…
Reference in New Issue
Block a user