
There are a couple things that annoy me about XPrompt.Shell: 1. When tab-completing a directory name, a trailing slash is not automatically appended. Thus an additional keystroke is required, unlike any other tab completion system I’m familiar with (mostly those in bash and Vim). 2. Filenames in the pop-up tab-completion list are escaped. This makes the names harder to read. Could the unescaped filenames appear in the list and then be escaped after tab is pressed as the string is copied into the prompt line? I looked at the source, but only got as far as finding that the completion is done via bash’s compgen builtin. I coudn’t find in bash’s man page how to add slashes to the output of compgen.

On Wed, Feb 13, 2008 at 03:54:51PM -1000, lithis wrote:
There are a couple things that annoy me about XPrompt.Shell:
1. When tab-completing a directory name, a trailing slash is not automatically appended. Thus an additional keystroke is required, unlike any other tab completion system I’m familiar with (mostly those in bash and Vim).
Seems like a nice idea, dunno the best way to tackle it.
2. Filenames in the pop-up tab-completion list are escaped. This makes the names harder to read. Could the unescaped filenames appear in the list and then be escaped after tab is pressed as the string is copied into the prompt line?
I'd vote against this. Consider a situation where files "foo", "bar" and "foo bar" exist. Then there are two commands that appear as "touch foo bar" on screen, but will execute different things depending on whether the user used tab completion. Furthermore, I think it is pretty standard to display the escapes in this fashion (it is what bash and zsh do, at least). Cheers, Spencer Janssen

On Thu, 2008/02/14 05:22:15 -0600, Spencer Janssen wrote:
Then there are two commands that appear as "touch foo bar" on screen,
Because the pop-up display is shown in columns, it would be obvious that “foo” “bar” and “foo bar” were distinct: foo bar foo bar
but will execute different things depending on whether the user used tab completion.
Escaping should still be performed in the command line itself; I’m just suggesting the the escaping happen after the pop-up list is displayed and before the text is added to the command line (instead of before the pop-up list is displayed). In the above example. selecting “foo bar” with tab would append “foo\ bar” to the command line.
Furthermore, I think it is pretty standard to display the escapes in this fashion (it is what bash and zsh do, at least).
When there are multiple matches in bash, pressing tab twice causes the possible matches to be printed one per line, without any escaping. bash escapes the filename only when matched text is added to the current command line.

On Thu, Feb 14, 2008 at 09:36:22AM -1000, lithis wrote:
On Thu, 2008/02/14 05:22:15 -0600, Spencer Janssen wrote:
Then there are two commands that appear as "touch foo bar" on screen,
Because the pop-up display is shown in columns, it would be obvious that “foo” “bar” and “foo bar” were distinct: foo bar foo bar
but will execute different things depending on whether the user used tab completion.
Escaping should still be performed in the command line itself; I’m just suggesting the the escaping happen after the pop-up list is displayed and before the text is added to the command line (instead of before the pop-up list is displayed). In the above example. selecting “foo bar” with tab would append “foo\ bar” to the command line.
Furthermore, I think it is pretty standard to display the escapes in this fashion (it is what bash and zsh do, at least).
When there are multiple matches in bash, pressing tab twice causes the possible matches to be printed one per line, without any escaping. bash escapes the filename only when matched text is added to the current command line.
Ah, I thought you meant that the escapes would also be removed from the command line, but you didn't. In that case, this seems fine.

On Fri, Feb 15, 2008 at 03:23:18AM -0600, Spencer Janssen wrote:
When there are multiple matches in bash, pressing tab twice causes the possible matches to be printed one per line, without any escaping. bash escapes the filename only when matched text is added to the current command line.
Ah, I thought you meant that the escapes would also be removed from the command line, but you didn't. In that case, this seems fine.
For sometime I forgot I wrote a class and wrapped it in an existential just because when I was writing the prompt I was thinking about expanding the API at a later time in a safe manner... that time has come...;) So, now the prompt can complete just the last word of the command line, or the whole line - which makes it possible to have a theme selector displaying all the information we want to display, or a gotoWindow without having to escape everything. The first is the default behavior and can be tuned, so now it is possible to have the completions displayed without escaping the space (or other special character), and have them escaped in the command line, which was one of the requested features. The first one (the trailing slash) is not so easy, and this is the solution I've pushed: if there is just one completion and that completion is a directory, a trailing slash will be added. I don't know if it is the right approach, but it is definitely the simplest one I could think about (and I don't think I'm not going to think about it twice... so patches are welcome...;). Please let me know your thoughts. Andrea

On Sat, Feb 16, 2008 at 02:56:04PM +0100, Andrea Rossato wrote:
The first one (the trailing slash) is not so easy, and this is the solution I've pushed: if there is just one completion and that completion is a directory, a trailing slash will be added.
I don't know if it is the right approach, but it is definitely the simplest one I could think about (and I don't think I'm not going to think about it twice... so patches are welcome...;).
Please let me know your thoughts.
I've just pushed a patch that will force the prompt to regenerate the completion list when there is just one completion (left?). I think that this patch makes the approach I adopted for the trailing slash quite useful, after all. Please let me know. andrea

On Thu, Feb 14, 2008 at 05:22:15AM -0600, Spencer Janssen wrote:
On Wed, Feb 13, 2008 at 03:54:51PM -1000, lithis wrote:
There are a couple things that annoy me about XPrompt.Shell:
1. When tab-completing a directory name, a trailing slash is not automatically appended. Thus an additional keystroke is required, unlike any other tab completion system I’m familiar with (mostly those in bash and Vim).
Seems like a nice idea, dunno the best way to tackle it.
As far as I recall it is bash (which is used for file and directory completion) not to put a trailing slash. I'll investigate if I can come up with a solution - the prompt doesn't check if the string is a file name, a command, or whatever.
2. Filenames in the pop-up tab-completion list are escaped. This makes the names harder to read. Could the unescaped filenames appear in the list and then be escaped after tab is pressed as the string is copied into the prompt line?
I'd vote against this. Consider a situation where files "foo", "bar" and "foo bar" exist. Then there are two commands that appear as "touch foo bar" on screen, but will execute different things depending on whether the user used tab completion. Furthermore, I think it is pretty standard to display the escapes in this fashion (it is what bash and zsh do, at least).
I don't think this could be easily done, even though I would like the possibility to show completions without escape characters sometimes (I wanted something like that for the theme prompt). The problem is that the prompt will try to complete the final word (which means, the word after the last space). This is not related to the completion list, obviously, but the command line will just display the text of the selected completion, without any change. And so, if you want "foo bar" to be treated a single word there's the need of a '\' before the space. Cheers, Andrea
participants (3)
-
Andrea Rossato
-
lithis
-
Spencer Janssen