<arg choice="opt" rep="norepeat"><option>/cp</option>
<replaceable>codepage</replaceable></arg>
+ <arg choice="opt" rep="norepeat"><option>/fileext</option>
+ <replaceable>file-extension</replaceable></arg>
+
<arg choice="opt" rep="norepeat"><option>/cfg</option>
<replaceable>name=value</replaceable></arg>
</varlistentry>
<varlistentry>
+ <term><option>/fileext <replaceable>file-extension</replaceable></option></term>
+ <listitem>
+ <para>Specifies a file extension for determining syntax hightliting.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>/cfg</option></term>
<listitem>
<para>TBD</para>
<arg choice="opt" rep="norepeat"><option>/cp</option>
<replaceable>codepage</replaceable></arg>
+ <arg choice="opt" rep="norepeat"><option>/fileext</option>
+ <replaceable>file-extension</replaceable></arg>
+
<arg choice="opt" rep="norepeat"><option>/cfg</option>
<replaceable>name=value</replaceable></arg>
</varlistentry>
<varlistentry>
+ <term><option>/fileext <replaceable>file-extension</replaceable></option></term>
+ <listitem>
+ <para>シンタックスハイライトの種類を決定するため、ファイル拡張子を指定します。</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>/cfg</option></term>
<listitem>
<para>TBD</para>
</ul>
<h3 id="select-files-or-folders-dialog">Select Files or Folders dialog</h3>
<ul>
-<li>BugFix: Fix the Select Files or Folders dialog. (PR #882)</li>
+<li>BugFix: Fix the Select Files or Folders dialog. (PR #882,#892)</li>
</ul>
<h3 id="plugins">Plugins</h3>
<ul>
<h3 id="command-line">Command line</h3>
<ul>
<li>Added /l command line option (osdn.net #41528)</li>
-<li>Added /t, /table-delimiter, /new and /inifile command line option</li>
+<li>Added /t, /table-delimiter, /new, /fileext and /inifile command line option</li>
</ul>
<h3 id="installer">Installer</h3>
<ul>
<li>Translation updates:
<ul>
<li>Bulgarian (PR #850)</li>
-<li>Dutch (PR #842)</li>
+<li>Dutch (PR #842,#893)</li>
<li>Galician (PR #869)</li>
<li>German (PR #860,#870,#883,#890)</li>
<li>Hungarian (PR #845,#856)</li>
### Select Files or Folders dialog
-- BugFix: Fix the Select Files or Folders dialog. (PR #882)
+- BugFix: Fix the Select Files or Folders dialog. (PR #882,#892)
### Plugins
### Command line
- Added /l command line option (osdn.net #41528)
-- Added /t, /table-delimiter, /new and /inifile command line option
+- Added /t, /table-delimiter, /new, /fileext and /inifile command line option
### Installer
- Translation updates:
- Bulgarian (PR #850)
- - Dutch (PR #842)
+ - Dutch (PR #842,#893)
- Galician (PR #869)
- German (PR #860,#870,#883,#890)
- Hungarian (PR #845,#856)
</ul>
<h3 id="select-files-or-folders-dialog">Select Files or Folders dialog</h3>
<ul>
-<li>BugFix: Fix the Select Files or Folders dialog. (PR #882)</li>
+<li>BugFix: Fix the Select Files or Folders dialog. (PR #882,#892)</li>
</ul>
<h3 id="plugins">Plugins</h3>
<ul>
<h3 id="command-line">Command line</h3>
<ul>
<li>Added /l command line option (osdn.net #41528)</li>
-<li>Added /t, /table-delimiter, /new and /inifile command line option</li>
+<li>Added /t, /table-delimiter, /new, /fileext and /inifile command line option</li>
</ul>
<h3 id="installer">Installer</h3>
<ul>
<li>Translation updates:
<ul>
<li>Bulgarian (PR #850)</li>
-<li>Dutch (PR #842)</li>
+<li>Dutch (PR #842,#893)</li>
<li>Galician (PR #869)</li>
<li>German (PR #860,#870,#883,#890)</li>
<li>Hungarian (PR #845,#856)</li>
### Select Files or Folders dialog
-- BugFix: Fix the Select Files or Folders dialog. (PR #882)
+- BugFix: Fix the Select Files or Folders dialog. (PR #882,#892)
### Plugins
### Command line
- Added /l command line option (osdn.net #41528)
-- Added /t, /table-delimiter, /new and /inifile command line option
+- Added /t, /table-delimiter, /new, /fileext and /inifile command line option
### Installer
- Translation updates:
- Bulgarian (PR #850)
- - Dutch (PR #842)
+ - Dutch (PR #842,#893)
- Galician (PR #869)
- German (PR #860,#870,#883,#890)
- Hungarian (PR #845,#856)
pMergeDoc->SetEnableTableEditing(table);
if (pOpenParams && table.value_or(false))
{
- CMergeDoc::TableProps props = CMergeDoc::GetTablePropertiesByFileName(fileloc[0].filepath, true, false);
+ CMergeDoc::TableProps props = CMergeDoc::GetTablePropertiesByFileName(
+ pOpenParams->m_fileExt.empty() ? fileloc[0].filepath : pOpenParams->m_fileExt, true, false);
props.delimiter = pOpenParams->m_tableDelimiter.value_or(props.delimiter);
props.quote = pOpenParams->m_tableQuote.value_or(props.quote);
props.allowNewlinesInQuotes = pOpenParams->m_tableAllowNewlinesInQuotes.value_or(props.allowNewlinesInQuotes);
return false;
}
+ if (pOpenParams && !pOpenParams->m_fileExt.empty())
+ pMergeDoc->SetTextType(pOpenParams->m_fileExt);
+
for (int pane = 0; pane < nFiles; pane++)
{
if (dwFlags)
std::optional<TCHAR> m_tableDelimiter;
std::optional<TCHAR> m_tableQuote;
std::optional<bool> m_tableAllowNewlinesInQuotes;
+ String m_fileExt;
};
CMainFrame();
CMainFrame::OpenTextFileParams openParams;
openParams.m_line = cmdInfo.m_nLineIndex;
+ openParams.m_fileExt = cmdInfo.m_sFileExt;
if (cmdInfo.m_nWindowType == MergeCmdLineInfo::TABLE)
{
openParams.m_tableDelimiter = cmdInfo.m_cTableDelimiter;
// -maximize means maximize the main window.
m_nCmdShow = MAXIMIZE;
}
- else if (param == _T("prediffer"))
- {
- // Get prediffer if specified (otherwise prediffer will be blank, which is default)
- q = EatParam(q, m_sPreDiffer);
- }
else if (param == _T("unpacker"))
{
// Get unpacker if specified (otherwise unpacker will be blank, which is default)
q = EatParam(q, m_sUnpacker);
}
+ else if (param == _T("prediffer"))
+ {
+ // Get prediffer if specified (otherwise prediffer will be blank, which is default)
+ q = EatParam(q, m_sPreDiffer);
+ }
else if (param == _T("wl"))
{
// -wl to open left path as read-only
q = EatParam(q, codepage);
m_nCodepage = atoi(ucr::toUTF8(codepage).c_str());
}
+ else if (param == _T("fileext"))
+ {
+ q = EatParam(q, m_sFileExt);
+ if (!m_sFileExt.empty() && m_sFileExt[0] != '.')
+ m_sFileExt = _T(".") + m_sFileExt;
+ }
else if (param == _T("ignorews"))
{
q = SetOption(q, OPT_CMP_IGNORE_WHITESPACE);
String m_sFileFilter; /**< File filter mask. */
String m_sPreDiffer; /**< Pre-differ name. */
String m_sUnpacker; /**< Unpacker name. */
+ String m_sFileExt; /**< File extension for determining syntax highliting */
String m_sOutputpath;
String m_sReportFile;
, m_pView{nullptr}
, m_bAutomaticRescan(false)
, m_CurrentPredifferID(0)
+, m_bChangedSchemeManually(false)
{
DIFFOPTIONS options = {0};
}
}
+void CMergeDoc::SetTextType(int textType)
+{
+ ForEachView([textType, this](auto& pView) {
+ pView->SetTextType(CrystalLineParser::TextType(textType));
+ pView->SetDisableBSAtSOL(false);
+ m_bChangedSchemeManually = true;
+ });
+}
+
+void CMergeDoc::SetTextType(const String& ext)
+{
+ String ext2 = ext;
+ strutils::replace(ext2, _T("."), _T(""));
+ ForEachView([&ext2, this](auto& pView) {
+ pView->SetTextType(ext2.c_str());
+ pView->SetDisableBSAtSOL(false);
+ m_bChangedSchemeManually = true;
+ });
+}
+
/**
* @brief Loads files and does initial rescan.
* @param fileloc [in] File to open to left/middle/right side (path & encoding info)
std::optional<bool> GetEnableTableEditing() const { return m_bEnableTableEditing; }
void SetEnableTableEditing(std::optional<bool> bEnableTableEditing) { m_bEnableTableEditing = bEnableTableEditing; }
void SetTableProperties(const TableProps& props) { m_pTablePropsCommandLine.reset(new TableProps(props)); }
+ void SetTextType(int textType);
+ void SetTextType(const String& ext);
+ bool GetChangedSchemeManually() const { return m_bChangedSchemeManually; }
bool GetAutomaticRescan() const { return m_bAutomaticRescan; }
// to customize the mergeview menu
HMENU createPrediffersSubmenu(HMENU hMenu);
bool m_bAutomaticRescan;
/// active prediffer ID : helper to check the radio button
int m_CurrentPredifferID;
+ bool m_bChangedSchemeManually; /**< `true` if the syntax highlighting scheme is changed manually */
// friend access
friend class RescanSuppress;
, fTimerWaitingForIdle(0)
, m_lineBegin(0)
, m_lineEnd(-1)
-, m_bChangedSchemeManually(false)
{
SetParser(&m_xParser);
return GetDocument()->m_ptBuf[m_nThisPane].get();
}
-void CMergeEditView::CopyProperties(CCrystalTextView* pSource)
-{
- __super::CopyProperties(pSource);
- auto pSourceEditView = dynamic_cast<decltype(this)>(pSource);
- if (!pSourceEditView)
- return;
- m_bChangedSchemeManually = pSourceEditView->m_bChangedSchemeManually;
-}
-
/**
* @brief Update any resources necessary after a GUI language change
*/
if (!GetOptionsMgr()->GetBool(OPT_SYNTAX_HIGHLIGHT))
SetTextType(CrystalLineParser::SRC_PLAIN);
- else if (!m_bChangedSchemeManually)
+ else if (!GetDocument()->GetChangedSchemeManually())
{
// The syntax highlighting scheme should only be applied if it has not been manually changed.
String fileName = GetDocument()->m_filePaths[m_nThisPane];
{
CMergeDoc *pDoc = GetDocument();
ASSERT(pDoc != nullptr);
-
- for (int nGroup = 0; nGroup < pDoc->m_nGroups; nGroup++)
- for (int nPane = 0; nPane < pDoc->m_nBuffers; nPane++)
- {
- CMergeEditView *pView = pDoc->GetView(nGroup, nPane);
- ASSERT(pView != nullptr);
-
- if (pView != nullptr)
- {
- pView->SetTextType(CrystalLineParser::TextType(nID - ID_COLORSCHEME_FIRST));
- pView->SetDisableBSAtSOL(false);
- pView->m_bChangedSchemeManually = true;
- }
- }
-
+ pDoc->SetTextType(nID - ID_COLORSCHEME_FIRST);
OnRefresh();
}
bool m_bCurrentLineIsDiff; /**< `true` if cursor is in diff line */
- bool m_bChangedSchemeManually; /**< `true` if the syntax highlighting scheme is changed manually */
-
// Attributes
public:
- void CopyProperties (CCrystalTextView* pSource) override;
// Operations
public: