diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-07-09 22:54:08 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-07-09 22:54:08 -0700 |
commit | 6f0b00f9831d96dce6ea940ab93696c61bb6f01e (patch) | |
tree | 741365ce4c157a44c258d31a550d9105820f374f /history.cpp | |
parent | 69ace201f8532d1062f90edf97c6e8fb4620095e (diff) |
Make fish import .bash_history if regular history is not found
Diffstat (limited to 'history.cpp')
-rw-r--r-- | history.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/history.cpp b/history.cpp index 65e3273c..9156b855 100644 --- a/history.cpp +++ b/history.cpp @@ -373,7 +373,6 @@ static size_t offset_of_next_item_fish_1_x(const char *begin, size_t mmap_length else { /* Note: pos will be left pointing just after this newline, because of the ++ in the loop */ - all_done = true; } break; @@ -1143,6 +1142,18 @@ void history_t::clear(void) } +bool history_t::is_empty(void) +{ + bool result = false; + scoped_lock locker(lock); + if (new_items.empty()) + { + load_old_if_needed(); + result = old_item_offsets.empty(); + } + return result; +} + /* Indicate whether we ought to import the bash history file into fish */ static bool should_import_bash_history_line(const std::string &line) { @@ -1161,7 +1172,11 @@ static bool should_import_bash_history_line(const std::string &line) return false; } } - printf("Importing %s\n", line.c_str()); + + /* Skip lines with backticks */ + if (line.find('`') != std::string::npos) + return false; + return true; } |