mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 07:34:32 +00:00
Added constructor to completion_t for guarranted initialzation of flags attribute.
This commit is contained in:
parent
6f330f961b
commit
7e124cf95e
7 changed files with 26 additions and 12 deletions
|
@ -3895,7 +3895,8 @@ void builtin_get_names( array_list_t *list )
|
|||
|
||||
void builtin_get_names2(std::vector<completion_t> &list) {
|
||||
for (int i=0;i<builtin.size; ++i) {
|
||||
completion_t data_to_push = { (wchar_t*)builtin.arr[i].key };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = (wchar_t*) builtin.arr[i].key;
|
||||
list.push_back( data_to_push );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1173,7 +1173,8 @@ static void complete_cmd( const wchar_t *cmd,
|
|||
//function_get_names( &possible_comp, cmd[0] == L'_' );
|
||||
wcstring_list_t names = function_get_names(cmd[0] == L'_' );
|
||||
for (size_t i=0; i < names.size(); i++) {
|
||||
completion_t data_to_push = { names.at(i) };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = names.at(i);
|
||||
possible_comp.push_back( data_to_push );
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,10 @@ struct completion_t
|
|||
*/
|
||||
int flags;
|
||||
|
||||
completion_t () {
|
||||
flags = 0;
|
||||
}
|
||||
|
||||
bool operator < (const completion_t& rhs) const { return this->completion < rhs.completion; }
|
||||
bool operator == (const completion_t& rhs) const { return this->completion == rhs.completion; }
|
||||
bool operator != (const completion_t& rhs) const { return this->completion != rhs.completion; }
|
||||
|
|
|
@ -1380,7 +1380,8 @@ static int expand_variables2( wchar_t * in, std::vector<completion_t> &out, int
|
|||
wchar_t *next = (wchar_t *)al_get( &var_item_list, j );
|
||||
if( is_ok && (i == 0) && (!in[stop_pos]) )
|
||||
{
|
||||
completion_t data_to_push = { next };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = next;
|
||||
out.push_back( data_to_push );
|
||||
}
|
||||
else
|
||||
|
@ -1464,7 +1465,8 @@ static int expand_variables2( wchar_t * in, std::vector<completion_t> &out, int
|
|||
|
||||
if( !empty )
|
||||
{
|
||||
completion_t data_to_push = { in };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = in;
|
||||
out.push_back( data_to_push );
|
||||
}
|
||||
else
|
||||
|
@ -1566,7 +1568,8 @@ static int expand_brackets( wchar_t *in, int flags, std::vector<completion_t> &o
|
|||
|
||||
if( bracket_begin == 0 )
|
||||
{
|
||||
completion_t data_to_push = { in };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = in;
|
||||
out.push_back( data_to_push );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1944,7 +1944,8 @@ static int parse_job( process_t *p,
|
|||
}
|
||||
}
|
||||
}
|
||||
completion_t data_to_push = { nxt };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = nxt;
|
||||
args->push_back( data_to_push );
|
||||
}
|
||||
|
||||
|
@ -1998,9 +1999,11 @@ static int parse_job( process_t *p,
|
|||
// al_truncate( args, 0 );
|
||||
args->clear();
|
||||
// al_push( args, halloc_wcsdup( j, L"cd" ) );
|
||||
completion_t comp = { L"cd" };
|
||||
completion_t comp;
|
||||
comp.completion = L"cd";
|
||||
args->push_back(comp);
|
||||
completion_t comp2 = { tmp };
|
||||
completion_t comp2;
|
||||
comp2.completion = tmp;
|
||||
args->push_back( comp2 );
|
||||
|
||||
// free(tmp);
|
||||
|
|
|
@ -1254,8 +1254,8 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vector<complet
|
|||
foo );
|
||||
}
|
||||
|
||||
free( foo );
|
||||
free( baz );
|
||||
// free( foo );
|
||||
// free( baz );
|
||||
}
|
||||
|
||||
free( escaped_separator );
|
||||
|
|
|
@ -897,7 +897,8 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
else
|
||||
{
|
||||
res = 1;
|
||||
completion_t data_to_push = { base_dir };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = base_dir;
|
||||
if ( std::find( out.begin(), out.end(), data_to_push ) != out.end() ){
|
||||
out.push_back( data_to_push);
|
||||
}
|
||||
|
@ -970,7 +971,8 @@ static int wildcard_expand_internal( const wchar_t *wc,
|
|||
}
|
||||
else
|
||||
{
|
||||
completion_t data_to_push = { long_name };
|
||||
completion_t data_to_push;
|
||||
data_to_push.completion = long_name;
|
||||
out.push_back( data_to_push );
|
||||
}
|
||||
res = 1;
|
||||
|
|
Loading…
Reference in a new issue