Skip to content

Commit

Permalink
fixes #165 - improved config file parsing, trimming spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Jul 13, 2024
1 parent f8e6a2b commit 3315333
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ configure nmail.
This configuration file controls the UI aspects of nmail. Default configuration
file (platform-dependent defaults are left empty below):

attachment_indicator= 📎
attachment_indicator=📎
bottom_reply=0
cancel_without_confirm=0
colors_enabled=1
Expand Down Expand Up @@ -816,8 +816,7 @@ file (platform-dependent defaults are left empty below):
### attachment_indicator

Controls which character to indicate that an email has attachments
(default: ` 📎`). For a more compact and plain layout one can use an ascii
character and omit the leading space character, example: `+`.
(default: `📎`). For a more plain layout one can use an ascii character: `+`.

### bottom_reply

Expand Down
5 changes: 3 additions & 2 deletions src/config.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// config.cpp
//
// Copyright (c) 2019-2021 Kristofer Berggren
// Copyright (c) 2019-2024 Kristofer Berggren
// All rights reserved.
//
// nmail is distributed under the MIT license, see LICENSE for details.
Expand All @@ -15,6 +15,7 @@
#include <sys/stat.h>

#include "loghelp.h"
#include "util.h"

Config::Config()
{
Expand Down Expand Up @@ -57,7 +58,7 @@ void Config::Load(const std::string& p_Path)
std::string value;
std::getline(linestream, value);

m_Map[param] = value;
m_Map[Util::Trim(param)] = Util::Trim(value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/nmail.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NMAIL "1" "July 2024" "nmail 5.1.4" "User Commands"
.TH NMAIL "1" "July 2024" "nmail 5.1.5" "User Commands"
.SH NAME
nmail \- ncurses mail
.SH SYNOPSIS
Expand Down
6 changes: 3 additions & 3 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Ui::Init()
{ "key_search_show_folder", "\\" },
{ "key_spell", "KEY_CTRLS" },
{ "colors_enabled", "1" },
{ "attachment_indicator", " \xF0\x9F\x93\x8E" },
{ "attachment_indicator", "\xF0\x9F\x93\x8E" },
{ "bottom_reply", "0" },
{ "compose_backup_interval", "10" },
{ "persist_sortfilter", "1" },
Expand Down Expand Up @@ -1233,7 +1233,7 @@ void Ui::DrawMessageList()

shortDate = Util::TrimPadString(shortDate, 10);
shortFrom = Util::ToString(Util::TrimPadWString(Util::ToWString(shortFrom), 20));
std::string headerLeft = selectFlag + unreadFlag + attachFlag + " " + shortDate + " " + shortFrom + " ";
std::string headerLeft = selectFlag + unreadFlag + " " + attachFlag + " " + shortDate + " " + shortFrom + " ";
int subjectWidth = m_ScreenWidth - Util::WStringWidth(Util::ToWString(headerLeft)) - 1;
subject = Util::ToString(Util::TrimPadWString(Util::ToWString(subject), subjectWidth));
std::string header = headerLeft + subject + " ";
Expand Down Expand Up @@ -1468,7 +1468,7 @@ void Ui::DrawMessageListSearch()

shortDate = Util::TrimPadString(shortDate, 10);
shortFrom = Util::ToString(Util::TrimPadWString(Util::ToWString(shortFrom), 20));
std::string headerLeft = selectFlag + unreadFlag + attachFlag + " " + shortDate + " " + shortFrom + " ";
std::string headerLeft = selectFlag + unreadFlag + " " + attachFlag + " " + shortDate + " " + shortFrom + " ";

std::string folderTag = m_SearchShowFolder ? (" [" + Util::BaseName(folder) + "]") : "";
int subjectWidth = m_ScreenWidth - Util::WStringWidth(Util::ToWString(headerLeft + folderTag)) - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "version.h"

#define NMAIL_VERSION "5.1.4"
#define NMAIL_VERSION "5.1.5"

std::string Version::GetBuildOs()
{
Expand Down

0 comments on commit 3315333

Please sign in to comment.