Make tab-completion truncation less dumb

Fixes https://github.com/fish-shell/fish-shell/issues/259
This commit is contained in:
ridiculousfish 2012-11-09 16:02:19 -08:00
parent 1dfa404210
commit 0302162d8e

View File

@ -111,7 +111,7 @@ commence.
Maximum length of prefix string when printing completion Maximum length of prefix string when printing completion
list. Longer prefixes will be ellipsized. list. Longer prefixes will be ellipsized.
*/ */
#define PREFIX_MAX_LEN 8 #define PREFIX_MAX_LEN 9
/** /**
A simple prompt for reading shell commands that does not rely on A simple prompt for reading shell commands that does not rely on
@ -1556,7 +1556,7 @@ static bool handle_completions( const std::vector<completion_t> &comp )
{ {
// append just the end of the string // append just the end of the string
prefix = wcstring(&ellipsis_char, 1); prefix = wcstring(&ellipsis_char, 1);
prefix.append(data->command_line, prefix_start + len - PREFIX_MAX_LEN, wcstring::npos); prefix.append(data->command_line, prefix_start + len - PREFIX_MAX_LEN - 1, wcstring::npos);
} }
{ {