From c22b2333002b61e46ce820f42755c6d94b8747ee Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Sat, 25 Sep 2021 13:15:58 -0400 Subject: [PATCH] CmdCalendar: Respect calendar.monthsperline alongside monthsperline --- src/commands/CmdCalendar.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/commands/CmdCalendar.cpp b/src/commands/CmdCalendar.cpp index 4147fd3d7..8bef9a2bd 100644 --- a/src/commands/CmdCalendar.cpp +++ b/src/commands/CmdCalendar.cpp @@ -64,7 +64,14 @@ int CmdCalendar::execute (std::string& output) // Each month requires 28 text columns width. See how many will actually // fit. But if a preference is specified, and it fits, use it. auto width = Context::getContext ().getWidth (); - auto preferredMonthsPerLine = config.getInteger ("monthsperline"); + int preferredMonthsPerLine; + + if (config.has ("calendar.monthsperline")) + preferredMonthsPerLine = config.getInteger ("calendar.monthsperline"); + else + // Legacy configuration variable value + preferredMonthsPerLine = config.getInteger ("monthsperline"); + auto monthsThatFit = width / 26; auto monthsPerLine = monthsThatFit;