Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elfmz/far2l
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmz committed Jul 29, 2024
2 parents ffc5c02 + 658c4f4 commit 85f4bbe
Show file tree
Hide file tree
Showing 16 changed files with 123 additions and 50 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: check build

on:
# allow manually running worflow, useful for testing branches
# allow manually running workflow, useful for testing branches
workflow_dispatch:
# run on push in master
push:
Expand Down Expand Up @@ -195,11 +195,12 @@ jobs:
uses: actions/checkout@v4

- name: Install dependencies
# libx11, openssl is already installed
run: >
brew install
uchardet xerces-c wxwidgets
libx11 libxi
openssl samba libnfs neon libssh
libxi
samba libnfs neon libssh
libarchive pcre
- name: Relink 'keg-only' packages
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/clean_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Delete old workflow runs
on:
workflow_dispatch:
# allow manually running workflow,
schedule:
- cron: '0 0 1 * *'
# Run monthly, at 00:00 on the 1st day of month.

jobs:
del_runs:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6
check_pullrequest_exist: true
58 changes: 41 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ all keyboard modifiers), almost perfect UX;
emulators](#terminals), which provide clipboard access and has their advanced keyboard-protocols).



| Mode<br>(UI Backends) | TTY<br>(plain far2l) | TTY\|X | TTY\|Xi | GUI |
| ---: | --- | --- | --- | --- |
| **Works:** | in terminal | in terminal | in terminal | in Desktop<br>environment<br><sub>(X11<br>or Wayland<br>or macOS)</sub> |
| **Binaries:** | far2l | far2l<br>far2l_ttyx.broker | far2l<br>far2l_ttyx.broker | far2l<br>far2l_gui.so |
| **[Dependencies](#required-dependencies):** | minimal | + libx11 | + libx11, libxi | + wxWidgets, GTK |
| **Keyboard:** | <sub>_Typical terminals_:<br>**only essential<br>key combinations**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | <sub>_Typical terminals_:<br>**only essential<br>key combinations**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | <sub>_Typical terminals_:<br>**most of key<br>combinations under x11**;<br>**only essential key<br>combinations<br>under Wayland**<br><br>_KiTTY_ (putty fork),<br>_kitty_ (*nix one),<br>_iTerm2_,<br>_Windows Terminal_,<br>far2l’s VT: **full support**</sub> | **All key<br>combinations** |
| **Clipboard<br>access:** | <sub>_Typical terminals_:<br>via command line<br>tools like xclip<br><br>_kitty_ (*nix one),<br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | <sub>_Typical terminals_,<br>_kitty_ (*nix one):<br>via **x11 interaction**<br><br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | <sub>_Typical terminals_,<br>_kitty_ (*nix one):<br>via **x11 interaction**<br><br>_iTerm2_:<br>via **OSC52**<br><br>_Windows Terminal_:<br>via **OSC52**<br>or via **command line<br>tools under WSL**<br><br>_KiTTY_ (putty fork),<br>far2l’s VT:<br>via **far2l extensions**</sub> | via<br>**wxWidgets API**<br><br><sub>via command line<br>tools under WSL</sub> |
| **Typical<br>use case:** | **Servers**,<br>embedded | <sub>Run far2l in<br>favorite terminal<br>but with<br>**better UX**</sub> | <sub>Run far2l in<br>favorite terminal<br>but with<br>**best UX**</sub> | **Desktop** |
| **Mandatory:** | yes | no | no | no |

<sub>_Note about use OSC 52 in TTY/TTY|X_:
to interact with the system clipboard you must **not forget to enable OSC 52**
in both the **FAR2L settings** (`Options`->`Interface settings`->`Use OSC52 to set clipboard data`,
which shown in the dialog only if far2l run in TTY/TTY|X mode and all other options for clipboard access are unavailable;
you can run `far2l --tty --nodetect` to force not use others clipboard options),
and in **terminal settings** option OSC 52 must be allowed (by default, OSC 52 is disabled in some terminals for security reasons;
OSC 52 in many terminals is implemented only for the copy mode, and paste from the terminal goes by bracketed paste mode).</sub>


## Installing, Running
#### Debian/Ubuntu 23.10+ binaries (with TTY X/Xi backends only)

Expand Down Expand Up @@ -80,23 +100,23 @@ See also [Community packages & binaries](#community_bins)
## Building, Contributing, Hacking
#### Required dependencies

* libwxgtk3.0-gtk3-dev (or libwxgtk3.2-dev in newer distributions, or libwxgtk3.0-dev in older ones, optional - needed for GUI backend, not needed with -DUSEWX=no)
* libx11-dev (optional - needed for X11 extension that provides better UX for TTY backend wherever X11 is available)
* libxi-dev (optional - needed for X11/Xi extension that provides best UX for TTY backend wherever X11 Xi extension is available)
* libxerces-c-dev (optional - needed for Colorer plugin, not needed with -DCOLORER=no)
* libuchardet-dev (optional - needed for auto charset detection, not needed with -DUSEUCD=no)
* libssh-dev (optional - needed for NetRocks/SFTP)
* libssl-dev (optional - needed for NetRocks/FTPS)
* libsmbclient-dev (optional - needed for NetRocks/SMB)
* libnfs-dev (optional - needed for NetRocks/NFS)
* libneon27-dev (or later, optional - needed for NetRocks/WebDAV)
* libarchive-dev (optional - needed for better archives support in multiarc)
* libunrar-dev (optional - needed for RAR archives support in multiarc, see UNRAR command line option)
* libpcre3-dev (or libpcre2-dev in older distributions, optional - needed for advanced custom archive formats support in multiarc)
* cmake ( >= 3.2.2 )
* pkg-config
* g++
* git (needed for downloading source code)
* `libwxgtk3.0-gtk3-dev` (or `libwxgtk3.2-dev` in newer distributions, or `libwxgtk3.0-dev` in older ones, _optional_ - needed for **GUI backend**, not needed with `-DUSEWX=no`)
* `libx11-dev` (_optional_ - needed for **X11 extension** that provides better UX for TTY backend wherever X11 is available)
* `libxi-dev` (_optional_ - needed for **X11/Xi extension** that provides best UX for TTY backend wherever X11 Xi extension is available)
* `libxerces-c-dev` (_optional_ - needed for **Colorer plugin**, not needed with `-DCOLORER=no`)
* `libuchardet-dev` (_optional_ - needed for **auto charset detection**, not needed with `-DUSEUCD=no`)
* `libssh-dev` (_optional_ - needed for **NetRocks/SFTP**)
* `libssl-dev` (_optional_ - needed for **NetRocks/FTPS**)
* `libsmbclient-dev` (_optional_ - needed for **NetRocks/SMB**)
* `libnfs-dev` (_optional_ - needed for **NetRocks/NFS**)
* `libneon27-dev` (or later, _optional_ - needed for **NetRocks/WebDAV**)
* `libarchive-dev` (_optional_ - needed for better archives support in **multiarc**)
* `libunrar-dev` (_optional_ - needed for RAR archives support in **multiarc**, see UNRAR command line option)
* `libpcre3-dev` (or `libpcre2-dev` in older distributions, _optional_ - needed for advanced custom archive formats support in **multiarc**)
* `cmake` ( >= 3.2.2 )
* `pkg-config`
* `g++`
* `git` (needed for downloading source code)

#### Or simply on Debian/Ubuntu:
``` sh
Expand Down Expand Up @@ -286,6 +306,10 @@ Supporting extended far2l keyboard shortcuts and clipboard access
* **cyd01's KiTTY** (Windows ssh-client): https://github.com/cyd01/KiTTY & https://www.9bis.net/kitty (TTY|F backend: keys and clipboard by FAR2L TTY extensions support)
* **putty-nd** (Windows ssh-client): https://sourceforge.net/projects/putty-nd & https://github.com/noodle1983/putty-nd (TTY|F backend: keys and clipboard by FAR2L TTY extensions support)
_Note_: to full transfer extended keyboard shortcuts and the clipboard to/from the **remote far2l**
one of the best way to initiate the connection **inside local far2l-GUI**
(see details in build-in help section **UI backends**).
### Useful 3rd-party extras
* A collection of macros for far2l: https://github.com/corporateshark/far2l-macros
Expand Down
6 changes: 3 additions & 3 deletions far2l/bootstrap/scripts/FarEng.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ when it starts, far2l switches to #TTY|X# without i.

#Special options for configuring FAR2L running in terminal emulators#
- Menu(#F9#)->Options->Interface settings->#Use OSC52 to set clipboard data#
(shown in the menu only if FAR2L run in TTY/TTY|X mode and all other options for clipboard access are unavailable).
(shown in the dialog only if FAR2L run in TTY/TTY|X mode and all other options for clipboard access are unavailable).
You can run #far2l --tty --nodetect# to force not use others clipboard options.
- Menu(#F9#)->Options->Interface settings->#Override base colors palette#
(shown in the menu only if FAR2L run in TTY/TTY|X mode) allows far2l to adjust terminal palette colors.
(shown in the dialog only if FAR2L run in TTY/TTY|X mode) allows far2l to adjust terminal palette colors.
If your terminal doesn't support OSC4 sequence you may turn it off to avoid show artifacts sequence in terminal after exit from far2l.


#Full-functional work with the system clipboard in a plain terminal version FAR2L TTY#
To interact with the system clipboard, you must not forget to enable #OSC 52# in both the #FAR2L settings#
To interact with the system clipboard you must not forget to enable #OSC 52# in both the #FAR2L settings#
(see details above),
and in #terminal settings# option #OSC 52 must be allowed#
(by default, OSC 52 is disabled in some terminals for security reasons; OSC 52 in many terminals is implemented only for the copy mode, and paste from the terminal goes by bracketed paste mode).
Expand Down
4 changes: 2 additions & 2 deletions far2l/bootstrap/scripts/FarRus.hlf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ $ # Особенности FAR2L - начало работы#

#Специальные возможности конфигурирования FAR2L, запущенного в эмуляторах терминалов#
- Меню(#F9#)->Параметры->Настройки интерфейса->#Исп. OSC52 для записи в буфер обмена#
(видна в меню только если FAR2L запущен в режиме TTY/TTY|X и все остальные варианты поддержки клипборда недоступны).
(виден в диалоге только если FAR2L запущен в режиме TTY/TTY|X и все остальные варианты поддержки клипборда недоступны).
Вы можете запустить #far2l --tty --nodetect# для принудительного не использования других вариантов взаимодействия с буфером обмена.
- Меню(#F9#)->Параметры->Настройки интерфейса->#Исп. свою палитру базовых цветов#
(видна в в меню только если FAR2L запущен в режиме TTY/TTY|X) позволяет far2l настраивать цвета палитры терминала.
(виден в диалоге только если FAR2L запущен в режиме TTY/TTY|X) позволяет far2l настраивать цвета палитры терминала.
Если Ваш терминал не поддерживает последовательности OSC4 выключение данной опции позволяет избежать появления в терминале артефактов после выхода из far2l.


Expand Down
2 changes: 1 addition & 1 deletion far2l/src/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4041,7 +4041,7 @@ void Dialog::ChangeFocus2(unsigned SetFocusPos)
return;
}

if (FocusPosNeed != -1 && IsItemFocusable(Item[FocusPosNeed]))
if (FocusPosNeed >= 0 && FocusPosNeed < (int)ItemCount && IsItemFocusable(Item[FocusPosNeed]))
SetFocusPos = FocusPosNeed;

Item[FocusPos]->Focus = 0;
Expand Down
2 changes: 1 addition & 1 deletion far2l/src/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ int64_t Edit::VMProcess(MacroOpcode OpCode, void *vParam, int64_t iParam)
case MCODE_V_ITEMCOUNT:
return (int64_t)StrSize;
case MCODE_V_CURPOS:
return (int64_t)(CursorPos + 1);
return (int64_t)(CurPos + 1);
case MCODE_F_EDITOR_SEL: {
int Action = (int)((INT_PTR)vParam);

Expand Down
2 changes: 1 addition & 1 deletion far2l/src/fileedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2525,7 +2525,7 @@ int FileEditor::EditorControl(int Command, void *Param)
if (Param) {
EditorSaveFile *esf = (EditorSaveFile *)Param;

if (*esf->FileName)
if (esf->FileName && *esf->FileName)
strName = esf->FileName;

if (esf->FileEOL) {
Expand Down
19 changes: 14 additions & 5 deletions far2l/src/fileview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "mix.hpp"
#include "fileholder.hpp"
#include "GrepFile.hpp"
#include "exitcode.hpp"

FileViewer::FileViewer(FileHolderPtr NewFileHolder, int EnableSwitch, int DisableHistory, int DisableEdit,
long ViewStartPos, const wchar_t *PluginData, NamesList *ViewNamesList, int ToSaveAs, UINT aCodePage)
Expand Down Expand Up @@ -329,11 +330,19 @@ int FileViewer::ProcessKey(FarKey Key)
| (SaveToSaveAs ? FFILEEDIT_SAVETOSAVEAS : 0)
| (DisableHistory ? FFILEEDIT_DISABLEHISTORY : 0),
-2, static_cast<int>(FilePos), strPluginData);
ShellEditor->SetEnableF6(TRUE);
/* $ 07.05.2001 DJ сохраняем NamesList */
ShellEditor->SetNamesList(View.GetNamesList());
FrameManager->DeleteFrame(this); // Insert уже есть внутри конструктора
ShowTime(2);
int load = ShellEditor->GetExitCode();
if (load == XC_LOADING_INTERRUPTED || load == XC_OPEN_ERROR)
{
delete ShellEditor;
}
else
{
ShellEditor->SetEnableF6(TRUE);
/* $ 07.05.2001 DJ сохраняем NamesList */
ShellEditor->SetNamesList(View.GetNamesList());
FrameManager->DeleteFrame(this); // Insert уже есть внутри конструктора
ShowTime(2);
}
}

return TRUE;
Expand Down
4 changes: 2 additions & 2 deletions far2l/src/mix/strmix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ wchar_t GetDecimalSeparator()
}

FARString
ReplaceBrackets(const FARString &SearchStr, const FARString &ReplaceStr, RegExpMatch *Match, int Count)
ReplaceBrackets(const wchar_t* SearchStr, const FARString &ReplaceStr, RegExpMatch *Match, int Count)
{
FARString result;
size_t pos = 0, length = ReplaceStr.GetLength();
Expand All @@ -1205,7 +1205,7 @@ ReplaceBrackets(const FARString &SearchStr, const FARString &ReplaceStr, RegExpM

if (index >= 0) {
if (index < Count) {
FARString bracket(SearchStr.CPtr() + Match[index].start,
FARString bracket(SearchStr + Match[index].start,
Match[index].end - Match[index].start);
result+= bracket;
}
Expand Down
2 changes: 1 addition & 1 deletion far2l/src/mix/strmix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ inline const wchar_t GetDecimalSeparatorDefault() { return L'.'; };
inline const wchar_t* GetDecimalSeparatorDefaultStr() { return L"."; };

FARString
ReplaceBrackets(const FARString &SearchStr, const FARString &ReplaceStr, RegExpMatch *Match, int Count);
ReplaceBrackets(const wchar_t *SearchStr, const FARString &ReplaceStr, RegExpMatch *Match, int Count);

bool SearchString(const wchar_t *Source, int StrSize, const FARString &Str, FARString &ReplaceStr,
int &CurPos, int Position, int Case, int WholeWords, int Reverse, int Regexp, int *SearchLength,
Expand Down
28 changes: 15 additions & 13 deletions far2l/src/panels/panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,7 @@ int Panel::SetPluginCommand(int Command, int Param1, LONG_PTR Param2)
ProcessingPluginCommand++;
FilePanels *FPanels = CtrlObject->Cp();
PluginCommand = Command;
auto DestFilePanel = dynamic_cast<FileList*>(this);

switch (Command) {
case FCTL_SETVIEWMODE:
Expand Down Expand Up @@ -1724,7 +1725,6 @@ int Panel::SetPluginCommand(int Command, int Param1, LONG_PTR Param2)
}

if (GetType() == FILE_PANEL) {
FileList *DestFilePanel = (FileList *)this;
static int Reenter = 0;

if (!Reenter && Info->Plugin) {
Expand Down Expand Up @@ -1763,7 +1763,6 @@ int Panel::SetPluginCommand(int Command, int Param1, LONG_PTR Param2)
GetCurDir(strTemp);

if (GetType() == FILE_PANEL) {
FileList *DestFilePanel = (FileList *)this;
static int Reenter = 0;

if (!Reenter && GetMode() == PLUGIN_PANEL) {
Expand Down Expand Up @@ -1800,7 +1799,7 @@ int Panel::SetPluginCommand(int Command, int Param1, LONG_PTR Param2)

if (GetType() == FILE_PANEL) {
FARString strColumnTypes, strColumnWidths;
((FileList *)this)->PluginGetColumnTypesAndWidths(strColumnTypes, strColumnWidths);
DestFilePanel->PluginGetColumnTypesAndWidths(strColumnTypes, strColumnWidths);

if (Command == FCTL_GETCOLUMNTYPES) {
if (Param1 && Param2)
Expand All @@ -1817,50 +1816,53 @@ int Panel::SetPluginCommand(int Command, int Param1, LONG_PTR Param2)
break;

case FCTL_GETPANELITEM: {
Result = (int)((FileList *)this)->PluginGetPanelItem(Param1, (PluginPanelItem *)Param2);
if (DestFilePanel)
Result = (int)DestFilePanel->PluginGetPanelItem(Param1, (PluginPanelItem *)Param2);
break;
}

case FCTL_GETSELECTEDPANELITEM: {
Result = (int)((FileList *)this)->PluginGetSelectedPanelItem(Param1, (PluginPanelItem *)Param2);
if (DestFilePanel)
Result = (int)DestFilePanel->PluginGetSelectedPanelItem(Param1, (PluginPanelItem *)Param2);
break;
}

case FCTL_GETCURRENTPANELITEM: {
PanelInfo Info;
FileList *DestPanel = ((FileList *)this);
DestPanel->PluginGetPanelInfo(Info);
Result = (int)DestPanel->PluginGetPanelItem(Info.CurrentItem, (PluginPanelItem *)Param2);
if (DestFilePanel) {
PanelInfo Info;
DestFilePanel->PluginGetPanelInfo(Info);
Result = (int)DestFilePanel->PluginGetPanelItem(Info.CurrentItem, (PluginPanelItem *)Param2);
}
break;
}

case FCTL_BEGINSELECTION: {
if (GetType() == FILE_PANEL) {
((FileList *)this)->PluginBeginSelection();
DestFilePanel->PluginBeginSelection();
Result = TRUE;
}
break;
}

case FCTL_SETSELECTION: {
if (GetType() == FILE_PANEL) {
((FileList *)this)->PluginSetSelection(Param1, Param2 ? true : false);
DestFilePanel->PluginSetSelection(Param1, Param2 ? true : false);
Result = TRUE;
}
break;
}

case FCTL_CLEARSELECTION: {
if (GetType() == FILE_PANEL) {
reinterpret_cast<FileList *>(this)->PluginClearSelection(Param1);
DestFilePanel->PluginClearSelection(Param1);
Result = TRUE;
}
break;
}

case FCTL_ENDSELECTION: {
if (GetType() == FILE_PANEL) {
((FileList *)this)->PluginEndSelection();
DestFilePanel->PluginEndSelection();
Result = TRUE;
}
break;
Expand Down
6 changes: 6 additions & 0 deletions far2l/src/plug/PluginA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ static const char szCache_ProcessEditorEvent[] = "ProcessEditorEvent";
static const char szCache_ProcessViewerEvent[] = "ProcessViewerEvent";
static const char szCache_ProcessDialogEvent[] = "ProcessDialogEvent";
static const char szCache_Configure[] = "Configure";
static const char szCache_GetFiles[] = "GetFiles";
static const char szCache_ProcessHostFile[] = "ProcessHostFile";

static const char NFMP_OpenPlugin[] = "OpenPlugin";
static const char NFMP_OpenFilePlugin[] = "OpenFilePlugin";
Expand Down Expand Up @@ -163,6 +165,8 @@ bool PluginA::LoadFromCache()
pProcessViewerEvent = (PLUGINPROCESSVIEWEREVENT)(INT_PTR)kfh.GetUInt(szCache_ProcessViewerEvent, 0);
pProcessDialogEvent = (PLUGINPROCESSDIALOGEVENT)(INT_PTR)kfh.GetUInt(szCache_ProcessDialogEvent, 0);
pConfigure = (PLUGINCONFIGURE)(INT_PTR)kfh.GetUInt(szCache_Configure, 0);
pGetFiles = (PLUGINGETFILES)(INT_PTR)kfh.GetUInt(szCache_GetFiles, 0);
pProcessHostFile = (PLUGINPROCESSHOSTFILE)(INT_PTR)kfh.GetUInt(szCache_ProcessHostFile, 0);
WorkFlags.Set(PIWF_CACHED); // too much "cached" flags

if (kfh.GetInt(szCache_Preopen) != 0)
Expand Down Expand Up @@ -232,6 +236,8 @@ bool PluginA::SaveToCache()
kfh.SetUInt(GetSettingsName(), szCache_ProcessViewerEvent, pProcessViewerEvent != nullptr);
kfh.SetUInt(GetSettingsName(), szCache_ProcessDialogEvent, pProcessDialogEvent != nullptr);
kfh.SetUInt(GetSettingsName(), szCache_Configure, pConfigure != nullptr);
kfh.SetUInt(GetSettingsName(), szCache_GetFiles, pGetFiles!=nullptr);
kfh.SetUInt(GetSettingsName(), szCache_ProcessHostFile, pProcessHostFile!=nullptr);
return true;
}

Expand Down
Loading

0 comments on commit 85f4bbe

Please sign in to comment.