>>108929197
bool MoveForwardToBoundary(ref Context ctx) {
auto cur = &ctx.document.vcursor;
auto start_pos = cur.position;
auto prev_char = cur.char_under;
while ( MoveForwardOne(ctx) ) {
if ( cur.position.x == 0 &&
cur.prev_pos.y != cur.position.y &&
cur.prev_pos.x != 0
) return true;
if ( isWordBoundary(prev_char, cur.char_under) ) return true;
prev_char = cur.char_under;
}
// This skips over empty lines to the next non empty line
while ( ctx.document.vcursor.line.IsEmpty && ctx.document.vcursor.line.next !is null ) {
if ( !MoveForwardToBoundary(ctx) ) return false;
}
// And this skips non-word characters in the beginning of a line
// that follows some empty lines.
while ( !isWordChar(ctx.document.vcursor.char_under) ) {
if ( !MoveForwardOne(ctx) ) return false;
}
return cur.position != start_pos;
} unittest {
auto ctx = Context(document: new Document("abc def\nghi\n jkl\n\n\nmno"));
auto cur = &ctx.document.vcursor;
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == ' ');
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == 'd');
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == 'g');
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == ' ');
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == 'j');
MoveForwardToBoundary(ctx);
assert(cur.char_under.isNull);
MoveForwardToBoundary(ctx);
assert(cur.char_under.get == 'm');
} // end unittest
I puke. You suck and I bet you haven't noticed the problem in this fragment yet, but also it's clear you can't spell disgusting without d.