Permalink
Browse files

Merge with Far 3.0.2784.

  • Loading branch information...
1 parent ad48e24 commit 68856e485af21481b35bd571c71b03602932b423 @shmuz committed Aug 1, 2012
View
@@ -1,3 +1,25 @@
+w17 31.07.2012 13:43:58 +0400 - build 2784
+
+1. FileList fix
+ �������������� ���� ��������, ������������ ������ ���������� ��������� ��� ����������.
+
+w17 30.07.2012 22:12:25 +0400 - build 2783
+
+1. VMENU_WRAPMODE ����� ������������ ��� DI_LISTBOX
+ ���� ���� ���� - wrap-stop, ����� wrap-���:)
+
+w17 29.07.2012 13:54:09 +0400 - build 2782
+
+1. M#2139: inconsistent error message when trying to create a file with same name as existing directory
+
+w17 28.07.2012 22:39:24 +0400 - build 2781
+
+1. ����� 2754
+
+w17 28.07.2012 19:35:45 +0400 - build 2780
+
+1. �� �������� ��� 2766
+
w17 25.07.2012 17:59:51 +0400 - build 2779
1. M#2138 �� �������� Shift-F1 ��� ����� ����������
@@ -12001,7 +12001,7 @@ MMenuOwnersView
"Vlastníci s&úboru LCtrl-8"
MMenuLinksView
-"Свя&зи файлов LCtrl-9"
+"Ссылки файлов LCtrl-9"
"File lin&ks LCtrl-9"
"Souborové lin&ky LCtrl-9"
"Dateilin&ks LStrg-9"
@@ -16677,7 +16677,7 @@ MEditPanelModesOwners
"Mód vlastníkov s&úborov"
MEditPanelModesLinks
-"Свя&зи файлов"
+"Ссылки файлов"
"Lin&ks mode"
"Lin&kový mód"
"Dateilin&ks"
View
@@ -189,7 +189,7 @@ bool FindNextFileInternal(HANDLE Find, FAR_FIND_DATA_EX& FindData)
{
bool Result = false;
PSEUDO_HANDLE* Handle = static_cast<PSEUDO_HANDLE*>(Find);
- bool Status = true;
+ bool Status = true, set_errcode = true;
PFILE_ID_BOTH_DIR_INFORMATION DirectoryInfo = static_cast<PFILE_ID_BOTH_DIR_INFORMATION>(Handle->BufferBase);
if(Handle->NextOffset)
{
@@ -213,6 +213,7 @@ bool FindNextFileInternal(HANDLE Find, FAR_FIND_DATA_EX& FindData)
{
File* Directory = static_cast<File*>(Handle->ObjectHandle);
Status = Directory->NtQueryDirectoryFile(Handle->BufferBase, Handle->BufferSize, Handle->Extended? FileIdBothDirectoryInformation : FileBothDirectoryInformation, FALSE, nullptr, FALSE);
+ set_errcode = false;
}
}
}
@@ -260,6 +261,10 @@ bool FindNextFileInternal(HANDLE Find, FAR_FIND_DATA_EX& FindData)
Handle->NextOffset = DirectoryInfo->NextEntryOffset?Handle->NextOffset+DirectoryInfo->NextEntryOffset:0;
Result = true;
}
+
+ if (set_errcode)
+ SetLastError(Result ? ERROR_SUCCESS : ERROR_NO_MORE_FILES);
+
return Result;
}
@@ -696,9 +701,13 @@ BOOL apiCopyFileEx(
strTo += PointToName(strFrom);
}
BOOL Result = CopyFileEx(strFrom, strTo, lpProgressRoutine, lpData, pbCancel, dwCopyFlags);
- if(!Result && ElevationRequired(ELEVATION_MODIFY_REQUEST)) //BUGBUG, really unknown
+ if(!Result)
{
- Result = Elevation.fCopyFileEx(strFrom, strTo, lpProgressRoutine, lpData, pbCancel, dwCopyFlags);
+ if (STATUS_FILE_IS_A_DIRECTORY == GetLastNtStatus())
+ SetLastError(ERROR_FILE_EXISTS);
+
+ else if (ElevationRequired(ELEVATION_MODIFY_REQUEST)) //BUGBUG, really unknown
+ Result = Elevation.fCopyFileEx(strFrom, strTo, lpProgressRoutine, lpData, pbCancel, dwCopyFlags);
}
return Result;
}
@@ -733,9 +742,16 @@ BOOL apiMoveFileEx(
strTo += PointToName(strFrom);
}
BOOL Result = MoveFileEx(strFrom, strTo, dwFlags);
- if(!Result && ElevationRequired(ELEVATION_MODIFY_REQUEST)) //BUGBUG, really unknown
+ if(!Result)
{
- Result = Elevation.fMoveFileEx(strFrom, strTo, dwFlags);
+ DWORD f = apiGetFileAttributes(strFrom);
+ DWORD t = apiGetFileAttributes(strTo);
+
+ if (f!=INVALID_FILE_ATTRIBUTES && t!=INVALID_FILE_ATTRIBUTES && 0==(f & FILE_ATTRIBUTE_DIRECTORY) && 0!=(t & FILE_ATTRIBUTE_DIRECTORY))
+ SetLastError(ERROR_FILE_EXISTS);
+
+ else if (ElevationRequired(ELEVATION_MODIFY_REQUEST)) //BUGBUG, really unknown
+ Result = Elevation.fMoveFileEx(strFrom, strTo, dwFlags);
}
return Result;
}
View
@@ -121,7 +121,7 @@ FileList::FileList():
LastCurFile(-1),
ReturnCurrentFile(FALSE),
SelFileCount(0),
- GetSelPosition(0),
+ GetSelPosition(0), LastSelPosition(-1),
TotalFileCount(0),
SelFileSize(0),
TotalFileSize(0),
@@ -132,12 +132,15 @@ FileList::FileList():
ShiftSelection(-1),
MouseSelection(0),
SelectedFirst(0),
+ IsEmpty(TRUE),
AccessTimeUpdateRequired(FALSE),
UpdateRequired(FALSE),
+ UpdateRequiredMode(0),
UpdateDisabled(0),
+ SortGroupsRead(FALSE),
InternalProcessKey(FALSE),
- CacheSelIndex(-1),
- CacheSelClearIndex(-1)
+ CacheSelIndex(-1), CacheSelPos(0),
+ CacheSelClearIndex(-1), CacheSelClearPos(0)
{
_OT(SysLog(L"[%p] FileList::FileList()", this));
{
View
@@ -471,8 +471,15 @@ void FileList::ReadFileNames(int KeepSelection, int IgnoreVisible, int DrawMessa
InitFSWatcher(false);
CorrectPosition();
+ string strLastSel, strGetSel;
+
if (KeepSelection || PrevSelFileCount>0)
{
+ if (LastSelPosition >= 0 && LastSelPosition < OldFileCount)
+ strLastSel = OldData[LastSelPosition]->strName;
+ if (GetSelPosition >= 0 && GetSelPosition < OldFileCount)
+ strGetSel = OldData[GetSelPosition]->strName;
+
MoveSelection(ListData,FileCount,OldData,OldFileCount);
DeleteListData(OldData,OldFileCount);
}
@@ -488,6 +495,11 @@ void FileList::ReadFileNames(int KeepSelection, int IgnoreVisible, int DrawMessa
SortFileList(FALSE);
+ if (!strLastSel.IsEmpty())
+ LastSelPosition = FindFile(strLastSel, FALSE);
+ if (!strGetSel.IsEmpty())
+ GetSelPosition = FindFile(strGetSel, FALSE);
+
if (CurFile>=FileCount || StrCmpI(ListData[CurFile]->strName,strCurName))
if (!GoToFile(strCurName) && !strNextCurName.IsEmpty())
GoToFile(strNextCurName);
@@ -814,8 +826,15 @@ void FileList::UpdatePlugin(int KeepSelection, int IgnoreVisible)
CorrectPosition();
CtrlObject->Plugins->FreeFindData(hPlugin,PanelData,PluginFileCount);
+ string strLastSel, strGetSel;
+
if (KeepSelection || PrevSelFileCount>0)
{
+ if (LastSelPosition >= 0 && LastSelPosition < OldFileCount)
+ strLastSel = OldData[LastSelPosition]->strName;
+ if (GetSelPosition >= 0 && GetSelPosition < OldFileCount)
+ strGetSel = OldData[GetSelPosition]->strName;
+
MoveSelection(ListData,FileCount,OldData,OldFileCount);
DeleteListData(OldData,OldFileCount);
}
@@ -828,6 +847,11 @@ void FileList::UpdatePlugin(int KeepSelection, int IgnoreVisible)
SortFileList(FALSE);
+ if (!strLastSel.IsEmpty())
+ LastSelPosition = FindFile(strLastSel, FALSE);
+ if (!strGetSel.IsEmpty())
+ GetSelPosition = FindFile(strGetSel, FALSE);
+
if (CurFile>=FileCount || StrCmpI(ListData[CurFile]->strName,strCurName))
if (!GoToFile(strCurName) && !strNextCurName.IsEmpty())
GoToFile(strNextCurName);
View
@@ -1 +1 @@
-m4_define(BUILD,2779)m4_dnl
+m4_define(BUILD,2784)m4_dnl
View
@@ -241,30 +241,30 @@ int VMenu::SetSelectPos(int Pos, int Direct, bool stop_on_edge)
{
if (Pos<0)
{
- //if (CheckFlags(VMENU_WRAPMODE))
+ if (CheckFlags(VMENU_WRAPMODE))
{
Pos = ItemCount-1;
}
- //else
- //{
- // Pos = 0;
- // TopPos = 0;
- // Pass++;
- //}
+ else
+ {
+ Pos = 0;
+ TopPos = 0;
+ Pass++;
+ }
}
if (Pos>=ItemCount)
{
- //if (CheckFlags(VMENU_WRAPMODE))
+ if (CheckFlags(VMENU_WRAPMODE))
{
Pos = 0;
TopPos = 0;
}
- //else
- //{
- // Pos = ItemCount-1;
- // Pass++;
- //}
+ else
+ {
+ Pos = ItemCount-1;
+ Pass++;
+ }
}
if (ItemCanHaveFocus(Item[Pos]->Flags))
@@ -279,8 +279,7 @@ int VMenu::SetSelectPos(int Pos, int Direct, bool stop_on_edge)
Pass++;
}
- // wrap-stop for all lists (not only VMENU_WRAPMODE)
- if (stop_on_edge && /*CheckFlags(VMENU_WRAPMODE) &&*/ ((Direct>0 && Pos<SelectPos) || (Direct<0 && Pos>SelectPos)))
+ if (stop_on_edge && CheckFlags(VMENU_WRAPMODE) && ((Direct>0 && Pos<SelectPos) || (Direct<0 && Pos>SelectPos)))
return SelectPos;
UpdateItemFlags(Pos, Item[Pos]->Flags|LIF_SELECTED);
@@ -295,7 +294,8 @@ int VMenu::SetSelectPos(FarListPos *ListPos, int Direct)
{
CriticalSectionLock Lock(CS);
- int Ret = SetSelectPos(ListPos->SelectPos,Direct ? Direct : ListPos->SelectPos > SelectPos? 1 : -1);
+ int pos = Min(ItemCount-1, Max(0, ListPos->SelectPos));
+ int Ret = SetSelectPos(pos, Direct ? Direct : pos > SelectPos? 1 : -1);
if (Ret >= 0)
{

0 comments on commit 68856e4

Please sign in to comment.