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

problems completing filenames that contain hyphens #37

Closed
arekolek opened this issue Oct 13, 2015 · 2 comments
Closed

problems completing filenames that contain hyphens #37

arekolek opened this issue Oct 13, 2015 · 2 comments
Labels

Comments

@arekolek
Copy link

Tested with rlwrap 0.37 and gnuplot 4.6 patchlevel 4 on Ubuntu 14.04.3.

Seems like there needs to be at least two files with a common prefix and a hyphen in a directory for this to occur.

To reproduce the problem first set up some test files:

$ mkdir test
$ cd test
$ touch test-a.txt test-b.txt

Now try file completion with rlwrap:

$ rlwrap -a -c gnuplot
gnuplot> t[TAB]
gnuplot> test-[TAB]
gnuplot> test-test-[TAB]
gnuplot> test-test-test-[TAB]

Let's rewind and try:

gnuplot> test-a[TAB]

Nothing happens.

But it all works fine with gnuplot's built-in readline support:

gnuplot> t[TAB]
gnuplot> test-[TAB]
test-a.txt test-b.txt
gnuplot> test-a[TAB]
gnuplot> test-a.txt 

If there are other files, something else happens, so add one:

$ touch not-a-test.txt

This is what happens with rlwrap:

gnuplot> t[TAB]
gnuplot> test-[TAB]
not-a-test.txt  test-a.txt      test-b.txt      
gnuplot> test-a[TAB]

Then nothing happens after pressing [TAB], no matter how many more characters of the filename I type myself.

Again, this is how it should look like and how it works in gnuplot:

gnuplot> t[TAB]
gnuplot> test-[TAB]
test-a.txt test-b.txt
gnuplot> test-a[TAB]
gnuplot> test-a.txt 
@hanslub42
Copy link
Owner

This issue comes up every now and then. By default, rlwrap considers ' and - (apostrophe and hyphen) word-breaking, which means that it will not consider filenames that contain those characters as valid completions (you will observe something like that in bash or zsh when you encounter filenames with spaces - the completer wil refuse to "jump over" the spaces).

Calling rlwrap with --break-chars="" (or simpler: -b '') will convince it that only whitespace is word-breaking, after which it should behave as you expect.

All this poses two questions:

  • should the manpage be clearer on this?
  • should rlwrap use the same word-breakers for filename completion as it does for keyword completion?

@arekolek
Copy link
Author

This solves the problem, indeed. Using -b \' also solves the issue mentioned in this comment on stackoverflow.

If the description of the -c option in the manpage mentioned other options (like -b) that can affect its behavior, then yes, it would save me from falling for this one.

As for the second question, I can't really say as I'm not aware what word-breaking rules are used for keyword completion.

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

No branches or pull requests

2 participants