Skip to content

Commit

Permalink
Merge branch 'elfmz:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft committed Jul 14, 2024
2 parents 1246a79 + d462934 commit ead8d89
Show file tree
Hide file tree
Showing 15 changed files with 99 additions and 73 deletions.
4 changes: 4 additions & 0 deletions NetRocks/configs/plug/bel.lng
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"Уключыць апавяшчэнні працоўнага стала"
"<&ENTER> выконвае файлы на серверы, калі гэтае магчыма"
"Разумнае капіяванне сімвалічных &спасылак"
"Выкарыстоўваць &chmod:"
"Аўтаматычна"
"Заўсёды (ігнараваць umask)"
"Ніколі"
"Капіяваць атрыбуты, якія супярэчаць &umask"
"Запамінаць працоўны каталог у наладах сайта"
"Таймаўт неўжываемых злучэнняў (сек.):"
Expand Down
5 changes: 4 additions & 1 deletion NetRocks/configs/plug/eng.lng
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"Enable desktop &notifications"
"<&ENTER> to execute files remotely when possible"
"Smart &symlinks copying"
"Copy attributes that override &umask"
"Use of &chmod:"
"Automatic"
"Always (umask override)"
"Never"
"Remember working &directory in site settings"
"Connections pool e&xpiration (seconds):"

Expand Down
2 changes: 1 addition & 1 deletion NetRocks/configs/plug/helpe.hlf
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $^#Configuration menu#
#Enable desktop notifications# this options controls if NetRocks will use desktop environment notifications on operation completions or errors. Note that behavior of this notifications partially controlled by FAR.
#<ENTER> to execute files remotely when possible# if enabled then pressing <ENTER> on remote executable file will execute it remotely instead of download and run locally. Note that this option only works for protocols that support it (like SFTP/SCP) and doesn't affect non-executable files, like documents, - they will be still downloaded and opened locally.
#Smart symlinks copying# if (by default) enabled then NetRocks will translate symlinks paths to refer file that copied in same copy operation, or, if symlinks refer file that is not being copied - then such symlink will be converted to plain file. If disabled then NetRocks will just copy symlinks as is, without any efforts to ensure their validity in the new location.
#Copy attributes that override umask# enable this options if want to have copied files modes to be exactly same as on source files, even in target system umask prevents some mode bits from being set.
#Use of chmod# change this options if want to have copied files modes to be exactly same as on source files, even in target system umask prevents some mode bits from being set. Or if you want to disable using of chmod at all - for example to avoid other inherited ACLs from being overriden by it.
#Connections pool expiration# when exiting from some remote FS navigation NetRocks will keep actual connection active for specified amount of time and if same server connection will be established before expiration - it will use preserved connection instead of establishing new.

~Contents~@Contents@
Expand Down
5 changes: 4 additions & 1 deletion NetRocks/configs/plug/rus.lng
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"Включить уведомления рабочего стола"
"<&ENTER> исполняет файлы на сервере если возможно"
"Умное копирование символических &ссылок"
"Копировать атрибуты противоречащие &umask"
"Использовать &chmod:"
"Автоматически"
"Всегда (игнорировать umask)"
"Никогда"
"Запоминать рабочий каталог в настройках сайта"
"Таймаут неиспользуемых соединений (сек.):"

Expand Down
16 changes: 12 additions & 4 deletions NetRocks/src/Op/OpXfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OpXfer::OpXfer(int op_mode, std::shared_ptr<IHost> &base_host, const std::string
_direction(direction),
_io_buf(BUFFER_SIZE_INITIAL, BUFFER_SIZE_GRANULARITY, BUFFER_SIZE_LIMIT),
_smart_symlinks_copy(G.GetGlobalConfigBool("SmartSymlinksCopy", true)),
_umask_override(G.GetGlobalConfigBool("UMaskOverride", false))
_use_of_chmod(G.GetGlobalConfigInt("UseOfChmod", 0))
{

_enumer = std::make_shared<Enumer>(_entries, _base_host, _base_dir, items, items_count, true, _state, _wea_state);
Expand Down Expand Up @@ -451,10 +451,18 @@ void OpXfer::CopyAttributes(const std::string &path_dst, const FileInformation &
}
);

if (!_umask_override && ( (info.mode | EXTRA_NEEDED_MODE) == info.mode)) {
return;
switch (_use_of_chmod) {
case 0: // auto
if ( (info.mode | EXTRA_NEEDED_MODE) == info.mode) {
return;
}
break;
case 1: // always
break;
case 2: // never
return;
}

fprintf(stderr, "!!!! copy mode !!!\n");
WhatOnErrorWrap<WEK_CHMODE>(_wea_state, _state, _dst_host.get(), path_dst,
[&] () mutable
{
Expand Down
2 changes: 1 addition & 1 deletion NetRocks/src/Op/OpXfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class OpXfer : protected OpBase, public IBackgroundTask
XferDirection _direction;
IOBuffer _io_buf;
bool _smart_symlinks_copy;
bool _umask_override;
bool _on_site_move = false;
int _use_of_chmod;

virtual void Process();

Expand Down
8 changes: 5 additions & 3 deletions NetRocks/src/PluginImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,15 @@ void PluginImpl::GetOpenPluginInfo(struct OpenPluginInfo *Info)
}
else {
// for site connections list don't use current far2l panel modes
// - always only 1 column (name) without dependence on panel Align file extensions
// - only name column(s) without dependence on panel Align file extensions
static struct PanelMode PanelModesArray[10] = {
{ .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N,N,N", .ColumnWidths = L"0,0,0" },
{ .ColumnTypes = L"N,N", .ColumnWidths = L"0,0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" }, { .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" }, { .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" }, { .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" }, { .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" }, { .ColumnTypes = L"N", .ColumnWidths = L"0" },
{ .ColumnTypes = L"N", .ColumnWidths = L"0" },
};
Info->PanelModesArray = PanelModesArray;
Info->PanelModesNumber = ARRAYSIZE(PanelModesArray);
Expand Down
18 changes: 13 additions & 5 deletions NetRocks/src/UI/Settings/ConfigurePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| [x] Enable desktop notifications |
| [x] <ENTER> to execute files remotely when possible |
| [x] Smart symlinks copying |
| [ ] Copy attributes that overrides umask |
| Use of chmod: [COMBOBOX ] |
| [ ] Remember working directory in site settings |
| Connections pool expiration (seconds): [ ] |
|------------------------------------------------------------|
Expand Down Expand Up @@ -57,15 +57,21 @@ class ConfigurePlugin : protected BaseDialog
int _i_enable_desktop_notifications = -1;
int _i_enter_exec_remotely = -1;
int _i_smart_symlinks_copy = -1;
int _i_umask_override = -1;
int _i_use_of_chmod = -1;
int _i_remember_directory = -1;
int _i_conn_pool_expiration = -1;

int _i_ok = -1, _i_cancel = -1;

FarListWrapper _di_use_of_chmod;

public:
ConfigurePlugin()
{
_di_use_of_chmod.Add(MUseOfChmod_Auto);
_di_use_of_chmod.Add(MUseOfChmod_Always);
_di_use_of_chmod.Add(MUseOfChmod_Never);

_di.SetBoxTitleItem(MPluginOptionsTitle);

_di.SetLine(2);
Expand All @@ -78,7 +84,9 @@ class ConfigurePlugin : protected BaseDialog
_i_smart_symlinks_copy = _di.AddAtLine(DI_CHECKBOX, 5,62, 0, MSmartSymlinksCopy);

_di.NextLine();
_i_umask_override = _di.AddAtLine(DI_CHECKBOX, 5,62, 0, MUMaskOverride);
_di.AddAtLine(DI_TEXT, 5,37, 0, MUseOfChmod);
_i_use_of_chmod = _di.AddAtLine(DI_COMBOBOX, 38,62, DIF_DROPDOWNLIST | DIF_LISTAUTOHIGHLIGHT | DIF_LISTNOAMPERSAND, "");
_di[_i_use_of_chmod].ListItems = _di_use_of_chmod.Get();

_di.NextLine();
_i_remember_directory = _di.AddAtLine(DI_CHECKBOX, 5,62, 0, MRememberDirectory);
Expand All @@ -105,7 +113,7 @@ class ConfigurePlugin : protected BaseDialog
SetCheckedDialogControl( _i_enable_desktop_notifications, G.GetGlobalConfigBool("EnableDesktopNotifications", true) );
SetCheckedDialogControl( _i_enter_exec_remotely, G.GetGlobalConfigBool("EnterExecRemotely", true) );
SetCheckedDialogControl( _i_smart_symlinks_copy, G.GetGlobalConfigBool("SmartSymlinksCopy", true) );
SetCheckedDialogControl( _i_umask_override, G.GetGlobalConfigBool("UMaskOverride", false) );
SetDialogListPosition( _i_use_of_chmod, G.GetGlobalConfigInt("UseOfChmod", 0) );
SetCheckedDialogControl( _i_remember_directory, G.GetGlobalConfigBool("RememberDirectory", false) );
LongLongToDialogControl( _i_conn_pool_expiration, G.GetGlobalConfigInt("ConnectionsPoolExpiration", 30) );

Expand All @@ -114,7 +122,7 @@ class ConfigurePlugin : protected BaseDialog
gcw.SetBool("EnableDesktopNotifications", IsCheckedDialogControl(_i_enable_desktop_notifications) );
gcw.SetBool("EnterExecRemotely", IsCheckedDialogControl(_i_enter_exec_remotely) );
gcw.SetBool("SmartSymlinksCopy", IsCheckedDialogControl(_i_smart_symlinks_copy) );
gcw.SetBool("UMaskOverride", IsCheckedDialogControl(_i_umask_override) );
gcw.SetInt("UseOfChmod", GetDialogListPosition(_i_use_of_chmod));
gcw.SetBool("RememberDirectory", IsCheckedDialogControl(_i_remember_directory) );
gcw.SetInt("ConnectionsPoolExpiration", LongLongFromDialogControl( _i_conn_pool_expiration) );
}
Expand Down
5 changes: 4 additions & 1 deletion NetRocks/src/lng.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ enum LanguageID
MEnableDesktopNotifications,
MEnterExecRemotely,
MSmartSymlinksCopy,
MUMaskOverride,
MUseOfChmod,
MUseOfChmod_Auto,
MUseOfChmod_Always,
MUseOfChmod_Never,
MRememberDirectory,
MConnPoolExpiration,

Expand Down
2 changes: 1 addition & 1 deletion WinPort/src/APIFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ template <class CHAR_T>
{
DWORD rv = 0;
switch (unix_mode & S_IFMT) {
case 0: case S_IFREG: rv = FILE_ATTRIBUTE_ARCHIVE; break;
case S_IFDIR: rv = FILE_ATTRIBUTE_DIRECTORY; break;
case S_IFREG: rv = FILE_ATTRIBUTE_ARCHIVE; break;
#ifndef _WIN32
case S_IFLNK: rv = FILE_ATTRIBUTE_REPARSE_POINT; break;
case S_IFSOCK: rv = FILE_ATTRIBUTE_DEVICE_SOCK; break;
Expand Down
33 changes: 19 additions & 14 deletions colorer/src/pcolorer2/FarEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,11 +552,11 @@ int FarEditor::editorEvent(int event, void* param)
int llen = egs.StringLength;

// fills back
if (lno == ei.CurLine && showHorizontalCross) {
addFARColor(lno, 0, 0, horzCrossColor); // ei.LeftPos + ei.WindowSizeX
if (lno == ei.CurLine && showHorizontalCross){
addFARColor(lno, 0, ei.LeftPos + ei.WindowSizeX, horzCrossColor);
}
else {
addFARColor(lno, 0, 0, convert(nullptr)); // ei.LeftPos + ei.WindowSizeX
else{
addFARColor(lno, 0, ei.LeftPos + ei.WindowSizeX, convert(nullptr));
}

if (showVerticalCross) {
Expand Down Expand Up @@ -615,8 +615,11 @@ int FarEditor::editorEvent(int event, void* param)
//
int lend = l1->end;

if (lend == -1) {
lend = fullBackground ? 0 : llen; // ei.LeftPos+ei.WindowSizeX
if (lend == -1){
if (fullBackground) {
addFARColor(lno, llen, ei.LeftPos+ei.WindowSizeX * 2, col, false);
}
lend = llen;
}

addFARColor(lno, l1->start, lend, col);
Expand Down Expand Up @@ -1302,7 +1305,7 @@ bool FarEditor::backDefault(color col)
return col.cbk == rdBackground->back;
}

void FarEditor::addFARColor(int lno, int s, int e, color col)
void FarEditor::addFARColor(int lno, int s, int e, color col, bool add_style)
{
if (TrueMod) {
EditorTrueColor ec {};
Expand Down Expand Up @@ -1341,11 +1344,13 @@ void FarEditor::addFARColor(int lno, int s, int e, color col)
{
ec.Base.Color = BACKGROUND_INTENSITY;
}
if (col.style & StyledRegion::RD_UNDERLINE) {
ec.Base.Color |= COMMON_LVB_UNDERSCORE;
}
if (col.style & StyledRegion::RD_STRIKEOUT) {
ec.Base.Color |= COMMON_LVB_STRIKEOUT;
if (add_style) {
if (col.style & StyledRegion::RD_UNDERLINE) {
ec.Base.Color |= COMMON_LVB_UNDERSCORE;
}
if (col.style & StyledRegion::RD_STRIKEOUT) {
ec.Base.Color |= COMMON_LVB_STRIKEOUT;
}
}
}

Expand All @@ -1370,8 +1375,8 @@ void FarEditor::cleanEditor()
{
color col;
enterHandler();
for (int i = 0; i < ei.TotalLines; i++) {
addFARColor(i, -1, 0, col);
for (int i=0; i<ei.TotalLines; i++){
addFARColor(i, -1,0, col);
}
}

Expand Down
2 changes: 1 addition & 1 deletion colorer/src/pcolorer2/FarEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class FarEditor : public LineSource
bool foreDefault(color col);
bool backDefault(color col);
void showOutliner(Outliner* outliner);
void addFARColor(int lno, int s, int e, color col);
void addFARColor(int lno, int s, int e, color col, bool add_style = true);
const wchar_t* GetMsg(int msg);
};
#endif
Expand Down
3 changes: 3 additions & 0 deletions colorer/src/pcolorer2/pcolorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ SHAREDSYMBOL void WINAPI SetStartupInfoW(const struct PluginStartupInfo* fei)
Info = *fei;
FSF = *fei->FSF;
Info.FSF = &FSF;

editorSet = nullptr;
inEventProcess = false;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion far2l/far2sdk/farplug-wide.h
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ struct EditorColor
int StringNumber;
int ColorItem;
int StartPos;
int EndPos; // -1 means edge of visible screen part, otherwise wanted edge position
int EndPos;
int Color;
};

Expand Down
65 changes: 26 additions & 39 deletions far2l/src/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,34 +332,6 @@ void Editor::ShowEditor(int CurLineOnly)
}
}

if (!CurLineOnly) {
LeftPos = CurLine->GetLeftPos();
#if 0

// крайне эксперементальный кусок!
if (CurPos+LeftPos < XX2)
LeftPos=0;
else if (CurLine->X2 < XX2)
LeftPos=CurLine->GetLength()-CurPos;

if (LeftPos < 0)
LeftPos=0;

#endif

for (CurPtr = TopScreen, Y = Y1; Y <= Y2; Y++)
if (CurPtr) {
CurPtr->SetEditBeyondEnd(TRUE);
CurPtr->SetPosition(X1, Y, XX2, Y);
// CurPtr->SetTables(UseDecodeTable ? &TableSet:nullptr);
//_D(SysLog(L"Setleftpos 3 to %i",LeftPos));
CurPtr->SetLeftPos(LeftPos);
CurPtr->SetCellCurPos(CurPos);
CurPtr->SetEditBeyondEnd(EdOpt.CursorBeyondEOL);
CurPtr = CurPtr->m_next;
}
}

if (!Pasting) {
/*
$ 10.08.2000 skv
Expand Down Expand Up @@ -396,9 +368,30 @@ void Editor::ShowEditor(int CurLineOnly)
DrawScrollbar();

if (!CurLineOnly) {
LeftPos = CurLine->GetLeftPos();
#if 0

// крайне эксперементальный кусок!
if (CurPos+LeftPos < XX2)
LeftPos=0;
else if (CurLine->X2 < XX2)
LeftPos=CurLine->GetLength()-CurPos;

if (LeftPos < 0)
LeftPos=0;

#endif

for (CurPtr = TopScreen, Y = Y1; Y <= Y2; Y++)
if (CurPtr) {
CurPtr->SetEditBeyondEnd(TRUE);
CurPtr->SetPosition(X1, Y, XX2, Y);
// CurPtr->SetTables(UseDecodeTable ? &TableSet:nullptr);
//_D(SysLog(L"Setleftpos 3 to %i",LeftPos));
CurPtr->SetLeftPos(LeftPos);
CurPtr->SetCellCurPos(CurPos);
CurPtr->FastShow();
CurPtr->SetEditBeyondEnd(EdOpt.CursorBeyondEOL);
CurPtr = CurPtr->m_next;
} else {
SetScreen(X1, Y, XX2, Y, L' ', FarColorToReal(COL_EDITORTEXT)); // Пустые строки после конца текста
Expand Down Expand Up @@ -5378,26 +5371,20 @@ int Editor::EditorControl(int Command, void *Param)
_ECTLLOG(SysLog(L" EndPos =%d", col->EndPos));
_ECTLLOG(SysLog(L" Color =%d (0x%08X)", col->Color, col->Color));
_ECTLLOG(SysLog(L"}"));
ColorItem newcol{0};
newcol.StartPos = col->StartPos + (col->StartPos != -1 ? X1 : 0);
newcol.EndPos = col->EndPos + X1;
newcol.Color = col->Color;
Edit *CurPtr = GetStringByNumber(col->StringNumber);

if (!CurPtr) {
_ECTLLOG(SysLog(L"GetStringByNumber(%d) return nullptr", col->StringNumber));
return FALSE;
}

ColorItem newcol{0};
newcol.StartPos = col->StartPos + (col->StartPos != -1 ? X1 : 0);
if (!col->Color)
return (CurPtr->DeleteColor(newcol.StartPos));

if (col->EndPos >= 0) {
newcol.EndPos = col->EndPos + X1;
} else {
newcol.EndPos = CurPtr->GetLeftPos() + CurPtr->CellPosToReal(X2 - X1);//CurPtr->GetLength();
}
newcol.Color = col->Color;



if (Command == ECTL_ADDTRUECOLOR) {
const EditorTrueColor *tcol = (EditorTrueColor *)Param;
FarTrueColorToAttributes(newcol.Color, tcol->TrueColor);
Expand Down

0 comments on commit ead8d89

Please sign in to comment.