From 9c247a262b9fae58b7c6b286b557322017dfa1b7 Mon Sep 17 00:00:00 2001 From: Alex Alabuzhev Date: Wed, 10 May 2017 23:07:59 +0000 Subject: [PATCH] #3433 & minor --- far/changelog | 6 ++++ far/common/preprocessor.hpp | 2 +- far/execute.cpp | 10 ++++++ far/filelist.cpp | 62 +++++++++++++++++-------------------- far/main.cpp | 4 +-- far/vbuild.m4 | 2 +- 6 files changed, 49 insertions(+), 37 deletions(-) diff --git a/far/changelog b/far/changelog index a5707ca682..0759130beb 100644 --- a/far/changelog +++ b/far/changelog @@ -1,3 +1,9 @@ +drkns 11.05.2017 00:06:47 +0000 - build 4956 + +1. 0003433: Если выполненная программа поменяла заголовок консоли, Far его не восстановит + +2. Пара мелочей. + drkns 09.05.2017 22:40:36 +0000 - build 4955 1. Уточнение 4950 - падало на сообщениях без строк. diff --git a/far/common/preprocessor.hpp b/far/common/preprocessor.hpp index 16cb85f14d..ca8e1566ad 100644 --- a/far/common/preprocessor.hpp +++ b/far/common/preprocessor.hpp @@ -96,7 +96,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define NONCOPYABLE(Type) \ Type(const Type&) = delete; \ -Type& operator=(const Type&) = delete; \ +Type& operator=(const Type&) = delete; #define COPY_AND_MOVE(...) \ auto& operator=(__VA_ARGS__ rhs) { return *this = std::remove_reference_t(rhs); } diff --git a/far/execute.cpp b/far/execute.cpp index ee1334a561..a51fc11a46 100644 --- a/far/execute.cpp +++ b/far/execute.cpp @@ -52,6 +52,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "string_utils.hpp" #include "cvtname.hpp" #include "RegExp.hpp" +#include "scrbuf.hpp" enum class image_type { @@ -1019,6 +1020,15 @@ void Execute(execute_info& Info, bool FolderRun, bool Silent, const std::functio вследствие своей оптимизации, которая в данном случае выходит боком. */ SetCursorType(Visible, CursorSize); + + { + // Could be changed by external program + const auto CurrentTitle = Global->ScrBuf->GetTitle(); + // Invalidate cache: + Global->ScrBuf->SetTitle({}); + Global->ScrBuf->SetTitle(CurrentTitle); + } + CONSOLE_CURSOR_INFO cci = { CursorSize, Visible }; Console().SetCursorInfo(cci); diff --git a/far/filelist.cpp b/far/filelist.cpp index b1273c1a5a..3d999e999a 100644 --- a/far/filelist.cpp +++ b/far/filelist.cpp @@ -513,7 +513,11 @@ class list_less if (ListSelectedFirst && Item1.Selected != Item2.Selected) return Item1.Selected > Item2.Selected; - if (ListSortGroups && Item1.SortGroup != Item2.SortGroup) + if (ListSortGroups && + // Controversial decision. Configuration? + // (ListSortMode == panel_sort::BY_NAME || ListSortMode == panel_sort::BY_EXT || ListSortMode == panel_sort::BY_FULLNAME) && + Item1.SortGroup != Item2.SortGroup + ) return Item1.SortGroup < Item2.SortGroup; // Reverse sorting is taken into account from this point @@ -7372,8 +7376,6 @@ void FileList::FillParentPoint(FileListItem& Item, size_t CurFilePos, const FILE // flshow.cpp // Файловая панель - вывод на экран -static wchar_t OutCharacter[8]={}; - void FileList::UpdateHeight() { m_Height = m_Y2 - m_Y1 - 1 - (Global->Opt->ShowColumnTitles? 1 : 0) - (Global->Opt->ShowPanelStatus? 2 : 0); @@ -7545,7 +7547,8 @@ void FileList::ShowFileList(bool Fast) if (Global->Opt->ShowSortMode) { - const wchar_t *Ch = nullptr; + wchar_t Indicator = 0; + if (m_SortMode < panel_sort::COUNT) { static const std::pair ModeNames[] = @@ -7569,10 +7572,17 @@ void FileList::ShowFileList(bool Fast) }; static_assert(std::size(ModeNames) == static_cast(panel_sort::COUNT)); - Ch = wcschr(msg(std::find_if(CONST_RANGE(ModeNames, i) { return i.first == m_SortMode; })->second).data(), L'&'); + if (const auto Ptr = wcschr(msg(std::find_if(CONST_RANGE(ModeNames, i) { return i.first == m_SortMode; })->second).data(), L'&')) + { + Indicator = m_ReverseSortOrder? upper(Ptr[1]) : lower(Ptr[1]); + } + } + else + { + Indicator = m_ReverseSortOrder? CustomSortIndicator[1] : CustomSortIndicator[0]; } - if (Ch || m_SortMode >= panel_sort::COUNT) + if (Indicator) { if (Global->Opt->ShowColumnTitles) GotoXY(NextX1,m_Y1+1); @@ -7580,18 +7590,12 @@ void FileList::ShowFileList(bool Fast) GotoXY(NextX1,m_Y1); SetColor(COL_PANELCOLUMNTITLE); - if (Ch) - OutCharacter[0] = m_ReverseSortOrder? upper(Ch[1]) : lower(Ch[1]); - else - OutCharacter[0] = m_ReverseSortOrder? CustomSortIndicator[1] : CustomSortIndicator[0]; - - Text(OutCharacter); + Text({ Indicator }); NextX1++; if (m_Filter && m_Filter->IsEnabledOnPanel()) { - OutCharacter[0]=L'*'; - Text(OutCharacter); + Text(L"*"s); NextX1++; } } @@ -7606,27 +7610,21 @@ void FileList::ShowFileList(bool Fast) GotoXY(NextX1,m_Y1); SetColor(COL_PANELCOLUMNTITLE); - wchar_t *PtrOutCharacter=OutCharacter; - *PtrOutCharacter=0; + string Indicators; + //if (GetSelectedFirstMode()) - *PtrOutCharacter++=L'^'; + Indicators.push_back(L'^'); /* - if(GetNumericSort()) - *PtrOutCharacter++=L'#'; - if(GetSortGroups()) - *PtrOutCharacter++=L'@'; - */ - /* + if(GetNumericSort()) + Indicators.push_back(L'#'); + if(GetSortGroups()) + Indicators.push_back(L'@'); if(GetCaseSensitiveSort()) - { - - } + Indicators.push_back(L'\'); */ - *PtrOutCharacter=0; - Text(OutCharacter); - PtrOutCharacter[1]=0; + Text(Indicators); } /* */ @@ -8348,13 +8346,11 @@ void FileList::ShowList(int ShowStatus,int StartColumn) if (Global->Opt->Highlight && m_ListData[ListPos].Colors && m_ListData[ListPos].Colors->Mark.Char && Width>1) { Width--; - OutCharacter[0] = m_ListData[ListPos].Colors->Mark.Char; - FarColor OldColor=GetColor(); - + const auto OldColor = GetColor(); if (!ShowStatus) SetShowColor(ListPos, false); - Text(OutCharacter); + Text({ m_ListData[ListPos].Colors->Mark.Char }); SetColor(OldColor); } diff --git a/far/main.cpp b/far/main.cpp index e2c05f3ddf..4c345b4cd9 100644 --- a/far/main.cpp +++ b/far/main.cpp @@ -482,7 +482,7 @@ static int mainImpl(const range& Args) SCOPED_ACTION(global); - auto NoElevetionDuringBoot = std::make_unique(); + auto NoElevationDuringBoot = std::make_unique(); SetErrorMode(Global->ErrorMode); @@ -786,7 +786,7 @@ static int mainImpl(const range& Args) Global->CtrlObject = new ControlObject; - NoElevetionDuringBoot.reset(); + NoElevationDuringBoot.reset(); try { diff --git a/far/vbuild.m4 b/far/vbuild.m4 index e6fa63e852..4b922ee6a7 100644 --- a/far/vbuild.m4 +++ b/far/vbuild.m4 @@ -1 +1 @@ -m4_define(BUILD,4955)m4_dnl +m4_define(BUILD,4956)m4_dnl