View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003424 | Far Manager | Command Line/Execute | public | 2017-04-22 00:46 | 2017-04-24 19:43 |
| Reporter | ddv | Assigned To | DrKnS | ||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | x64 | OS | Windows | OS Version | 10 |
| Product Version | 3.0 | ||||
| Fixed in Version | 3.0 | ||||
| Summary | 0003424: Новый параметр командной строки для наследования заголовка консоли | ||||
| Description | Во многих случаях было бы удобно запустить far.exe из уже исполняющейся консоли так, чтобы заголовок окна консоли остался таким, как был до его запуска. Для этого, по-моему, самый эффективный способ - иметь параметр командной строки для far.exe. | ||||
| Tags | No tags attached. | ||||
| Build | 4938 | ||||
|
|
Прикрепляю patch |
|
|
TitleSwitch.patch (2,639 bytes)
Index: FarEng.hlf.m4
===================================================================
--- FarEng.hlf.m4 (revision 14757)
+++ FarEng.hlf.m4 (working copy)
@@ -250,6 +250,9 @@
#/t templateprofile#
Location of Far template configuration file - overrides Far.exe.ini.
+ #/title#
+ Inherit console window's title.
+
#/clearcache [profilepath [localprofilepath]]#
Clear plugins cache.
Index: FarRus.hlf.m4
===================================================================
--- FarRus.hlf.m4 (revision 14757)
+++ FarRus.hlf.m4 (working copy)
@@ -256,6 +256,9 @@
если какой-либо из конфигурационных файлов не существует. Параметр templateprofile
перекрывает значение TemplateProfile из Far.exe.ini.
+ #/title#
+ Наследовать заголовок окна консоли.
+
#/clearcache [profilepath [localprofilepath]]#
Очистить кэш плагинов и завершить работу.
Необязательный параметр profilepath задаёт полный путь к конфигурационным файлам.
Index: main.cpp
===================================================================
--- main.cpp (revision 14757)
+++ main.cpp (working copy)
@@ -64,6 +64,7 @@
#include "notification.hpp"
#include "datetime.hpp"
#include "tracer.hpp"
+#include "constitle.hpp"
#include "local.hpp"
#include "cvtname.hpp"
@@ -105,6 +106,8 @@
L" Override the configuration parameter, see far:config for details." EOL_STR
L" -t <path>" EOL_STR
L" Location of Far template configuration file - overrides Far.exe.ini." EOL_STR
+ L" -title" EOL_STR
+ L" Inherit console window's title." EOL_STR
#ifndef NO_WRAPPER
L" -u <username>" EOL_STR
L" Allows to have separate registry settings for different users." EOL_STR
@@ -535,6 +538,7 @@
int CntDestName=0; // количество параметров-имен каталогов
string strProfilePath, strLocalProfilePath, strTemplatePath;
+ bool useTitle = false;
std::vector<std::pair<string, string>> Overridden;
FOR_RANGE(Args, Iter)
@@ -629,8 +633,12 @@
break;
case L'T':
- if (Iter + 1 != Args.end())
+ if (!StrCmpNI(Arg + 1, L"title", 5))
{
+ useTitle = true;
+ }
+ else if (Iter + 1 != Args.end())
+ {
strTemplatePath = *++Iter;
}
break;
@@ -742,6 +750,8 @@
}
InitConsole();
+ if (useTitle)
+ ConsoleTitle::SetUserTitle(Global->strInitTitle);
SCOPE_EXIT
{
|
|
|
Параметр /title наводит на мысли, что мы хотим установить некий пользовательский заголовок, переданный в следующем параметре, а не сохранить текущий. Для наглядности, возможно, лучше будет /keeptitle, /notitle и т. п. или же, действительно, устанавливать заголовком переданную строку, а если её нет - брать текущий. |
|
|
OK, почему бы нет. Предлагаю так: -title[:<valuestring>] Set the given <valuestring> as the window title; if <valuestring> is not provided, inherit the console window's title. Чтобы включить в valuestring произвольные символы, можно заключить весь аргумент в кавычки и escape символ кавычек предварением его символом backslash. |
|
|
Да, вроде хорошо. "можно заключить весь аргумент в кавычки и escape символ кавычек предварением его символом backslash", как я понимаю, обеспечивается рантаймом и валидно для любых аргументов, поэтому, наверное, можно не уточнять. |
|
|
TitleSwitch1.patch (4,001 bytes)
Index: far.vcxproj
===================================================================
--- far.vcxproj (revision 14757)
+++ far.vcxproj (working copy)
@@ -593,7 +593,7 @@
<FileType>Document</FileType>
<Message>Generating language files based on %(Identity)...</Message>
<Command>tools\lng.generator.exe -nc -i bootstrap\lang.ini -ol $(OutDir) %(Identity)</Command>
- <AdditionalInputs>%(Identity).m4;%(AdditionalInputs)</AdditionalInputs>
+ <AdditionalInputs>%(RelativeDir)..\%(FileName)%(Extension).m4;%(AdditionalInputs)</AdditionalInputs>
<Outputs>bootstrap\lang.inc;bootstrap\lang.ini;$(OutDir)\FarCze.lng;$(OutDir)\FarEng.lng;$(OutDir)\FarGer.lng;$(OutDir)\FarHun.lng;$(OutDir)\FarPol.lng;$(OutDir)\FarRus.lng;$(OutDir)\FarSpa.lng;$(OutDir)\FarSky.lng;$(OutDir)\FarIta.lng;$(OutDir)\FarUkr.lng;%(Outputs)</Outputs>
</CustomBuild>
<MASM Include="vc_crt_fix.asm">
Index: FarEng.hlf.m4
===================================================================
--- FarEng.hlf.m4 (revision 14757)
+++ FarEng.hlf.m4 (working copy)
@@ -250,6 +250,10 @@
#/t templateprofile#
Location of Far template configuration file - overrides Far.exe.ini.
+ #/title[:<valuestring>]#
+ If <valuestring> is given, use it as the window title;
+ otherwise, inherit the console window's title.
+
#/clearcache [profilepath [localprofilepath]]#
Clear plugins cache.
Index: FarRus.hlf.m4
===================================================================
--- FarRus.hlf.m4 (revision 14757)
+++ FarRus.hlf.m4 (working copy)
@@ -256,6 +256,10 @@
если какой-либо из конфигурационных файлов не существует. Параметр templateprofile
перекрывает значение TemplateProfile из Far.exe.ini.
+ #/title[:<valuestring>]#
+ Если указана <valuestring>, то использовать её как заголовок окна;
+ иначе, наследовать заголовок окна консоли.
+
#/clearcache [profilepath [localprofilepath]]#
Очистить кэш плагинов и завершить работу.
Необязательный параметр profilepath задаёт полный путь к конфигурационным файлам.
Index: main.cpp
===================================================================
--- main.cpp (revision 14757)
+++ main.cpp (working copy)
@@ -64,6 +64,7 @@
#include "notification.hpp"
#include "datetime.hpp"
#include "tracer.hpp"
+#include "constitle.hpp"
#include "local.hpp"
#include "cvtname.hpp"
@@ -105,6 +106,9 @@
L" Override the configuration parameter, see far:config for details." EOL_STR
L" -t <path>" EOL_STR
L" Location of Far template configuration file - overrides Far.exe.ini." EOL_STR
+ L" -title[:<valuestring>]" EOL_STR
+ L" If <valuestring> is given, use it as the window title;" EOL_STR
+ L" otherwise, inherit the console window's title." EOL_STR
#ifndef NO_WRAPPER
L" -u <username>" EOL_STR
L" Allows to have separate registry settings for different users." EOL_STR
@@ -535,6 +539,8 @@
int CntDestName=0; // количество параметров-имен каталогов
string strProfilePath, strLocalProfilePath, strTemplatePath;
+ bool useTitle = false;
+ string title;
std::vector<std::pair<string, string>> Overridden;
FOR_RANGE(Args, Iter)
@@ -629,8 +635,14 @@
break;
case L'T':
- if (Iter + 1 != Args.end())
+ if (!StrCmpNI(Arg + 1, L"title", 5))
{
+ useTitle = true;
+ if (Arg[6] == L':')
+ title = Arg + 7;
+ }
+ else if (Iter + 1 != Args.end())
+ {
strTemplatePath = *++Iter;
}
break;
@@ -742,6 +754,8 @@
}
InitConsole();
+ if (useTitle)
+ ConsoleTitle::SetUserTitle(title.empty() ? Global->strInitTitle : title);
SCOPE_EXIT
{
|
|
|
"обеспечивается рантаймом и валидно для любых аргументов" - да. Сделал, прикрепил. |
|
|
Ок. В CONTRIBUTORS добавлять? |
|
|
Можно. |
|
|
4938 |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2017-04-22 00:46 | ddv | New Issue | |
| 2017-04-22 03:17 | ddv | Note Added: 0015330 | |
| 2017-04-22 03:18 | ddv | File Added: TitleSwitch.patch | |
| 2017-04-22 09:28 | DrKnS | Note Added: 0015331 | |
| 2017-04-22 10:31 | ddv | Note Added: 0015332 | |
| 2017-04-22 11:03 | DrKnS | Note Added: 0015333 | |
| 2017-04-22 11:51 | ddv | File Added: TitleSwitch1.patch | |
| 2017-04-22 11:52 | ddv | Note Added: 0015334 | |
| 2017-04-22 12:37 | ddv | Note Edited: 0015334 | |
| 2017-04-22 12:45 | DrKnS | Note Added: 0015335 | |
| 2017-04-22 12:48 | ddv | Note Added: 0015336 | |
| 2017-04-22 13:22 | DrKnS | Note Added: 0015337 | |
| 2017-04-22 13:22 | DrKnS | Assigned To | => DrKnS |
| 2017-04-22 13:22 | DrKnS | Status | new => feedback |
| 2017-04-24 19:43 | DrKnS | Build | => 4938 |
| 2017-04-24 19:43 | DrKnS | Status | feedback => closed |
| 2017-04-24 19:43 | DrKnS | Resolution | open => fixed |
| 2017-04-24 19:43 | DrKnS | Fixed in Version | => 3.0 |