From e351acd997c0b2bf3a8026f16f6e70baa4388080 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 29 Sep 2011 14:23:46 +0000 Subject: [PATCH] Window: fix blink_void --- src/display_buffer.cc | 1 + src/window.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/display_buffer.cc b/src/display_buffer.cc index 0865211a..8a8eb09e 100644 --- a/src/display_buffer.cc +++ b/src/display_buffer.cc @@ -12,6 +12,7 @@ DisplayBuffer::DisplayBuffer() DisplayBuffer::iterator DisplayBuffer::split(iterator atom, size_t pos_in_atom) { assert(atom < end()); + assert(pos_in_atom > 0); assert(pos_in_atom < atom->content.length()); DisplayAtom new_atom(atom->begin, atom->begin + pos_in_atom, atom->content.substr(0, pos_in_atom), diff --git a/src/window.cc b/src/window.cc index 122767ee..2ba97048 100644 --- a/src/window.cc +++ b/src/window.cc @@ -114,7 +114,9 @@ static void blink_void(DisplayBuffer& display_buffer) size_t pos = atom_it->content.find("void"); if (pos != std::string::npos) { - atom_it = display_buffer.split(atom_it, pos) + 1; + if (pos != 0) + atom_it = display_buffer.split(atom_it, pos) + 1; + atom_it = display_buffer.split(atom_it, 4); atom_it->attribute |= Attributes::Blink; ++atom_it;