From 0ab8db384f4d19be0c22f00abad90ccc79924c61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 17 Jul 2004 10:59:42 +0000 Subject: [PATCH] fixed TABs handling git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/m_pre.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index 3e9d05db2c..91cc6579d8 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -36,29 +36,38 @@ static wxString LINKAGEMODE HtmlizeWhitespaces(const wxString& str) { wxString out; size_t len = str.Len(); + size_t linepos = 0; for (size_t i = 0; i < len; i++) { switch (str[i]) { case wxT('<'): while (i < len && str[i] != wxT('>')) + { out << str[i++]; + linepos++; + } out << wxT('>'); + linepos++; break; case wxT(' '): out << wxT(" "); + linepos++; break; case wxT('\n'): out << wxT("
"); + linepos = 0; break; case wxT('\t'): { - for (size_t j = 8 - i%8; j > 0; j--) + for (size_t j = 8 - linepos % 8; j > 0; j--) out << wxT(" "); + linepos += 8 - linepos % 8; } break; default: out << str[i]; + linepos++; break; } } -- 2.45.2