diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-01 16:27:14 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-02-01 16:27:14 -0800 |
commit | 62f49c55cec0dc8b4b2b41d1eff4f1a02ba18431 (patch) | |
tree | 7624163acd470ec1a16a4ac50113fd3f3088f7ba /complete.h | |
parent | 0b4b6c498d4cac8591dcfc04549acd62305d5008 (diff) |
Clean up uses of completion_t
Diffstat (limited to 'complete.h')
-rw-r--r-- | complete.h | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -102,9 +102,14 @@ -struct completion_t +class completion_t { +private: + /* No public default constructor */ + completion_t(){ } +public: + /** The completion string */ @@ -126,12 +131,21 @@ struct completion_t is case insensitive. */ int flags; - - completion_t() : flags(0) { } + + completion_t(const wcstring &comp, const wcstring &desc = L"", int flags_val = 0) : completion(comp), description(desc), flags(flags_val) { + if( flags & COMPLETE_AUTO_SPACE ) + { + flags = flags & ~COMPLETE_AUTO_SPACE; + size_t len = completion.size(); + if (len > 0 && ( wcschr( L"/=@:", comp.at(len-1)) != 0 )) + flags |= COMPLETE_NO_SPACE; + + } + } bool operator < (const completion_t& rhs) const { return this->completion < rhs.completion; } bool operator == (const completion_t& rhs) const { return this->completion == rhs.completion; } - bool operator != (const completion_t& rhs) const { return this->completion != rhs.completion; } + bool operator != (const completion_t& rhs) const { return ! (*this == rhs); } } ; @@ -257,15 +271,13 @@ void complete_load( const wchar_t *cmd, int reload ); /** Create a new completion entry - \param context The halloc context to use for allocating new memory + \param completions The array of completions to append to \param comp The completion string \param desc The description of the completion \param flags completion flags + */ -void completion_allocate( std::vector<completion_t> &context, - const wchar_t *comp, - const wchar_t *desc, - int flags ); +void completion_allocate(std::vector<completion_t> &completions, const wcstring &comp, const wcstring &desc, int flags); #endif |