+size_t Text::move_offset(size_t offs, ptrdiff_t change) const
+{
+ check_alignment(offs);
+ if(!change)
+ return offs;
+
+ StringCodec::Utf8::Decoder dec(StringCodec::IGNORE_ERRORS);
+ auto i = text.begin()+offs;
+ if(change>0)
+ {
+ for(; change>0; --change)
+ dec.decode_char(text, i);
+ }
+ else
+ {
+ while(change<0 && i!=text.begin())
+ {
+ --i;
+ auto j = i;
+ if(dec.decode_char(text, j)!=-1)
+ ++change;
+ }
+ }
+ return i-text.begin();
+}
+
+void Text::offset_to_coords(size_t offs, size_t &row, size_t &col) const