Skip to content

Commit 220bd99

Browse files
committed
fixes #358 - fix issue displaying messages containing carriage return
1 parent 2df7d4c commit 220bd99

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

lib/common/src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
#pragma once
99

10-
#define NCHAT_VERSION "5.12.19"
10+
#define NCHAT_VERSION "5.12.20"

lib/ncutil/src/strutil.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ void StrUtil::ReplaceString(std::string& p_Str, const std::string& p_Search, con
279279
}
280280
}
281281

282+
void StrUtil::SanitizeMessageStr(std::string& p_Str)
283+
{
284+
p_Str.erase(std::remove(p_Str.begin(), p_Str.end(), '\r'), p_Str.end());
285+
}
286+
282287
std::vector<std::string> StrUtil::Split(const std::string& p_Str, char p_Sep)
283288
{
284289
std::vector<std::string> vec;

lib/ncutil/src/strutil.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// strutil.h
22
//
3-
// Copyright (c) 2020-2024 Kristofer Berggren
3+
// Copyright (c) 2020-2025 Kristofer Berggren
44
// All rights reserved.
55
//
66
// nchat is distributed under the MIT license, see LICENSE for details.
@@ -35,6 +35,7 @@ class StrUtil
3535
static std::string NumAddPrefix(const std::string& p_Str, const char p_Ch);
3636
static bool NumHasPrefix(const std::string& p_Str, const char p_Ch);
3737
static void ReplaceString(std::string& p_Str, const std::string& p_Search, const std::string& p_Replace);
38+
static void SanitizeMessageStr(std::string& p_Str);
3839
static std::vector<std::string> Split(const std::string& p_Str, char p_Sep);
3940
static bool StartsWith(const std::string& p_String, const std::string& p_Prefix);
4041
static std::string StrFromHex(const std::string& p_String);

src/nchat.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
2-
.TH NCHAT "1" "December 2025" "nchat 5.12.19" "User Commands"
2+
.TH NCHAT "1" "December 2025" "nchat 5.12.20" "User Commands"
33
.SH NAME
44
nchat \- ncurses chat
55
.SH SYNOPSIS

src/uihistoryview.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ void UiHistoryView::Draw()
125125
if (!msg.text.empty())
126126
{
127127
std::string text = msg.text;
128+
StrUtil::SanitizeMessageStr(text);
128129
if (!emojiEnabled)
129130
{
130131
text = StrUtil::Textize(text);

0 commit comments

Comments
 (0)