From fa375ed8b4181af0638c31e2e46a42db393bb0d5 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 3 Sep 2007 22:23:30 +0000 Subject: [PATCH] unicode fix to abbreviated orders --- src/common/kernel/order.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/common/kernel/order.c b/src/common/kernel/order.c index 6b552f5a5..4fbecbee4 100644 --- a/src/common/kernel/order.c +++ b/src/common/kernel/order.c @@ -119,8 +119,14 @@ get_command(const order * ord, char * sbuffer, size_t size) bytes = (int)strlcpy(bufp, (const char *)text, size); if (wrptr(&bufp, &size, bytes)!=0) { WARN_STATIC_BUFFER(); - if (bufp-sbuffer>=5) { - memcpy(bufp-5, "[...]", 5); /* TODO: make sure this only happens in eval_command */ + if (bufp-sbuffer>=6) { + bufp -= 6; + while (bufp>sbuffer&& (*bufp&0x80)!=0) { + ++size; + --bufp; + } + memcpy(bufp+1, "[...]", 5); /* TODO: make sure this only happens in eval_command */ + bufp += 6; } } }