Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move charIsHexDigit as terminal implementation detail
  • Loading branch information
pvuorela committed Jun 27, 2016
1 parent 7457b8d commit 2be9820
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
14 changes: 13 additions & 1 deletion terminal.cpp
Expand Up @@ -26,6 +26,18 @@
#include "textrender.h"
#include "util.h"

static bool charIsHexDigit(QChar ch)
{
if (ch.isDigit()) // 0-9
return true;
else if (ch.toLatin1() >= 65 && ch.toLatin1() <= 70) // A-F
return true;
else if (ch.toLatin1() >= 97 && ch.toLatin1() <= 102) // a-f
return true;

return false;
}

Terminal::Terminal(QObject *parent) :
QObject(parent), iPtyIFace(0), iWindow(0), iUtil(0),
iTermSize(0,0), iEmitCursorChangeSignal(true),
Expand Down Expand Up @@ -133,7 +145,7 @@ void Terminal::putString(QString str, bool unEscape)
while(str.indexOf("\\x") != -1) {
int i = str.indexOf("\\x")+2;
QString num;
while(num.length() < 2 && str.length()>i && Util::charIsHexDigit(str.at(i))) {
while(num.length() < 2 && str.length()>i && charIsHexDigit(str.at(i))) {
num.append(str.at(i));
i++;
}
Expand Down
13 changes: 0 additions & 13 deletions util.cpp
Expand Up @@ -375,16 +375,3 @@ bool Util::canPaste()

return !cb->text().isEmpty();
}

//static
bool Util::charIsHexDigit(QChar ch)
{
if (ch.isDigit()) // 0-9
return true;
else if (ch.toLatin1() >= 65 && ch.toLatin1() <= 70) // A-F
return true;
else if (ch.toLatin1() >= 97 && ch.toLatin1() <= 102) // a-f
return true;

return false;
}
2 changes: 0 additions & 2 deletions util.h
Expand Up @@ -126,8 +126,6 @@ class Util : public QObject
bool showWelcomeScreen();
void setShowWelcomeScreen(bool value);

static bool charIsHexDigit(QChar ch);

signals:
void visualBell();
void notify(QString msg);
Expand Down

0 comments on commit 2be9820

Please sign in to comment.