2014-04-28 20:48:23 +02:00
|
|
|
#ifndef buffer_utils_hh_INCLUDED
|
|
|
|
#define buffer_utils_hh_INCLUDED
|
|
|
|
|
|
|
|
#include "buffer.hh"
|
|
|
|
#include "selection.hh"
|
|
|
|
|
|
|
|
namespace Kakoune
|
|
|
|
{
|
|
|
|
|
|
|
|
inline String content(const Buffer& buffer, const Selection& range)
|
|
|
|
{
|
|
|
|
return buffer.string(range.min(), buffer.char_next(range.max()));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline BufferIterator erase(Buffer& buffer, const Selection& range)
|
|
|
|
{
|
|
|
|
return buffer.erase(buffer.iterator_at(range.min()),
|
2014-07-02 22:14:01 +02:00
|
|
|
utf8::next(buffer.iterator_at(range.max()), buffer.end()));
|
2014-04-28 20:48:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
inline CharCount char_length(const Buffer& buffer, const Selection& range)
|
|
|
|
{
|
|
|
|
return utf8::distance(buffer.iterator_at(range.min()),
|
2014-07-02 22:14:01 +02:00
|
|
|
utf8::next(buffer.iterator_at(range.max()), buffer.end()));
|
2014-04-28 20:48:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CharCount get_column(const Buffer& buffer,
|
2014-05-07 20:51:01 +02:00
|
|
|
CharCount tabstop, ByteCoord coord);
|
2014-04-28 20:48:23 +02:00
|
|
|
|
2014-05-02 19:58:04 +02:00
|
|
|
Buffer* create_fifo_buffer(String name, int fd, bool scroll = false);
|
2014-04-29 22:37:11 +02:00
|
|
|
|
2014-08-15 14:21:54 +02:00
|
|
|
Buffer* create_buffer_from_data(StringView data, StringView name,
|
|
|
|
Buffer::Flags flags,
|
|
|
|
time_t fs_timestamp = InvalidTime);
|
|
|
|
|
2014-04-28 20:48:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // buffer_utils_hh_INCLUDED
|
|
|
|
|