Files
textmate/Frameworks/editor/src/snippets.h
Allan Odgaard 80bf684510 Don’t disallow snippet expansion in last placeholder
This was (temporarily) disallowed by previous commit. We do however need to allow it in the last placeholder since that is used for chaining snippets. See issue #182.
2012-08-21 19:43:30 +02:00

34 lines
904 B
C++

#ifndef SNIPPETS_H_UC2RJ8ET
#define SNIPPETS_H_UC2RJ8ET
#include <regexp/snippet.h>
#include <buffer/buffer.h>
#include <selection/selection.h>
namespace ng
{
struct snippet_controller_t
{
void push (snippet::snippet_t const& snippet, ng::range_t const& range);
std::vector< std::pair<ng::range_t, std::string> > replace (size_t from, size_t to, std::string const& replacement);
ng::range_t current () const;
std::vector<std::string> const& choices () const;
void drop_for_pos (size_t pos);
bool next () { return stack.next(); }
bool previous () { return stack.previous(); }
void clear () { return stack.clear(); }
bool empty () const { return stack.empty(); }
bool in_last_placeholder () const { return stack.in_last_placeholder(); }
private:
size_t anchor;
snippet::stack_t stack;
};
} /* ng */
#endif /* end of include guard: SNIPPETS_H_UC2RJ8ET */