From 8cedefc2782ff0ce59c2e2e86eab0d0a34c55ec2 Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 10 Jul 2018 23:44:02 +0000 Subject: [PATCH] Allow using non-ASCII format strings in Printf. --- src/solvespace.h | 1 + src/textwin.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/solvespace.h b/src/solvespace.h index 7e0c68f4..29e227ce 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -275,6 +275,7 @@ public: utf8_iterator& operator++() { **this; p=n; n=NULL; return *this; } utf8_iterator operator++(int) { utf8_iterator t(*this); operator++(); return t; } char32_t operator*(); + const char* ptr() const { return p; } }; class ReadUTF8 { const std::string &str; diff --git a/src/textwin.cpp b/src/textwin.cpp index af461ea4..7a977aca 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -445,7 +445,9 @@ void TextWindow::Printf(bool halfLine, const char *fmt, ...) { } } - fmt++; + utf8_iterator it(fmt); + it++; + fmt = it.ptr(); } while(c < MAX_COLS) { meta[r][c].fg = fg;