From 33fb33dc8d11dfb453b8232529421672c0b759e3 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Fri, 12 Oct 2012 16:11:54 +0200 Subject: [PATCH] helpers: writeCyclicBuffer: fix drawing part of separator --- src/helpers.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/helpers.cpp b/src/helpers.cpp index d3a73c57..bb9df584 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -162,7 +162,10 @@ void writeCyclicBuffer(const NC::WBuffer &buf, NC::Window &w, size_t &start_pos, }; write_buffer(start_pos); - for (size_t i = 0; i < separator.length() && len < width; ++i) + size_t i = 0; + if (start_pos > s.length()) + i = start_pos - s.length(); + for (; i < separator.length() && len < width; ++i) { len += wcwidth(separator[i]); if (len > width) @@ -172,7 +175,7 @@ void writeCyclicBuffer(const NC::WBuffer &buf, NC::Window &w, size_t &start_pos, write_buffer(0); ++start_pos; - if (start_pos >= s.length()) + if (start_pos >= s.length() + separator.length()) start_pos = 0; } else