Merge pull request #1072 from RaiKoHoff/Dev_UCHARDET

Minor Fixes
This commit is contained in:
Rainer Kottenhoff 2019-03-20 23:56:38 +01:00 committed by GitHub
commit 82b5ed8679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 106 additions and 88 deletions

View File

@ -3214,8 +3214,8 @@ struct Sci_TextToFind {
<p><b id="SCI_SETCARETSTYLE">SCI_SETCARETSTYLE(int caretStyle)</b><br />
<b id="SCI_GETCARETSTYLE">SCI_GETCARETSTYLE &rarr; int</b><br />
The style of the caret can be set with <code>SCI_SETCARETSTYLE</code> to be a line caret
(CARETSTYLE_LINE=1) or a block caret (CARETSTYLE_BLOCK=2) for insert mode combined with
a bar caret (CARETSTYLE_OVERSTRIKE_BAR=0) or a block caret (CARETSTYLE_OVERSTRIKE_BLOCK=16) for overtype mode,
(CARETSTYLE_LINE=1) or a block caret (CARETSTYLE_BLOCK=2) for insert mode (lower 4-bits, CARETSTYLE_INS_MASK) combined with
a bar caret (CARETSTYLE_OVERSTRIKE_BAR=0) or a block caret (CARETSTYLE_OVERSTRIKE_BLOCK=16) for overtype mode (bit 4),
or to not draw at all (CARETSTYLE_INVISIBLE=0). The default value for insert mode is the line caret (CARETSTYLE_LINE=1),
for overtype mode is the bar caret (CARETSTYLE_OVERSTRIKE_BAR=0).
You can determine the current caret style setting using <code>SCI_GETCARETSTYLE</code>.</p>

View File

@ -541,6 +541,7 @@
</tr><tr>
<td>Jad Altahan</td>
<td>Andrea Ricchi</td>
<td>Juarez Rudsatz</td>
</tr>
</table>
<p>

View File

@ -112,6 +112,18 @@ public:
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
}
bool operator!=(Point other) const noexcept {
return (x != other.x) || (y != other.y);
}
Point operator+(Point other) const noexcept {
return Point(x + other.x, y + other.y);
}
Point operator-(Point other) const noexcept {
return Point(x - other.x, y - other.y);
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
};

View File

@ -835,6 +835,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define CARETSTYLE_BLOCK 2
#define CARETSTYLE_OVERSTRIKE_BAR 0
#define CARETSTYLE_OVERSTRIKE_BLOCK 16
#define CARETSTYLE_INS_MASK 0xF
#define SCI_SETCARETSTYLE 2512
#define SCI_GETCARETSTYLE 2513
#define SCI_SETINDICATORCURRENT 2500

View File

@ -2187,6 +2187,7 @@ val CARETSTYLE_LINE=1
val CARETSTYLE_BLOCK=2
val CARETSTYLE_OVERSTRIKE_BAR=0
val CARETSTYLE_OVERSTRIKE_BLOCK=16
val CARETSTYLE_INS_MASK=0xF
# Set the style of the caret to be drawn.
set void SetCaretStyle=2512(int caretStyle,)

View File

@ -1150,13 +1150,9 @@ slop | strict | jumps | even | Caret can go to the margin | When
Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options) {
const PRectangle rcClient = GetTextRectangle();
Point pt = LocationFromPosition(range.caret);
Point ptAnchor = LocationFromPosition(range.anchor);
const Point ptOrigin = GetVisibleOriginInMain();
pt.x += ptOrigin.x;
pt.y += ptOrigin.y;
ptAnchor.x += ptOrigin.x;
ptAnchor.y += ptOrigin.y;
const Point pt = LocationFromPosition(range.caret) + ptOrigin;
const Point ptAnchor = LocationFromPosition(range.anchor) + ptOrigin;
const Point ptBottomCaret(pt.x, pt.y + vs.lineHeight - 1);
XYScrollPosition newXY(xOffset, topLine);
@ -4176,9 +4172,10 @@ void Editor::GoToLine(Sci::Line lineNo) {
}
static bool Close(Point pt1, Point pt2, Point threshold) noexcept {
if (std::abs(pt1.x - pt2.x) > threshold.x)
const Point ptDifference = pt2 - pt1;
if (std::abs(ptDifference.x) > threshold.x)
return false;
if (std::abs(pt1.y - pt2.y) > threshold.y)
if (std::abs(ptDifference.y) > threshold.y)
return false;
return true;
}
@ -4268,9 +4265,8 @@ void Editor::DisplayCursor(Window::Cursor c) {
}
bool Editor::DragThreshold(Point ptStart, Point ptNow) {
const XYPOSITION xMove = ptStart.x - ptNow.x;
const XYPOSITION yMove = ptStart.y - ptNow.y;
const XYPOSITION distanceSquared = xMove * xMove + yMove * yMove;
const Point ptDiff = ptStart - ptNow;
const XYPOSITION distanceSquared = ptDiff.x * ptDiff.x + ptDiff.y * ptDiff.y;
return distanceSquared > 16.0f;
}
@ -4750,7 +4746,7 @@ Range Editor::GetHotSpotRange() const noexcept {
}
void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, int modifiers) {
if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) {
if (ptMouseLast != pt) {
DwellEnd(true);
}

View File

@ -260,7 +260,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
Editor(Editor &&) = delete;
Editor &operator=(const Editor &) = delete;
Editor &operator=(Editor &&) = delete;
~Editor() override;
// ~Editor() in public section
virtual void Initialise() = 0;
virtual void Finalise();
@ -599,6 +599,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len) noexcept;
public:
~Editor() override;
// Public so the COM thunks can access it.
bool IsUnicodeMode() const noexcept;
// Public so scintilla_send_message can use it.

View File

@ -15,7 +15,7 @@ class ElapsedPeriod {
std::chrono::high_resolution_clock::time_point tp;
public:
/// Capture the moment
ElapsedPeriod() : tp(std::chrono::high_resolution_clock::now()) {
ElapsedPeriod() noexcept : tp(std::chrono::high_resolution_clock::now()) {
}
/// Return duration as floating point seconds
double Duration(bool reset=false) {

View File

@ -13,9 +13,9 @@ namespace Scintilla {
struct StyleAndColour {
int style;
ColourDesired fore;
StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) {
StyleAndColour() noexcept : style(INDIC_PLAIN), fore(0, 0, 0) {
}
StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) {
StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) noexcept : style(style_), fore(fore_) {
}
bool operator==(const StyleAndColour &other) const {
return (style == other.style) && (fore == other.fore);
@ -33,9 +33,9 @@ public:
int fillAlpha;
int outlineAlpha;
int attributes;
Indicator() : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) {
Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) {
}
Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) :
Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept :
sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) {
}
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, DrawState drawState, int value) const;

View File

@ -25,7 +25,7 @@ class KeyModifiers {
public:
int key;
int modifiers;
KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) {
KeyModifiers(int key_, int modifiers_) noexcept : key(key_), modifiers(modifiers_) {
}
bool operator<(const KeyModifiers &other) const {
if (key == other.key)

View File

@ -17,7 +17,7 @@ namespace Scintilla {
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber(int handle_, int number_) : handle(handle_), number(number_) {}
MarkerHandleNumber(int handle_, int number_) noexcept : handle(handle_), number(number_) {}
};
/**

View File

@ -276,9 +276,7 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list
pt = PointMainCaret();
}
if (wMargin.Created()) {
const Point ptOrigin = GetVisibleOriginInMain();
pt.x += ptOrigin.x;
pt.y += ptOrigin.y;
pt = pt + GetVisibleOriginInMain();
}
PRectangle rcac;
rcac.left = pt.x - ac.lb->CaretFromEdge();
@ -463,9 +461,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
}
if (wMargin.Created()) {
const Point ptOrigin = GetVisibleOriginInMain();
pt.x += ptOrigin.x;
pt.y += ptOrigin.y;
pt = pt + GetVisibleOriginInMain();
}
PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt,
vs.lineHeight,

View File

@ -57,7 +57,7 @@ protected:
ScintillaBase(ScintillaBase &&) = delete;
ScintillaBase &operator=(const ScintillaBase &) = delete;
ScintillaBase &operator=(ScintillaBase &&) = delete;
~ScintillaBase() override;
// ~ScintillaBase() in public section
void Initialise() override {}
void Finalise() override;
@ -90,6 +90,8 @@ protected:
void NotifyLexerChanged(Document *doc, void *userData) override;
public:
~ScintillaBase() override;
// Public so scintilla_send_message can use it
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
};

View File

@ -177,7 +177,7 @@ void SelectionRange::MinimizeVirtualSpace() {
}
}
Selection::Selection() : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) {
Selection::Selection() noexcept : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) {
AddSelection(SelectionRange(SelectionPosition(0)));
}

View File

@ -14,7 +14,7 @@ class SelectionPosition {
Sci::Position position;
Sci::Position virtualSpace;
public:
explicit SelectionPosition(Sci::Position position_=INVALID_POSITION, Sci::Position virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) {
explicit SelectionPosition(Sci::Position position_=INVALID_POSITION, Sci::Position virtualSpace_=0) noexcept : position(position_), virtualSpace(virtualSpace_) {
PLATFORM_ASSERT(virtualSpace < 800000);
if (virtualSpace < 0)
virtualSpace = 0;
@ -84,15 +84,15 @@ struct SelectionRange {
SelectionPosition caret;
SelectionPosition anchor;
SelectionRange() : caret(), anchor() {
SelectionRange() noexcept : caret(), anchor() {
}
explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) {
explicit SelectionRange(SelectionPosition single) noexcept : caret(single), anchor(single) {
}
explicit SelectionRange(Sci::Position single) : caret(single), anchor(single) {
explicit SelectionRange(Sci::Position single) noexcept : caret(single), anchor(single) {
}
SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) {
SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) noexcept : caret(caret_), anchor(anchor_) {
}
SelectionRange(Sci::Position caret_, Sci::Position anchor_) : caret(caret_), anchor(anchor_) {
SelectionRange(Sci::Position caret_, Sci::Position anchor_) noexcept : caret(caret_), anchor(anchor_) {
}
bool Empty() const {
return anchor == caret;
@ -141,7 +141,7 @@ public:
enum selTypes { noSel, selStream, selRectangle, selLines, selThin };
selTypes selType;
Selection();
Selection() noexcept;
~Selection();
bool IsRectangular() const;
Sci::Position MainCaret() const;

View File

@ -27,8 +27,6 @@
#include "Style.h"
#include "ViewStyle.h"
#define CARETSTYLE_INS_MASK 0xF
using namespace Scintilla;
MarginStyle::MarginStyle(int style_, int width_, int mask_) :

View File

@ -74,9 +74,9 @@ constexpr int GetFontSizeZoomed(int size, int zoomLevel) noexcept {
class ColourOptional : public ColourDesired {
public:
bool isSet;
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) {
ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) noexcept : ColourDesired(colour_), isSet(isSet_) {
}
ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast<int>(lParam)), isSet(wParam != 0) {
ColourOptional(uptr_t wParam, sptr_t lParam) noexcept : ColourDesired(static_cast<int>(lParam)), isSet(wParam != 0) {
}
};
@ -88,10 +88,10 @@ struct ForeBackColours {
struct EdgeProperties {
int column;
ColourDesired colour;
EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) :
EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) noexcept :
column(column_), colour(colour_) {
}
EdgeProperties(uptr_t wParam, sptr_t lParam) :
EdgeProperties(uptr_t wParam, sptr_t lParam) noexcept :
column(static_cast<int>(wParam)), colour(static_cast<int>(lParam)) {
}
};

View File

@ -2797,9 +2797,7 @@ void ListBoxX::ResizeToCursor() {
PRectangle rc = GetPosition();
POINT ptw;
::GetCursorPos(&ptw);
Point pt = Point::FromInts(ptw.x, ptw.y);
pt.x += dragOffset.x;
pt.y += dragOffset.y;
const Point pt = Point::FromInts(ptw.x, ptw.y) + dragOffset;
switch (resizeHit) {
case HTLEFT:

View File

@ -373,7 +373,7 @@ class ScintillaWin :
#endif
explicit ScintillaWin(HWND hwnd);
~ScintillaWin() override;
// ~ScintillaWin() in public section
void Init();
void Finalise() noexcept override;
@ -477,6 +477,7 @@ class ScintillaWin :
sptr_t GetText(uptr_t wParam, sptr_t lParam);
public:
~ScintillaWin() override;
// Deleted so ScintillaWin objects can not be copied.
ScintillaWin(const ScintillaWin &) = delete;
ScintillaWin(ScintillaWin &&) = delete;

View File

@ -1052,37 +1052,45 @@ bool EditLoadFile(
return false;
}
bool bNfoDizDetected = false;
if (Settings.LoadNFOasOEM)
{
if (lpszExt && !(StringCchCompareXI(lpszExt, L".nfo") && StringCchCompareXI(lpszExt, L".diz")))
bNfoDizDetected = true;
}
// --------------------------------------------------------------------------
// Encoding Detection
// --------------------------------------------------------------------------
cpi_enc_t iPreferredEncoding = Settings.LoadASCIIasUTF8 ? CPI_UTF8 : CPI_ANSI_DEFAULT;
// --- 1st check for force encodings ---
bool const bNfoDizDetected = (lpszExt && !(StringCchCompareXI(lpszExt, L".nfo") && StringCchCompareXI(lpszExt, L".diz")));
cpi_enc_t iForcedEncoding = Globals.bForceReLoadAsUTF8 ? CPI_UTF8 :
((Settings.LoadNFOasOEM && bNfoDizDetected) ? Globals.DOSEncoding : Encoding_SrcCmdLn(CPI_GET));
// --- 2nd Use Encoding Analysis if applicable
size_t const cbNbytes4Analysis = (cbData < 200000L) ? cbData : 200000L;
cpi_enc_t iPreferedEncoding = (bNfoDizDetected) ? Globals.DOSEncoding :
((Settings.UseDefaultForFileEncoding || (cbNbytes4Analysis == 0)) ? Settings.DefaultEncoding : CPI_ANSI_DEFAULT);
// --------------------------------------------------------------------------
float confidence = 0.0f;
cpi_enc_t iAnalyzedEncoding = Encoding_AnalyzeText(lpData, cbNbytes4Analysis, &confidence, iPreferedEncoding);
cpi_enc_t iAnalyzedEncoding = iForcedEncoding;
bool const bIsReliable = (confidence >= Settings2.AnalyzeReliableConfidenceLevel);
if (Encoding_IsNONE(iForcedEncoding) || bForceEncDetection)
{
iAnalyzedEncoding = Encoding_AnalyzeText(lpData, cbNbytes4Analysis, &confidence, iPreferredEncoding);
if (Flags.bDevDebugMode) {
if (Flags.bDevDebugMode) {
#if 1
SetAdditionalTitleInfo(Encoding_GetTitleInfoW());
SetAdditionalTitleInfo(Encoding_GetTitleInfoW());
#else
DocPos const iPos = SciCall_PositionFromLine(SciCall_GetFirstVisibleLine());
int const iXOff = SciCall_GetXOffset();
SciCall_SetXOffset(0);
SciCall_CallTipShow(iPos, Encoding_GetTitleInfoA());
SciCall_SetXOffset(iXOff);
Globals.CallTipType = CT_ENC_INFO;
DocPos const iPos = SciCall_PositionFromLine(SciCall_GetFirstVisibleLine());
int const iXOff = SciCall_GetXOffset();
SciCall_SetXOffset(0);
SciCall_CallTipShow(iPos, Encoding_GetTitleInfoA());
SciCall_SetXOffset(iXOff);
Globals.CallTipType = CT_ENC_INFO;
#endif
}
}
bool const bIsReliable = (confidence >= Settings2.AnalyzeReliableConfidenceLevel);
// ------------------------------------------------------
@ -1091,7 +1099,7 @@ bool EditLoadFile(
bool const bIsUnicode = Encoding_IsUTF8(iAnalyzedEncoding) || Encoding_IsUNICODE(iAnalyzedEncoding);
if (iAnalyzedEncoding == CPI_ASCII_7BIT) {
iAnalyzedEncoding = Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferedEncoding; // stay on preferred
iAnalyzedEncoding = Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferredEncoding; // stay on preferred
}
else {
if ((bSkipUTFDetection && bIsUnicode) || (bSkipANSICPDetection && !bIsUnicode)) {
@ -1101,32 +1109,32 @@ bool EditLoadFile(
}
// --------------------------------------------------------------------------
cpi_enc_t iForcedEncoding = Globals.bForceLoadASCIIasUTF8 ? CPI_UTF8 : Encoding_SrcCmdLn(CPI_GET);
if (Encoding_IsNONE(iForcedEncoding) && bNfoDizDetected) {
iForcedEncoding = Globals.DOSEncoding;
}
if (bForceEncDetection && !Encoding_IsNONE(iAnalyzedEncoding)) {
iForcedEncoding = iAnalyzedEncoding; // no bIsReliable check (forced unreliable detection)
}
// --------------------------------------------------------------------------
// --- 3rd Unicode Checks
bool const bIsForced = !Encoding_IsNONE(iForcedEncoding);
bool const bIsUnicodeForced = Encoding_IsUNICODE(iForcedEncoding);
// choose best encoding guess
cpi_enc_t const iFileEncWeak = Encoding_SrcWeak(CPI_GET);
// remap Preferred Encoding
if (bIsForced) {
iPreferedEncoding = iForcedEncoding;
iPreferredEncoding = iForcedEncoding;
}
else if (!Encoding_IsNONE(iFileEncWeak)) {
iPreferedEncoding = iFileEncWeak;
iPreferredEncoding = iFileEncWeak;
}
else if (!Encoding_IsNONE(iAnalyzedEncoding) && (bIsReliable || !Settings.UseReliableCEDonly)) {
iPreferedEncoding = iAnalyzedEncoding;
iPreferredEncoding = iAnalyzedEncoding;
}
else if (Encoding_IsNONE(iPreferedEncoding)) {
iPreferedEncoding = CPI_ANSI_DEFAULT;
else if (Encoding_IsNONE(iPreferredEncoding)) {
iPreferredEncoding = Settings.LoadASCIIasUTF8 ? CPI_UTF8 : CPI_ANSI_DEFAULT;
}
// --------------------------------------------------------------------------
@ -1141,7 +1149,7 @@ bool EditLoadFile(
if (cbData == 0) {
FileVars_Init(NULL,0,&Globals.fvCurFile);
status->iEOLMode = Settings.DefaultEOLMode;
status->iEncoding = bIsForced ? iForcedEncoding : (Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferedEncoding);
status->iEncoding = bIsForced ? iForcedEncoding : (Settings.LoadASCIIasUTF8 ? CPI_UTF8 : iPreferredEncoding);
EditSetNewText(hwnd,"",0);
SciCall_SetEOLMode(Settings.DefaultEOLMode);
FreeMem(lpData);
@ -1204,7 +1212,7 @@ bool EditLoadFile(
bool const bValidUTF8 = IsValidUTF8(lpData, cbData);
bool const bForcedUTF8 = Encoding_IsUTF8(iForcedEncoding) || (FileVars_IsUTF8(&Globals.fvCurFile) && !Settings.NoEncodingTags);
bool const bAnalysisUTF8 = Encoding_IsUTF8(iAnalyzedEncoding) && bIsReliable;
bool const bSoftHintUTF8 = Encoding_IsUTF8(iAnalyzedEncoding) && Encoding_IsUTF8(iPreferedEncoding); // non-reliable analysis = soft-hint
bool const bSoftHintUTF8 = Encoding_IsUTF8(iAnalyzedEncoding) && Encoding_IsUTF8(iPreferredEncoding); // non-reliable analysis = soft-hint
bool const bRejectUTF8 = !bValidUTF8 || (!bIsUTF8Sig && bSkipUTFDetection);
@ -1232,7 +1240,7 @@ bool EditLoadFile(
status->iEncoding = FileVars_GetEncoding(&Globals.fvCurFile);
if (Encoding_IsNONE(status->iEncoding))
{
status->iEncoding = ((Globals.fvCurFile.mask & FV_ENCODING) ? CPI_ANSI_DEFAULT : iPreferedEncoding);
status->iEncoding = ((Globals.fvCurFile.mask & FV_ENCODING) ? CPI_ANSI_DEFAULT : iPreferredEncoding);
}
}
@ -1273,7 +1281,7 @@ bool EditLoadFile(
}
}
else {
status->iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferedEncoding;
status->iEncoding = Encoding_IsValid(iForcedEncoding) ? iForcedEncoding : iPreferredEncoding;
EditSetNewText(hwnd,"",0);
EditSetNewText(hwnd,lpData,cbData);
EditDetectEOLMode(lpData, cbData, status);

View File

@ -441,7 +441,7 @@ static void _InitGlobals()
Globals.iAvailLngCount = 1;
Globals.iWrapCol = 0;
Globals.bCodeFoldingAvailable = false;
Globals.bForceLoadASCIIasUTF8 = false;
Globals.bForceReLoadAsUTF8 = false;
Globals.DOSEncoding = CPI_NONE;
Globals.bZeroBasedColumnIndex = false;
Globals.bZeroBasedCharacterCount = false;
@ -5488,10 +5488,10 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
if (StringCchLenW(Globals.CurrentFile,COUNTOF(Globals.CurrentFile)))
{
Globals.bForceLoadASCIIasUTF8 = true;
Globals.bForceReLoadAsUTF8 = true;
StringCchCopy(tchMaxPathBuffer,COUNTOF(tchMaxPathBuffer),Globals.CurrentFile);
FileLoad(false, false, true, true, true, false, tchMaxPathBuffer);
Globals.bForceLoadASCIIasUTF8 = false;
Globals.bForceReLoadAsUTF8 = false;
}
}
break;
@ -5501,7 +5501,7 @@ LRESULT MsgCommand(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
{
if (StringCchLenW(Globals.CurrentFile, COUNTOF(Globals.CurrentFile)))
{
Globals.bForceLoadASCIIasUTF8 = false;
Globals.bForceReLoadAsUTF8 = false;
StringCchCopy(tchMaxPathBuffer, COUNTOF(tchMaxPathBuffer), Globals.CurrentFile);
FileLoad(false, false, true, false, false, true, tchMaxPathBuffer);
}

View File

@ -249,8 +249,10 @@ bool Style_InsertThemesMenu(HMENU hMenuBar)
HMENU hmenuThemes = CreatePopupMenu();
int const pos = GetMenuItemCount(hMenuBar) - 1;
GetLngString(IDM_THEMES_DEFAULT, Theme_Files[0].szName, COUNTOF(Theme_Files[0].szName));
AppendMenu(hmenuThemes, MF_ENABLED | MF_STRING, Theme_Files[0].rid, Theme_Files[0].szName);
GetLngString(IDM_THEMES_FILE_ITEM, Theme_Files[1].szName, COUNTOF(Theme_Files[1].szName));
AppendMenu(hmenuThemes, MF_ENABLED | MF_STRING, Theme_Files[1].rid, Theme_Files[1].szName);
for (unsigned i = 2; i < ThemeItems_CountOf(); ++i)

View File

@ -302,7 +302,7 @@ typedef struct _globals_t
int iWrapCol;
bool bCodeFoldingAvailable;
bool bForceLoadASCIIasUTF8;
bool bForceReLoadAsUTF8;
bool bZeroBasedColumnIndex;
bool bZeroBasedCharacterCount;
int iReplacedOccurrences;