mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 23:02:44 +08:00
Fix for an exception in a non-interactive shell with empty input
This commit is contained in:
parent
0b1e371880
commit
2ba92f92b7
1
input.h
1
input.h
|
@ -37,6 +37,7 @@ enum
|
|||
R_KILL_WHOLE_LINE,
|
||||
R_KILL_WORD,
|
||||
R_BACKWARD_KILL_WORD,
|
||||
R_BACKWARD_KILL_PATH_COMPONENT,
|
||||
R_DUMP_FUNCTIONS,
|
||||
R_HISTORY_TOKEN_SEARCH_BACKWARD,
|
||||
R_HISTORY_TOKEN_SEARCH_FORWARD,
|
||||
|
|
|
@ -3253,8 +3253,11 @@ const wchar_t *reader_readline()
|
|||
|
||||
/* kill one word left */
|
||||
case R_BACKWARD_KILL_WORD:
|
||||
case R_BACKWARD_KILL_PATH_COMPONENT:
|
||||
{
|
||||
move_word(MOVE_DIR_LEFT, true /* erase */, move_word_style_path_components, last_char!=R_BACKWARD_KILL_WORD);
|
||||
move_word_style_t style = (c == R_BACKWARD_KILL_PATH_COMPONENT ? move_word_style_path_components : move_word_style_punctuation);
|
||||
bool newv = (last_char != R_BACKWARD_KILL_WORD && last_char != R_BACKWARD_KILL_PATH_COMPONENT);
|
||||
move_word(MOVE_DIR_LEFT, true /* erase */, style, newv);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3471,7 +3474,7 @@ static int read_ni(int fd, const io_chain_t &io)
|
|||
acc.insert(acc.end(), buff, buff + c);
|
||||
}
|
||||
|
||||
const wcstring str = str2wcstring(&acc.at(0), acc.size());
|
||||
const wcstring str = acc.empty() ? wcstring() : str2wcstring(&acc.at(0), acc.size());
|
||||
acc.clear();
|
||||
|
||||
if (fclose(in_stream))
|
||||
|
|
Loading…
Reference in New Issue
Block a user