Skip to content

Commit 31006a3

Browse files
committedJan 23, 2021
fixes #47 - partial fix adding support for file selection dialog to remember last dir
1 parent b2d9301 commit 31006a3

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed
 

‎CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project
22
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
3-
project(nmail VERSION "2.53" LANGUAGES CXX C)
3+
project(nmail VERSION "2.54" LANGUAGES CXX C)
44
include(CheckIncludeFile)
55
set(CMAKE_CXX_STANDARD 11)
66

‎README.md

+5
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ file (platform-dependent defaults are left empty below):
563563
key_toggle_unread=u
564564
markdown_html_compose=0
565565
new_msg_bell=1
566+
persist_file_selection_dir=1
566567
persist_folder_filter=1
567568
persist_search_query=0
568569
plain_text=1
@@ -637,6 +638,10 @@ editing an email (default disabled).
637638

638639
Indicate new messages with terminal bell (default enabled).
639640

641+
### persist_file_selection_dir
642+
643+
Determines whether file selection view shall remember previous directory (default enabled).
644+
640645
### persist_folder_filter
641646

642647
Determines whether to persist move-to-folder list filter (default enabled).

‎src/nmail.1

+1-1
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 NMAIL "1" "January 2021" "nmail v2.53" "User Commands"
2+
.TH NMAIL "1" "January 2021" "nmail v2.54" "User Commands"
33
.SH NAME
44
nmail \- ncurses mail
55
.SH SYNOPSIS

‎src/ui.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void Ui::Init()
5252
{
5353
{ "compose_hardwrap", "0" },
5454
{ "help_enabled", "1" },
55+
{ "persist_file_selection_dir", "1" },
5556
{ "persist_folder_filter", "1" },
5657
{ "persist_search_query", "0" },
5758
{ "plain_text", "1" },
@@ -120,6 +121,7 @@ void Ui::Init()
120121

121122
m_ComposeHardwrap = m_Config.Get("compose_hardwrap") == "1";
122123
m_HelpEnabled = m_Config.Get("help_enabled") == "1";
124+
m_PersistFileSelectionDir = m_Config.Get("persist_file_selection_dir") == "1";
123125
m_PersistFolderFilter = m_Config.Get("persist_folder_filter") == "1";
124126
m_PersistSearchQuery = m_Config.Get("persist_search_query") == "1";
125127
m_Plaintext = m_Config.Get("plain_text") == "1";
@@ -3181,7 +3183,11 @@ void Ui::SetState(Ui::State p_State)
31813183
curs_set(1);
31823184
m_FileListFilterPos = 0;
31833185
m_FileListFilterStr.clear();
3184-
m_CurrentDir = Util::GetCurrentWorkingDir();
3186+
if (m_CurrentDir.empty() || !m_PersistFileSelectionDir)
3187+
{
3188+
m_CurrentDir = Util::GetCurrentWorkingDir();
3189+
}
3190+
31853191
m_Files = Util::ListPaths(m_CurrentDir);
31863192
m_FileListCurrentIndex = 0;
31873193
m_FileListCurrentFile.m_Name = "";

‎src/ui.h

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class Ui
232232
Part m_PartListCurrentPart;
233233

234234
int m_MessageViewLineOffset = 0;
235+
bool m_PersistFileSelectionDir = true;
235236
bool m_PersistFolderFilter = true;
236237
bool m_PersistSearchQuery = false;
237238
bool m_Plaintext = true;

0 commit comments

Comments
 (0)
Please sign in to comment.