I am having a bit of trouble getting Bash's autocomplete function to work properly in my OS's port.
I've implemented a non-canonical reading mode in my crappy terminal driver. I had hoped that autocomplete would magically start working. Unfortunately, only to some extent. It completes the command but doesn't show on screen. Triple tab displays directory contents OK.
eg. 'cd /de[tab][enter]' would complete to 'cd /dev' (but not printed at the prompt)
Anything obvious I should be doing? I don't have a termcap file as I don't do any ansi vt emulation stuff. Do I need one?
I'm not familiar with all this termios/termcap voodoo yet.
Cheers.
Bash autocomplete
Bash autocomplete
All your base are belong to us.
Re: Bash autocomplete
The problem is most likely caused by an incorrect value in the 'st_mode' field in the stat structure returned by stat/fstat.
Re: Bash autocomplete
My st_mode values seem sane.
Are you thinking along the lines of isatty() ? If not, could you explain your reasoning?
Cheers
EDIT: I should also point out, upon pressing tab it does syscall sys_stat(/dev) in the above example.
Are you thinking along the lines of isatty() ? If not, could you explain your reasoning?
Cheers
EDIT: I should also point out, upon pressing tab it does syscall sys_stat(/dev) in the above example.
All your base are belong to us.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: Bash autocomplete
Do you know if it's trying to write characters to the terminal? If not, do you know why?
Re: Bash autocomplete
Try "ls /de[TAB]". I know you probably don't have ls installed - it doesn't matter. When using the cd builtin, bash checks the st_mode field of the stat structure to check that path is a directory. It doesn't do this for non-builtin applications.
Re: Bash autocomplete
I have to correct myself here. The st_mode field does not appear to have any effect on auto-completion. Sorry for spreading confusion!dosfan wrote:My st_mode values seem sane.
Are you thinking along the lines of isatty() ? If not, could you explain your reasoning?
Cheers
EDIT: I should also point out, upon pressing tab it does syscall sys_stat(/dev) in the above example.
Most of my input/output problems were termios related. You can get by this by providing a simple tcgetattr/tcsetattr implementation. Setup a global 'struct termios' with some default values and flags set (canonical mode etc). Make tcgetattr return this struct, and make tcsetattr overwrite this struct. Hope this solves your problem.