Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes libedit based tab completion. #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sethwoodworth
Copy link

According to this article libedit based readline requires readline.parse_and_bind("bind ^I rl_complete") rather than readline.parse_and_bind("tab: complete"). This is backed up by the note in the python2.7 readline docs.
AFAICT: otherwise completion is implemented the same except that using the readline's set_completion_display_matches_hook is going to be ignored on OSX. OSH isn't using that hook, nor Cmd which seems to call it.

I can't test this until I get to my office tomorrow and try it on an OSX machine.

@andychu
Copy link
Contributor

andychu commented Feb 19, 2019

OK interesting! I think this is definitely part of the puzzle.

The other part to it is that I made some patches to readline.c that I suspect broke OS X. There's all this __APPLE__ stuff and libedit stuff in that file, but I didn't test that it still works.

https://github.com/oilshell/oil/blob/master/Python-2.7.13/Modules/readline.c

I need to fork this whole module anyway because of issue #231, which can't be done with Python apparently.

Another complication is that it's only possible to make a release tarball on Linux now. The tarball itself builds on OS X, but making the tarball is nontrivial because of the "OPy" stuff.

BUT I have this standalone demo that I'm going to integrate into OSH. It might be worthwhile to try this demoish script on OS X, as it will be easier to run than a new build of OSH.

https://github.com/oilshell/blog-code/blob/master/interactive-shell/demoish.py#L979


FWIW the tarball build is described at the end of this page:

https://github.com/oilshell/oil/wiki/Contributing

I'm not sure anyone besides me has done it though. There was also a pending PR to make the dev env work on OS X, but it was only partially done and didn't land.

Thanks for looking at this!

@andychu
Copy link
Contributor

andychu commented Feb 20, 2019

BTW I forked the Python readline wrapper to line_input.c. So a lot of the stuff I said above should be less complicated (sorry it was a lot of internal detail).

It would be useful if you patch demoish.py and then let me know if it works on OS X! It should be easy to get running since it's a single Python script with no dependencies.

I am going to integrate it into OSH. It's a better UI, with some screencasts here:

https://asciinema.org/~andyc

https://github.com/oilshell/blog-code/blob/master/interactive-shell/demoish.py#L979

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants