Commits

Anonymous committed 2ba92f9

Fix for an exception in a non-interactive shell with empty input

  • Participants
  • Parent commits 0b1e371

Comments (0)

Files changed (2)

     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,
 
             /* 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;
             }
 
             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))