Skip to content

Commit 0c6073f

Browse files
authored
Merge pull request #2685 from ctapmex/colorer_up
colorer: fix read non-latin string from hrc
2 parents 2a7ba0a + 289b15d commit 0c6073f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+222
-184
lines changed

changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Only significant user-side changes are listed here (for all changes see history
1818
* Help actualization and improvements
1919
* Info panel: New EditorConfig block
2020
* _colorer plugin_: Update colorer schemes to v1.2.0.57
21+
* _colorer plugin_: Update colorer library to v1.4.1-24.01.2025
2122
* _Inside plugin_: Add PE format, add png, ogg, m4a and Mach-O support
2223
* _multiarc plugin_: Removed PCRE library dependencies
2324
* _NetRocks plugin_: Explicit SSH algorithms options

colorer/src/Colorer-library/src/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
203203
# remove /W3 flag from CMAKE_CXX_FLAGS
204204
string(REGEX REPLACE "/W[3|4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
205205

206-
set(FLAGS_CXX_DEFAULT)
206+
set(FLAGS_CXX_DEFAULT /Zi)
207207
set(FLAGS_CXX_RELEASE /W3)
208208

209209
if (COLORER_BUILD_HARD_WARNINGS)

colorer/src/Colorer-library/src/colorer/Exception.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Exception : public std::exception
2525
[[nodiscard]]
2626
const char* what() const noexcept override;
2727

28-
protected:
28+
private:
2929
std::string what_str;
3030
};
3131

colorer/src/Colorer-library/src/colorer/LineSource.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_LINESOURCE_H_
2-
#define _COLORER_LINESOURCE_H_
1+
#ifndef COLORER_LINESOURCE_H
2+
#define COLORER_LINESOURCE_H
33

44
#include "colorer/Common.h"
55

@@ -49,5 +49,4 @@ class LineSource
4949
LineSource() = default;
5050
};
5151

52-
#endif
53-
52+
#endif // COLORER_LINESOURCE_H

colorer/src/Colorer-library/src/colorer/RegionHandler.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_REGIONHANDLER_H_
2-
#define _COLORER_REGIONHANDLER_H_
1+
#ifndef COLORER_REGIONHANDLER_H
2+
#define COLORER_REGIONHANDLER_H
33

44
#include "colorer/Region.h"
55
#include "colorer/Scheme.h"
@@ -92,4 +92,4 @@ class RegionHandler
9292
RegionHandler() = default;
9393
};
9494

95-
#endif
95+
#endif // COLORER_REGIONHANDLER_H

colorer/src/Colorer-library/src/colorer/TextParser.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_TEXTPARSER_H_
2-
#define _COLORER_TEXTPARSER_H_
1+
#ifndef COLORER_TEXTPARSER_H
2+
#define COLORER_TEXTPARSER_H
33

44
#include "colorer/FileType.h"
55
#include "colorer/LineSource.h"
@@ -100,4 +100,4 @@ class TextParser
100100
spimpl::unique_impl_ptr<Impl> pimpl;
101101
};
102102

103-
#endif //_COLORER_TEXTPARSER_H_
103+
#endif // COLORER_TEXTPARSER_H

colorer/src/Colorer-library/src/colorer/editor/BaseEditor.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ FileType* BaseEditor::chooseFileTypeCh(const UnicodeString* fileName, int choose
132132
UnicodeString textStart;
133133
int totalLength = 0;
134134
for (int i = 0; i < chooseStr; i++) {
135-
UnicodeString* iLine = lineSource->getLine(i);
135+
const UnicodeString* iLine = lineSource->getLine(i);
136136
if (iLine == nullptr) {
137137
break;
138138
}
@@ -164,10 +164,11 @@ FileType* BaseEditor::chooseFileType(const UnicodeString* fileName)
164164
currentFileType = parserFactory->getHrcLibrary().chooseFileType(fileName, nullptr);
165165
}
166166
else {
167-
int chooseStr = CHOOSE_STR, chooseLen = CHOOSE_LEN;
167+
int chooseStr = CHOOSE_STR;
168+
int chooseLen = CHOOSE_LEN;
168169

169170
UnicodeString ds_def = UnicodeString("default");
170-
FileType* def = parserFactory->getHrcLibrary().getFileType(&ds_def);
171+
const FileType* def = parserFactory->getHrcLibrary().getFileType(&ds_def);
171172
if (def) {
172173
chooseStr = def->getParamValueInt("firstlines", chooseStr);
173174
chooseLen = def->getParamValueInt("firstlinebytes", chooseLen);
@@ -360,7 +361,7 @@ void BaseEditor::lineCountEvent(int newLineCount)
360361
lineCount = newLineCount;
361362
}
362363

363-
inline int BaseEditor::getLastVisibleLine()
364+
inline int BaseEditor::getLastVisibleLine() const
364365
{
365366
int r1 = (wStart + wSize);
366367
int r2 = lineCount;
@@ -369,7 +370,8 @@ inline int BaseEditor::getLastVisibleLine()
369370

370371
void BaseEditor::validate(int lno, bool rebuildRegions)
371372
{
372-
int parseFrom, parseTo;
373+
int parseFrom;
374+
int parseTo;
373375
bool layoutChanged = false;
374376
TextParser::TextParseMode tpmode = TextParser::TextParseMode::TPM_CACHE_READ;
375377

@@ -420,8 +422,7 @@ void BaseEditor::validate(int lno, bool rebuildRegions)
420422
}
421423
firstLine = newFirstLine;
422424
layoutChanged = true;
423-
COLORER_LOG_DEBUG("[BaseEditor] newFirstLine=%, parseFrom=%, parseTo=%", firstLine, parseFrom,
424-
parseTo);
425+
COLORER_LOG_DEBUG("[BaseEditor] newFirstLine=%, parseFrom=%, parseTo=%", firstLine, parseFrom, parseTo);
425426
}
426427

427428
if (!layoutChanged) {
@@ -445,7 +446,7 @@ void BaseEditor::validate(int lno, bool rebuildRegions)
445446
/* Runs parser */
446447
if (parseTo - parseFrom > 0) {
447448
COLORER_LOG_DEBUG("[BaseEditor] validate:parse:%-%, %", parseFrom, parseTo,
448-
tpmode == TextParser::TextParseMode::TPM_CACHE_READ ? "READ" : "UPDATE");
449+
tpmode == TextParser::TextParseMode::TPM_CACHE_READ ? "READ" : "UPDATE");
449450
int stopLine = textParser->parse(parseFrom, parseTo - parseFrom, tpmode);
450451

451452
if (tpmode == TextParser::TextParseMode::TPM_CACHE_UPDATE) {
@@ -518,7 +519,7 @@ void BaseEditor::leaveScheme(size_t lno, UnicodeString* line, int sx, int ex, co
518519
}
519520
}
520521

521-
bool BaseEditor::haveInvalidLine()
522+
bool BaseEditor::haveInvalidLine() const
522523
{
523524
return invalidLine < lineCount;
524525
}

colorer/src/Colorer-library/src/colorer/editor/BaseEditor.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_BASEEDITOR_H_
2-
#define _COLORER_BASEEDITOR_H_
1+
#ifndef COLORER_BASEEDITOR_H
2+
#define COLORER_BASEEDITOR_H
33

44
#include "colorer/LineSource.h"
55
#include "colorer/ParserFactory.h"
@@ -242,7 +242,7 @@ class BaseEditor : public RegionHandler
242242
void leaveScheme(size_t lno, UnicodeString* line, int sx, int ex, const Region* region,
243243
const Scheme* scheme) override;
244244

245-
bool haveInvalidLine();
245+
bool haveInvalidLine() const;
246246
void setMaxBlockSize(int max_block_size);
247247

248248
private:
@@ -276,7 +276,7 @@ class BaseEditor : public RegionHandler
276276
bool internalRM;
277277
bool regionCompact;
278278

279-
inline int getLastVisibleLine();
279+
inline int getLastVisibleLine() const;
280280
void remapLRS(bool recreate);
281281
/**
282282
* Searches for the paired token and creates PairMatch
@@ -285,4 +285,4 @@ class BaseEditor : public RegionHandler
285285
PairMatch* getPairMatch(int lineNo, int pos, LineRegion** line_region);
286286
};
287287

288-
#endif
288+
#endif // COLORER_BASEEDITOR_H

colorer/src/Colorer-library/src/colorer/editor/EditorListener.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_EDITORLISTENER_H_
2-
#define _COLORER_EDITORLISTENER_H_
1+
#ifndef COLORER_EDITORLISTENER_H
2+
#define COLORER_EDITORLISTENER_H
33

44
#include <memory>
55
/**
@@ -23,4 +23,4 @@ class EditorListener
2323
EditorListener& operator=(EditorListener&&) = delete;
2424
};
2525

26-
#endif
26+
#endif // COLORER_EDITORLISTENER_H

colorer/src/Colorer-library/src/colorer/editor/Outliner.cpp

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ OutlineItem* Outliner::getItem(size_t idx)
2424
return outline.at(idx);
2525
}
2626

27-
size_t Outliner::itemCount()
27+
size_t Outliner::itemCount() const
2828
{
2929
return outline.size();
3030
}
3131

3232
size_t Outliner::manageTree(std::vector<int>& treeStack, int newLevel)
3333
{
34-
while (treeStack.size() > 0 && newLevel < treeStack.back()) {
34+
while (!treeStack.empty() && newLevel < treeStack.back()) {
3535
treeStack.pop_back();
3636
}
37-
if (treeStack.size() == 0 || newLevel > treeStack.back()) {
37+
if (treeStack.empty() || newLevel > treeStack.back()) {
3838
treeStack.push_back(newLevel);
3939
return treeStack.size() - 1;
4040
}
@@ -44,7 +44,7 @@ size_t Outliner::manageTree(std::vector<int>& treeStack, int newLevel)
4444
return 0;
4545
}
4646

47-
bool Outliner::isOutlined(const Region* region)
47+
bool Outliner::isOutlined(const Region* region) const
4848
{
4949
return region->hasParent(searchRegion);
5050
}
@@ -92,7 +92,8 @@ void Outliner::addRegion(size_t lno, UnicodeString* line, int sx, int ex, const
9292

9393
if (lineIsEmpty) {
9494
outline.push_back(new OutlineItem(lno, sx, curLevel, &itemLabel, region));
95-
} else {
95+
}
96+
else {
9697
OutlineItem* thisItem = outline.back();
9798
if (thisItem->token != nullptr && thisItem->lno == lno) {
9899
thisItem->token->append(itemLabel);
@@ -101,12 +102,14 @@ void Outliner::addRegion(size_t lno, UnicodeString* line, int sx, int ex, const
101102
lineIsEmpty = false;
102103
}
103104

104-
void Outliner::enterScheme(size_t /*lno*/, UnicodeString* /*line*/, int /*sx*/, int /*ex*/, const Region* /*region*/, const Scheme* /*scheme*/)
105+
void Outliner::enterScheme(size_t /*lno*/, UnicodeString* /*line*/, int /*sx*/, int /*ex*/, const Region* /*region*/,
106+
const Scheme* /*scheme*/)
105107
{
106108
curLevel++;
107109
}
108110

109-
void Outliner::leaveScheme(size_t /*lno*/, UnicodeString* /*line*/, int /*sx*/, int /*ex*/, const Region* /*region*/, const Scheme* /*scheme*/)
111+
void Outliner::leaveScheme(size_t /*lno*/, UnicodeString* /*line*/, int /*sx*/, int /*ex*/, const Region* /*region*/,
112+
const Scheme* /*scheme*/)
110113
{
111114
curLevel--;
112115
}

colorer/src/Colorer-library/src/colorer/editor/Outliner.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Outliner : public RegionHandler, public EditorListener
5353
/**
5454
* Total number of currently available outline items
5555
*/
56-
size_t itemCount();
56+
size_t itemCount() const;
5757

5858
void startParsing(size_t lno) override;
5959
void endParsing(size_t lno) override;
@@ -64,7 +64,7 @@ class Outliner : public RegionHandler, public EditorListener
6464
void modifyEvent(size_t topLine) override;
6565

6666
protected:
67-
bool isOutlined(const Region* region);
67+
bool isOutlined(const Region* region) const;
6868

6969
BaseEditor* baseEditor;
7070
const Region* searchRegion;

colorer/src/Colorer-library/src/colorer/editor/PairMatch.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_PAIRMATCH_H_
2-
#define _COLORER_PAIRMATCH_H_
1+
#ifndef COLORER_PAIRMATCH_H
2+
#define COLORER_PAIRMATCH_H
33

44
#include "colorer/handlers/LineRegionsSupport.h"
55

@@ -101,4 +101,4 @@ class PairMatch
101101
LineRegion* startRef;
102102
};
103103

104-
#endif
104+
#endif // COLORER_PAIRMATCH_H

colorer/src/Colorer-library/src/colorer/handlers/LineRegion.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ void LineRegion::assigment(const LineRegion& lr)
2727

2828
LineRegion& LineRegion::operator=(const LineRegion& lr)
2929
{
30-
if (this == &lr)
31-
return *this;
32-
assigment(lr);
30+
if (this != &lr) {
31+
assigment(lr);
32+
}
3333
return *this;
3434
}
3535

@@ -45,12 +45,12 @@ LineRegion::LineRegion()
4545
special = false;
4646
}
4747

48-
const StyledRegion* LineRegion::styled()
48+
const StyledRegion* LineRegion::styled() const
4949
{
5050
return StyledRegion::cast(rdef);
5151
}
5252

53-
const TextRegion* LineRegion::texted()
53+
const TextRegion* LineRegion::texted() const
5454
{
5555
return TextRegion::cast(rdef);
5656
}

colorer/src/Colorer-library/src/colorer/handlers/LineRegion.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_LINEREGION_H_
2-
#define _COLORER_LINEREGION_H_
1+
#ifndef COLORER_LINEREGION_H
2+
#define COLORER_LINEREGION_H
33

44
#include "colorer/Scheme.h"
55
#include "colorer/handlers/RegionDefine.h"
@@ -50,12 +50,12 @@ class LineRegion
5050
/** Transforms this region's reference into styled region define
5151
and returns new pointer.
5252
*/
53-
const StyledRegion* styled();
53+
const StyledRegion* styled() const;
5454

5555
/** Transforms this region's reference into text region define
5656
and returns new pointer.
5757
*/
58-
const TextRegion* texted();
58+
const TextRegion* texted() const;
5959

6060
/** Copy operator */
6161
LineRegion& operator=(const LineRegion& lr);
@@ -73,4 +73,4 @@ class LineRegion
7373
void assigment(const LineRegion& lr);
7474
};
7575

76-
#endif
76+
#endif // COLORER_LINEREGION_H

colorer/src/Colorer-library/src/colorer/handlers/LineRegionsCompactSupport.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_LINEREGIONSCOMPACTSUPPORT_H_
2-
#define _COLORER_LINEREGIONSCOMPACTSUPPORT_H_
1+
#ifndef COLORER_LINEREGIONSCOMPACTSUPPORT_H
2+
#define COLORER_LINEREGIONSCOMPACTSUPPORT_H
33

44
#include "colorer/handlers/LineRegionsSupport.h"
55

@@ -23,4 +23,4 @@ class LineRegionsCompactSupport : public LineRegionsSupport
2323
void addLineRegion(size_t lno, LineRegion* ladd) override;
2424
};
2525

26-
#endif
26+
#endif // COLORER_LINEREGIONSCOMPACTSUPPORT_H

colorer/src/Colorer-library/src/colorer/handlers/LineRegionsSupport.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void LineRegionsSupport::resize(size_t lineCount_)
2424
this->lineCount = lineCount_;
2525
}
2626

27-
size_t LineRegionsSupport::size()
27+
size_t LineRegionsSupport::size() const
2828
{
2929
return lineCount;
3030
}
@@ -60,7 +60,7 @@ void LineRegionsSupport::setFirstLine(size_t first)
6060
firstLineNo = first;
6161
}
6262

63-
size_t LineRegionsSupport::getFirstLine()
63+
size_t LineRegionsSupport::getFirstLine() const
6464
{
6565
return firstLineNo;
6666
}

colorer/src/Colorer-library/src/colorer/handlers/LineRegionsSupport.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef _COLORER_LINEREGIONSSUPPORT_H_
2-
#define _COLORER_LINEREGIONSSUPPORT_H_
1+
#ifndef COLORER_LINEREGIONSSUPPORT_H
2+
#define COLORER_LINEREGIONSSUPPORT_H
33

44
#include "colorer/RegionHandler.h"
55
#include "colorer/handlers/LineRegion.h"
@@ -24,7 +24,7 @@ class LineRegionsSupport : public RegionHandler
2424
/**
2525
* Return current size of this line regions structure
2626
*/
27-
size_t size();
27+
size_t size() const;
2828

2929
/**
3030
* Drops all internal structures
@@ -41,7 +41,7 @@ class LineRegionsSupport : public RegionHandler
4141
/**
4242
* Returns first line position, installed in this line structures.
4343
*/
44-
size_t getFirstLine();
44+
size_t getFirstLine() const;
4545

4646
/**
4747
* Background region define, which is used to
@@ -98,4 +98,4 @@ class LineRegionsSupport : public RegionHandler
9898
size_t lineCount;
9999
};
100100

101-
#endif
101+
#endif // COLORER_LINEREGIONSSUPPORT_H

0 commit comments

Comments
 (0)