mirror of
https://github.com/fish-shell/fish-shell
synced 2024-09-24 00:12:17 +00:00
restore tabs instead of spaces
This commit is contained in:
parent
079f17761c
commit
b25b5bf5f6
2 changed files with 486 additions and 486 deletions
124
builtin_set.cpp
124
builtin_set.cpp
|
@ -89,7 +89,7 @@ static int my_env_set( const wchar_t *key, wcstring_list_t &val, int scope )
|
||||||
if( error )
|
if( error )
|
||||||
{
|
{
|
||||||
const wchar_t *colon;
|
const wchar_t *colon;
|
||||||
append_format(stderr_buffer, _(BUILTIN_SET_PATH_ERROR), L"set", dir, key);
|
append_format(stderr_buffer, _(BUILTIN_SET_PATH_ERROR), L"set", dir, key);
|
||||||
colon = wcschr( dir, L':' );
|
colon = wcschr( dir, L':' );
|
||||||
|
|
||||||
if( colon && *(colon+1) )
|
if( colon && *(colon+1) )
|
||||||
|
@ -106,7 +106,7 @@ static int my_env_set( const wchar_t *key, wcstring_list_t &val, int scope )
|
||||||
|
|
||||||
if( show_hint )
|
if( show_hint )
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(BUILTIN_SET_PATH_HINT), L"set", key, key, wcschr( dir, L':' )+1);
|
append_format(stderr_buffer, _(BUILTIN_SET_PATH_HINT), L"set", key, key, wcschr( dir, L':' )+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( error )
|
if( error )
|
||||||
|
@ -128,7 +128,7 @@ static int my_env_set( const wchar_t *key, wcstring_list_t &val, int scope )
|
||||||
{
|
{
|
||||||
for( i=0; i< val.size() ; i++ )
|
for( i=0; i< val.size() ; i++ )
|
||||||
{
|
{
|
||||||
sb.append(val[i]);
|
sb.append(val[i]);
|
||||||
if( i<val.size() - 1 )
|
if( i<val.size() - 1 )
|
||||||
{
|
{
|
||||||
sb.append( ARRAY_SEP_STR );
|
sb.append( ARRAY_SEP_STR );
|
||||||
|
@ -141,7 +141,7 @@ static int my_env_set( const wchar_t *key, wcstring_list_t &val, int scope )
|
||||||
{
|
{
|
||||||
case ENV_PERM:
|
case ENV_PERM:
|
||||||
{
|
{
|
||||||
append_format(stderr_buffer, _(L"%ls: Tried to change the read-only variable '%ls'\n"), L"set", key);
|
append_format(stderr_buffer, _(L"%ls: Tried to change the read-only variable '%ls'\n"), L"set", key);
|
||||||
retcode=1;
|
retcode=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -237,32 +237,32 @@ static int parse_index( std::vector<long> &indexes,
|
||||||
}
|
}
|
||||||
|
|
||||||
src = end;
|
src = end;
|
||||||
if ( *src==L'.' && *(src+1)==L'.' ){
|
if ( *src==L'.' && *(src+1)==L'.' ){
|
||||||
src+=2;
|
src+=2;
|
||||||
long l_ind2 = wcstol( src, &end, 10 );
|
long l_ind2 = wcstol( src, &end, 10 );
|
||||||
if( end==src || errno )
|
if( end==src || errno )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
src = end;
|
src = end;
|
||||||
|
|
||||||
if( l_ind2 < 0 )
|
if( l_ind2 < 0 )
|
||||||
{
|
{
|
||||||
l_ind2 = var_count+l_ind2+1;
|
l_ind2 = var_count+l_ind2+1;
|
||||||
}
|
}
|
||||||
int direction = l_ind2<l_ind ? -1 : 1 ;
|
int direction = l_ind2<l_ind ? -1 : 1 ;
|
||||||
for (long jjj = l_ind; jjj*direction <= l_ind2*direction; jjj+=direction) {
|
for (long jjj = l_ind; jjj*direction <= l_ind2*direction; jjj+=direction) {
|
||||||
// debug(0, L"Expand range [set]: %i\n", jjj);
|
// debug(0, L"Expand range [set]: %i\n", jjj);
|
||||||
indexes.push_back( jjj );
|
indexes.push_back( jjj );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
indexes.push_back( l_ind );
|
indexes.push_back( l_ind );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
while (iswspace(*src)) src++;
|
while (iswspace(*src)) src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -286,10 +286,10 @@ static int update_values( wcstring_list_t &list,
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ( ind >= list.size() )
|
if ( ind >= list.size() )
|
||||||
{
|
{
|
||||||
list.resize( ind+1 );
|
list.resize( ind+1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// free((void *) al_get(list, ind));
|
// free((void *) al_get(list, ind));
|
||||||
list[ ind ] = newv;
|
list[ ind ] = newv;
|
||||||
|
@ -303,19 +303,19 @@ static int update_values( wcstring_list_t &list,
|
||||||
*/
|
*/
|
||||||
static void erase_values(wcstring_list_t &list, const std::vector<long> &indexes)
|
static void erase_values(wcstring_list_t &list, const std::vector<long> &indexes)
|
||||||
{
|
{
|
||||||
// Make a set of indexes.
|
// Make a set of indexes.
|
||||||
// This both sorts them into ascending order and removes duplicates.
|
// This both sorts them into ascending order and removes duplicates.
|
||||||
const std::set<long> indexes_set(indexes.begin(), indexes.end());
|
const std::set<long> indexes_set(indexes.begin(), indexes.end());
|
||||||
|
|
||||||
// Now walk the set backwards, so we encounter larger indexes first, and remove elements at the given (1-based) indexes.
|
// Now walk the set backwards, so we encounter larger indexes first, and remove elements at the given (1-based) indexes.
|
||||||
std::set<long>::const_reverse_iterator iter;
|
std::set<long>::const_reverse_iterator iter;
|
||||||
for (iter = indexes_set.rbegin(); iter != indexes_set.rend(); iter++) {
|
for (iter = indexes_set.rbegin(); iter != indexes_set.rend(); iter++) {
|
||||||
long val = *iter;
|
long val = *iter;
|
||||||
if (val > 0 && val <= list.size()) {
|
if (val > 0 && val <= list.size()) {
|
||||||
// One-based indexing!
|
// One-based indexing!
|
||||||
list.erase(list.begin() + val - 1);
|
list.erase(list.begin() + val - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,13 +325,13 @@ static void erase_values(wcstring_list_t &list, const std::vector<long> &indexes
|
||||||
*/
|
*/
|
||||||
static void print_variables(int include_values, int esc, bool shorten_ok, int scope)
|
static void print_variables(int include_values, int esc, bool shorten_ok, int scope)
|
||||||
{
|
{
|
||||||
wcstring_list_t names = env_get_names(scope);
|
wcstring_list_t names = env_get_names(scope);
|
||||||
sort(names.begin(), names.end());
|
sort(names.begin(), names.end());
|
||||||
|
|
||||||
for( size_t i = 0; i < names.size(); i++ )
|
for( size_t i = 0; i < names.size(); i++ )
|
||||||
{
|
{
|
||||||
const wcstring key = names.at(i);
|
const wcstring key = names.at(i);
|
||||||
const wcstring e_key = escape_string(key, 0);
|
const wcstring e_key = escape_string(key, 0);
|
||||||
|
|
||||||
stdout_buffer.append(e_key);
|
stdout_buffer.append(e_key);
|
||||||
|
|
||||||
|
@ -350,8 +350,8 @@ static void print_variables(int include_values, int esc, bool shorten_ok, int sc
|
||||||
|
|
||||||
wcstring e_value = esc ? expand_escape_variable(value) : value;
|
wcstring e_value = esc ? expand_escape_variable(value) : value;
|
||||||
|
|
||||||
stdout_buffer.append(L" ");
|
stdout_buffer.append(L" ");
|
||||||
stdout_buffer.append(e_value);
|
stdout_buffer.append(e_value);
|
||||||
|
|
||||||
if( shorten )
|
if( shorten )
|
||||||
{
|
{
|
||||||
|
@ -407,7 +407,7 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
||||||
{
|
{
|
||||||
L"universal", no_argument, 0, 'U'
|
L"universal", no_argument, 0, 'U'
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
L"long", no_argument, 0, 'L'
|
L"long", no_argument, 0, 'L'
|
||||||
}
|
}
|
||||||
|
@ -494,9 +494,9 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
||||||
universal = 1;
|
universal = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
shorten_ok = false;
|
shorten_ok = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'q':
|
case 'q':
|
||||||
query = 1;
|
query = 1;
|
||||||
|
@ -604,9 +604,9 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
||||||
wcstring_list_t result;
|
wcstring_list_t result;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
env_var_t dest_str = env_get_string(dest);
|
env_var_t dest_str = env_get_string(dest);
|
||||||
if (! dest_str.missing())
|
if (! dest_str.missing())
|
||||||
tokenize_variable_array( dest_str, result );
|
tokenize_variable_array( dest_str, result );
|
||||||
|
|
||||||
if( !parse_index( indexes, arg, dest, result.size() ) )
|
if( !parse_index( indexes, arg, dest, result.size() ) )
|
||||||
{
|
{
|
||||||
|
@ -718,9 +718,9 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
||||||
std::vector<long> indexes;
|
std::vector<long> indexes;
|
||||||
wcstring_list_t result;
|
wcstring_list_t result;
|
||||||
|
|
||||||
const env_var_t dest_str = env_get_string(dest);
|
const env_var_t dest_str = env_get_string(dest);
|
||||||
if (! dest_str.missing())
|
if (! dest_str.missing())
|
||||||
tokenize_variable_array( dest_str, result );
|
tokenize_variable_array( dest_str, result );
|
||||||
|
|
||||||
for( ; woptind<argc; woptind++ )
|
for( ; woptind<argc; woptind++ )
|
||||||
{
|
{
|
||||||
|
@ -819,9 +819,9 @@ static int builtin_set( parser_t &parser, wchar_t **argv )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wcstring_list_t val;
|
wcstring_list_t val;
|
||||||
for( i=woptind; i<argc; i++ )
|
for( i=woptind; i<argc; i++ )
|
||||||
val.push_back(argv[i]);
|
val.push_back(argv[i]);
|
||||||
retcode = my_env_set( dest, val, scope );
|
retcode = my_env_set( dest, val, scope );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
690
expand.cpp
690
expand.cpp
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue