Skip to content

Commit

Permalink
#3433 & minor
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed May 10, 2017
1 parent 9d5fc9f commit 9c247a2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 37 deletions.
6 changes: 6 additions & 0 deletions 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 - падало на сообщениях без строк.
Expand Down
2 changes: 1 addition & 1 deletion far/common/preprocessor.hpp
Expand Up @@ -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<decltype(*this)>(rhs); }
Expand Down
10 changes: 10 additions & 0 deletions far/execute.cpp
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);

Expand Down
62 changes: 29 additions & 33 deletions far/filelist.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<panel_sort, lng> ModeNames[] =
Expand All @@ -7569,29 +7572,30 @@ void FileList::ShowFileList(bool Fast)
};
static_assert(std::size(ModeNames) == static_cast<size_t>(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);
else
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++;
}
}
Expand All @@ -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);
}

/* </режимы сортировки> */
Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions far/main.cpp
Expand Up @@ -482,7 +482,7 @@ static int mainImpl(const range<wchar_t**>& Args)

SCOPED_ACTION(global);

auto NoElevetionDuringBoot = std::make_unique<elevation::suppress>();
auto NoElevationDuringBoot = std::make_unique<elevation::suppress>();

SetErrorMode(Global->ErrorMode);

Expand Down Expand Up @@ -786,7 +786,7 @@ static int mainImpl(const range<wchar_t**>& Args)

Global->CtrlObject = new ControlObject;

NoElevetionDuringBoot.reset();
NoElevationDuringBoot.reset();

try
{
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4955)m4_dnl
m4_define(BUILD,4956)m4_dnl

0 comments on commit 9c247a2

Please sign in to comment.