mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
Removed a lot of string_buffer_t
This commit is contained in:
47
complete.cpp
47
complete.cpp
@@ -1337,20 +1337,12 @@ static int complete_param( const wchar_t *cmd_orig,
|
||||
is more commonly supported by
|
||||
homebrew getopt-like functions.
|
||||
*/
|
||||
string_buffer_t completion;
|
||||
sb_init( &completion );
|
||||
|
||||
sb_printf( &completion,
|
||||
L"%ls=",
|
||||
whole_opt.c_str()+offset );
|
||||
|
||||
wcstring completion = format_string(L"%ls=", whole_opt.c_str()+offset);
|
||||
completion_allocate( comp_out,
|
||||
(wchar_t *)completion.buff,
|
||||
completion,
|
||||
C_(o->desc.c_str()),
|
||||
flags );
|
||||
|
||||
sb_destroy( &completion );
|
||||
|
||||
}
|
||||
|
||||
completion_allocate( comp_out,
|
||||
@@ -1532,45 +1524,24 @@ static int try_complete_user( const wchar_t *cmd,
|
||||
{
|
||||
if( wcsncmp( user_name, pw_name, name_len )==0 )
|
||||
{
|
||||
string_buffer_t desc;
|
||||
|
||||
sb_init( &desc );
|
||||
sb_printf( &desc,
|
||||
COMPLETE_USER_DESC,
|
||||
pw_name );
|
||||
|
||||
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
|
||||
completion_allocate( comp,
|
||||
&pw_name[name_len],
|
||||
(wchar_t *)desc.buff,
|
||||
desc,
|
||||
COMPLETE_NO_SPACE );
|
||||
|
||||
res=1;
|
||||
|
||||
sb_destroy( &desc );
|
||||
}
|
||||
else if( wcsncasecmp( user_name, pw_name, name_len )==0 )
|
||||
{
|
||||
string_buffer_t name;
|
||||
string_buffer_t desc;
|
||||
|
||||
sb_init( &name );
|
||||
sb_init( &desc );
|
||||
sb_printf( &name,
|
||||
L"~%ls",
|
||||
pw_name );
|
||||
sb_printf( &desc,
|
||||
COMPLETE_USER_DESC,
|
||||
pw_name );
|
||||
wcstring name = format_string(L"~%ls", pw_name);
|
||||
wcstring desc = format_string(COMPLETE_USER_DESC, pw_name);
|
||||
|
||||
completion_allocate( comp,
|
||||
(wchar_t *)name.buff,
|
||||
(wchar_t *)desc.buff,
|
||||
name,
|
||||
desc,
|
||||
COMPLETE_NO_CASE | COMPLETE_DONT_ESCAPE | COMPLETE_NO_SPACE );
|
||||
res=1;
|
||||
|
||||
sb_destroy( &desc );
|
||||
sb_destroy( &name );
|
||||
|
||||
res=1;
|
||||
}
|
||||
free( pw_name );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user