From b42d4197c9a77c4fc1c19c2df2e258053f18577a Mon Sep 17 00:00:00 2001 From: Mino1289 Date: Sat, 23 Oct 2021 00:07:19 +0200 Subject: [PATCH] =?UTF-8?q?[apps/code]=20fix=20et=20r=C3=A9organisation=20?= =?UTF-8?q?du=20fichier=20(un=20peu)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/reader/tex_parser.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/reader/tex_parser.cpp b/apps/reader/tex_parser.cpp index d36eee6ff..24da80e0a 100644 --- a/apps/reader/tex_parser.cpp +++ b/apps/reader/tex_parser.cpp @@ -98,16 +98,22 @@ Layout TexParser::popCommand() { return popFracCommand(); } } - else if (strcmp(k_sqrtCommand, m_text, strlen(k_fracCommand)) == 0) { - m_text += strlen(k_fracCommand); + else if (strncmp(k_sqrtCommand, m_text, strlen(k_sqrtCommand)) == 0) { + m_text += strlen(k_sqrtCommand); if (*m_text == ' ' || *m_text == '{' || *m_text == '[') { return popSqrtCommand(); } } - + m_hasError = true return popFracCommand(); } +Layout TexParser::popFracCommand() { + Layout firstBlock = popBlock(); + Layout secondBlock = popBlock(); + return FractionLayout::Builder(firstBlock, secondBlock); +} + Layout TexParser::popSqrtCommand() { while (*m_text == ' ') { m_text ++; @@ -121,10 +127,5 @@ Layout TexParser::popSqrtCommand() { } } -Layout TexParser::popFracCommand() { - Layout firstBlock = popBlock(); - Layout secondBlock = popBlock(); - return FractionLayout::Builder(firstBlock, secondBlock); -} }