Open Yevgnen opened 2 years ago
So if I understand, you have two line prompt like this:
User@macOS: ~ (python-3.8.13)
$ yes >
and when you try and complete on /dev/
it is printing the results to the buffer instead collecting them into the candidate list?
@CeleritasCelery Hi, I do have a two line prompt(The second line ends with '$'). But the 'yes' part is a shell command.
when you try and complete on /dev/ it is printing the results to the buffer instead collecting them into the candidate list?
Yes. But the issue seems happen only when with output redirection like '> /dev...'.
So I think there are two separate issues here (correct me if I am wrong). The first is that the prompt is being reprinted and the second is the output is going to the buffer. For the first, look at this part of the docs and #5 :
prompt components in completion list
Also what shell are you using? Is this bash or zsh?
The first is that the prompt is being reprinted
Yes.
Also what shell are you using? Is this bash or zsh?
I'm using GNU bash, version 5.1.16(1)-release (x86_64-apple-darwin21.1.0)
.
I remove the fancy settings from .bashrc
, the prompts become bash-5.1$
. I also add the following settings but the issue still exists.
(setq native-complete-style-regex-alist '(("[-.a-z0-9]+\\$ " . bash)))
Updated:
The example in README also causes this issue for me. I don't see the shell prompt is showing up as completion candidate.
Okay, I am using the same shell and and OS as you. Have you run native-complete-check-config
?
Hi, it says Success: native-complete setup for ’bash’ completion
.
Thanks. So to make sure I understand, the issue you are seeing is that the completions for yes > /dev/
are being sent to the shell buffer instead of being collected in the candidate list? The last screenshot you posted seems to indicate they are being used for completion correctly.
Sorry, I should have be more clearer.
the issue you are seeing is that the completions for yes > /dev/ are being sent to the shell buffer instead of being collected in the candidate list?
My original issue is, although the mini buffer is pop up properly, the prompt or the candidates are inserted into the shell buffer. The first time I press TAB, the prompt is inserted, and the buffer becomes
User@macOS: ~ (python-3.8.13)
$ User@macOS: ~ (python-3.8.13)
$ yes > /! '!' = current cursor
The second time I press TAB, the candidates are inserted, and the buffer becomes
User@macOS: ~ (python-3.8.13)
$ User@macOS: ~ (python-3.8.13)
$ dev/ptyr4 /dev/ptyr5 /dev/ptyr6 /dev/ptyr7 /dev/ptyr8
/dev/ptyr9 /dev/ptyra /dev/ptyrb /dev/ptyrc /dev/ptyrd /dev/ptyre
/dev/ptyrf /dev/ptys0 /dev/ptys1 /dev/ptys2 /dev/ptys3 /dev/ptys4
/dev/ptys5 /dev/ptys6 /dev/ptys7 /dev/ptys8 /dev/ptys9 /dev/ptysa
/dev/ptysb /dev/ptysc /dev/ptysd /dev/ptyse /dev/ptysf /dev/ptyt0
/dev/ptyt1 /dev/ptyt2 /dev/ptyt3 /dev/ptyt4 /dev/ptyt5 /dev/ptyt6
/dev/ptyt7 /dev/ptyt8 /dev/ptyt9 /dev/ptyta /dev/ptytb /dev/ptytc
/dev/ptytd /dev/ptyte /dev/ptytf /dev/ptyu0 /dev/ptyu1 /dev/ptyu2
/dev/ptyu3 /dev/ptyu4 /dev/ptyu5 /dev/ptyu6 /dev/ptyu7 /dev/ptyu8
/dev/ptyu9 /dev/ptyua /dev/ptyub /dev/ptyuc /dev/ptyud /dev/ptyue
/dev/ptyuf /dev/ptyv0 /dev/ptyv1 /dev/ptyv2 /dev/ptyv3 /dev/ptyv4
/dev/ptyv5 /dev/ptyv6 /dev/ptyv7 /dev/ptyv8 /dev/ptyv9 /dev/ptyva
/dev/ptyvb /dev/ptyvc /dev/ptyvd /dev/ptyve /dev/ptyvf /dev/ptyw0
/dev/ptyw1 /dev/ptyw2 /dev/ptyw3 /dev/ptyw4 /dev/ptyw5 /dev/ptyw6
/dev/ptyw7 /dev/ptyw8 /dev/ptyw9 /dev/ptywa /dev/ptywb /dev/ptywc
/dev/ptywd /dev/ptywe /dev/ptywf /dev/random /dev/rdisk0
/dev/rdisk0s1 /dev/rdisk0s2 /dev/rdisk1 /dev/rdisk1s1
/dev/rdisk1s2 /dev/rdisk1s3 /dev/rdisk1s4 /dev/rdisk1s5
...
In both case, the mini buffer is pop up properly.
The last screenshot you posted seems to indicate they are being used for completion correctly.
When I test the example in RAEDME with a plain user>
prompt, as you see in the screenshot, the prompt is inserted into the buffer, although the mini buffer is pop up properly too.
Okay, let's solve the issue with the plain prompt first. Does this only happen with the very first prompt or does it happen every time? (for example if you start a new shell and press enter a few times then try completion does it still duplicate the prompt?)
Hi, a quick test showed that it could happen after many times of Enter.
Interesting. I am not able to reproduce that.
What is your comint-prompt-regexp
?
It's "[a-z]+> "
in this case, the same as
(setq native-complete-style-regex-alist '(("[a-z]+> " . bash)))
I also tried to remove .bashrc
, .profile
, and .bash_profile
and keep only export PS1="user > "
, but no miracle.
hmm, I am not sure what the issue could be.
Can you run this command in your shell?
(comint-redirect-send-command "ls" (get-buffer-create "test") nil)
That will tell us if it the redirection or something shell specific.
Hi, I run the command in a shell buffer in my home directory and here is its output
[?2004l
Applications PDF def
Books Pictures dotfiles
Desktop Public git
Documents Zotero org
Downloads abc output
Library backups pretrained_models
Movies bin tmp
Music datasets xyz
When one press TAB in (! means cursor) a shell buffer with the following input
the buffer content becomes
then choose
dev
in mini buffer, and enter/
then press TAB again with the following content in the bufferthe buffer content becomes
Test config: