Skip to content

Commit 8797a0a

Browse files
authoredMay 20, 2017
chat.cpp fix wchar_t isspace -> iswspace & wrong isspace on an index (#5783)
1 parent 7779bac commit 8797a0a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
 

Diff for: ‎src/chat.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ void ChatPrompt::nickCompletion(const std::list<std::string>& names, bool backwa
488488
{
489489
// no previous nick completion is active
490490
prefix_start = prefix_end = m_cursor;
491-
while (prefix_start > 0 && !isspace(m_line[prefix_start-1]))
491+
while (prefix_start > 0 && !iswspace(m_line[prefix_start-1]))
492492
--prefix_start;
493-
while (prefix_end < m_line.size() && !isspace(m_line[prefix_end]))
493+
while (prefix_end < m_line.size() && !iswspace(m_line[prefix_end]))
494494
++prefix_end;
495495
if (prefix_start == prefix_end)
496496
return;
@@ -519,7 +519,7 @@ void ChatPrompt::nickCompletion(const std::list<std::string>& names, bool backwa
519519
u32 replacement_index = 0;
520520
if (!initial)
521521
{
522-
while (word_end < m_line.size() && !isspace(m_line[word_end]))
522+
while (word_end < m_line.size() && !iswspace(m_line[word_end]))
523523
++word_end;
524524
std::wstring word = m_line.substr(prefix_start, word_end - prefix_start);
525525

@@ -538,7 +538,7 @@ void ChatPrompt::nickCompletion(const std::list<std::string>& names, bool backwa
538538
}
539539
}
540540
std::wstring replacement = completions[replacement_index];
541-
if (word_end < m_line.size() && isspace(word_end))
541+
if (word_end < m_line.size() && iswspace(m_line[word_end]))
542542
++word_end;
543543

544544
// replace existing word with replacement word,
@@ -593,17 +593,17 @@ void ChatPrompt::cursorOperation(CursorOp op, CursorOpDir dir, CursorOpScope sco
593593
case CURSOROP_SCOPE_WORD:
594594
if (dir == CURSOROP_DIR_RIGHT) {
595595
// skip one word to the right
596-
while (new_cursor < length && isspace(m_line[new_cursor]))
596+
while (new_cursor < length && iswspace(m_line[new_cursor]))
597597
new_cursor++;
598-
while (new_cursor < length && !isspace(m_line[new_cursor]))
598+
while (new_cursor < length && !iswspace(m_line[new_cursor]))
599599
new_cursor++;
600-
while (new_cursor < length && isspace(m_line[new_cursor]))
600+
while (new_cursor < length && iswspace(m_line[new_cursor]))
601601
new_cursor++;
602602
} else {
603603
// skip one word to the left
604-
while (new_cursor >= 1 && isspace(m_line[new_cursor - 1]))
604+
while (new_cursor >= 1 && iswspace(m_line[new_cursor - 1]))
605605
new_cursor--;
606-
while (new_cursor >= 1 && !isspace(m_line[new_cursor - 1]))
606+
while (new_cursor >= 1 && !iswspace(m_line[new_cursor - 1]))
607607
new_cursor--;
608608
}
609609
break;

0 commit comments

Comments
 (0)
Please sign in to comment.