From f24a0170bea7394bd11d9aa47bd189e11e92320d Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Thu, 23 Feb 2012 10:29:00 -0800 Subject: [PATCH] Fix for failing to unescape history properly, resulting in a backslash explosion --- fish_tests.cpp | 4 ++++ history.cpp | 3 +++ 2 files changed, 7 insertions(+) diff --git a/fish_tests.cpp b/fish_tests.cpp index bf77cf176..f1a3cb7fe 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -643,6 +643,10 @@ void history_tests_t::test_history(void) { /* Generate a value */ wcstring value = wcstring(L"test item ") + format_val(i); + + /* Maybe add some backslashes */ + if (i % 3 == 0) + value.append(L"(slashies \\\\\\ slashies)"); /* Generate some paths */ path_list_t paths; diff --git a/history.cpp b/history.cpp index 74363a923..7b8bbf2d3 100644 --- a/history.cpp +++ b/history.cpp @@ -287,6 +287,9 @@ static bool extract_prefix(std::string &key, std::string &value, const std::stri if (val_start < line.size() && line.at(val_start) == ' ') val_start++; value = line.substr(val_start); + + unescape_yaml(key); + unescape_yaml(value); } return where != std::string::npos; }