mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
+ rev: revert CreateDocument and SetDocPointer (hangs on WndPaint/PaintDC) - no solution yet
This commit is contained in:
parent
c47987c693
commit
6c27294f07
@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.20.227.1"
|
||||
version="5.20.227.2"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 RC2</description>
|
||||
|
||||
@ -2078,56 +2078,81 @@ bool MRU_MergeSave(LPMRULIST pmru, bool bAddFiles, bool bRelativePath, bool bUne
|
||||
// EditSetDocumentBuffer() - Set Document Buffer for Scintilla Edit Component
|
||||
//
|
||||
|
||||
static bool _CreateNewDocument(const char* lpstrText, DocPosU lenText, int docOptions)
|
||||
// @@@ NOTE: CreateDocument and SetDocPointer hangs on WndPaint()/PaintDC()
|
||||
// need to debug deeper ....
|
||||
|
||||
#if FALSE
|
||||
static bool CreateNewDocument(const char* lpstrText, DocPosU lenText, int docOptions)
|
||||
{
|
||||
#define RELEASE_RETURN(ret) { pDocLoad->Release(); return(ret); }
|
||||
#define RELEASE_RETURN(ret) { pDocLoad->Release(); return(ret); }
|
||||
|
||||
ILoader* const pDocLoad = reinterpret_cast<ILoader*>(SciCall_CreateLoader(static_cast<Sci_Position>(lenText) + 1, docOptions));
|
||||
|
||||
if (SC_STATUS_OK != pDocLoad->AddData(lpstrText, lenText)) {
|
||||
RELEASE_RETURN(false);
|
||||
if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_SetDocPointer(0);
|
||||
}
|
||||
sptr_t const pNewDocumentPtr = (sptr_t)pDocLoad->ConvertToDocument(); // == SciCall_CreateDocument(lenText, docOptions);
|
||||
if (!pNewDocumentPtr) {
|
||||
RELEASE_RETURN(false);
|
||||
}
|
||||
SciCall_SetDocPointer(pNewDocumentPtr);
|
||||
RELEASE_RETURN(true);
|
||||
}
|
||||
|
||||
extern "C" bool EditSetDocumentBuffer(const char* lpstrText, DocPosU lenText)
|
||||
{
|
||||
bool const bLargerThan2GB = (lenText >= ((DocPosU)INT32_MAX));
|
||||
bool const bLargeFileLoaded = (lenText >= ((DocPosU)Settings2.FileLoadWarningMB * 1024ULL * 1024ULL));
|
||||
|
||||
int const curOptions = SciCall_GetDocumentOptions();
|
||||
|
||||
bool result = false;
|
||||
|
||||
if (!bLargeFileLoaded && (curOptions & (SC_DOCUMENTOPTION_STYLES_NONE | SC_DOCUMENTOPTION_TEXT_LARGE)))
|
||||
{
|
||||
int const docOptions = SC_DOCUMENTOPTION_DEFAULT;
|
||||
result = _CreateNewDocument(lpstrText, lenText, docOptions);
|
||||
}
|
||||
else if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_ClearAll();
|
||||
result = true;
|
||||
}
|
||||
else if (bLargeFileLoaded)
|
||||
{
|
||||
#ifdef NP3_LARGE_DOCUMENT_STYLES_NONE
|
||||
int const docOptions = bLargeFileLoaded ? (bLargerThan2GB ? SC_DOCUMENTOPTION_TEXT_LARGE : SC_DOCUMENTOPTION_STYLES_NONE) : SC_DOCUMENTOPTION_DEFAULT;
|
||||
else {
|
||||
#if 1
|
||||
sptr_t const pNewDocumentPtr = SciCall_CreateDocument(lenText, docOptions);
|
||||
if (pNewDocumentPtr) {
|
||||
SciCall_SetDocPointer(pNewDocumentPtr);
|
||||
SciCall_ReleaseDocument(pNewDocumentPtr);
|
||||
}
|
||||
else {
|
||||
SciCall_SetDocPointer(0);
|
||||
}
|
||||
SciCall_TargetWholeDocument();
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
#else
|
||||
int const docOptions = bLargeFileLoaded ? (bLargerThan2GB ? SC_DOCUMENTOPTION_TEXT_LARGE : SC_DOCUMENTOPTION_DEFAULT) : SC_DOCUMENTOPTION_DEFAULT;
|
||||
#endif
|
||||
ILoader* const pDocLoad = reinterpret_cast<ILoader*>(SciCall_CreateLoader(static_cast<Sci_Position>(lenText) + 1, docOptions));
|
||||
|
||||
result = _CreateNewDocument(lpstrText, lenText, docOptions);
|
||||
if (SC_STATUS_OK != pDocLoad->AddData(lpstrText, lenText)) {
|
||||
RELEASE_RETURN(false);
|
||||
}
|
||||
sptr_t const pNewDocumentPtr = (sptr_t)pDocLoad->ConvertToDocument(); // == SciCall_CreateDocument(lenText, docOptions);
|
||||
if (!pNewDocumentPtr) {
|
||||
RELEASE_RETURN(false);
|
||||
}
|
||||
SciCall_SetDocPointer(pNewDocumentPtr);
|
||||
SciCall_ReleaseDocument(pNewDocumentPtr);
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
static bool CreateNewDocument(const char* lpstrText, DocPosU lenText, int docOptions)
|
||||
{
|
||||
UNUSED(docOptions);
|
||||
if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_ClearAll();
|
||||
}
|
||||
else {
|
||||
SciCall_TargetWholeDocument();
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" bool EditSetDocumentBuffer(const char* lpstrText, DocPosU lenText)
|
||||
{
|
||||
bool const bLargerThan2GB = (lenText >= ((DocPosU)INT32_MAX));
|
||||
bool const bLargeFileLoaded = (lenText >= ((DocPosU)Settings2.FileLoadWarningMB << 20));
|
||||
int const docOptions = bLargeFileLoaded ? (bLargerThan2GB ? SC_DOCUMENTOPTION_TEXT_LARGE : SC_DOCUMENTOPTION_STYLES_NONE)
|
||||
: SC_DOCUMENTOPTION_DEFAULT;
|
||||
|
||||
if (SciCall_GetDocumentOptions() != docOptions)
|
||||
{
|
||||
// we have to create a new document with changed options
|
||||
return CreateNewDocument(lpstrText, lenText, docOptions);
|
||||
}
|
||||
else {
|
||||
if (!lpstrText || (lenText == 0)) {
|
||||
SciCall_ClearAll();
|
||||
}
|
||||
else {
|
||||
SciCall_TargetWholeDocument();
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
56
src/Edit.c
56
src/Edit.c
@ -307,54 +307,6 @@ void EditInitWordDelimiter(HWND hwnd)
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditSetNewText()
|
||||
//
|
||||
extern bool bFreezeAppTitle;
|
||||
|
||||
void XXX_EditSetNewText(HWND hwnd, const char* lpstrText, DocPosU lenText, bool bClearUndoHistory)
|
||||
{
|
||||
bFreezeAppTitle = true;
|
||||
|
||||
// clear markers, flags and positions
|
||||
if (bClearUndoHistory) { UndoRedoRecordingStop(); }
|
||||
if (FocusedView.HideNonMatchedLines) { EditToggleView(hwnd); }
|
||||
_IGNORE_NOTIFY_CHANGE_;
|
||||
SciCall_Cancel();
|
||||
if (SciCall_GetReadOnly()) { SciCall_SetReadOnly(false); }
|
||||
SciCall_MarkerDeleteAll(MARKER_NP3_BOOKMARK);
|
||||
EditClearAllOccurrenceMarkers(hwnd);
|
||||
SciCall_SetScrollWidth(1);
|
||||
SciCall_SetXOffset(0);
|
||||
_OBSERVE_NOTIFY_CHANGE_;
|
||||
|
||||
FileVars_Apply(&Globals.fvCurFile);
|
||||
|
||||
// set new text
|
||||
if (lenText > 0) {
|
||||
_IGNORE_NOTIFY_CHANGE_;
|
||||
SciCall_TargetWholeDocument();
|
||||
SciCall_ReplaceTarget(lenText, lpstrText);
|
||||
_OBSERVE_NOTIFY_CHANGE_;
|
||||
}
|
||||
else {
|
||||
SciCall_ClearAll();
|
||||
}
|
||||
|
||||
SciCall_GotoPos(0);
|
||||
SciCall_ChooseCaretX();
|
||||
|
||||
if (bClearUndoHistory) {
|
||||
SciCall_SetSavePoint();
|
||||
UndoRedoRecordingStart();
|
||||
}
|
||||
|
||||
bFreezeAppTitle = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// EditSetNewText()
|
||||
@ -363,10 +315,10 @@ extern bool bFreezeAppTitle;
|
||||
|
||||
void EditSetNewText(HWND hwnd, const char* lpstrText, DocPosU lenText, bool bClearUndoHistory)
|
||||
{
|
||||
bFreezeAppTitle = true;
|
||||
|
||||
if (!lpstrText) { lenText = 0; }
|
||||
|
||||
bFreezeAppTitle = true;
|
||||
|
||||
// clear markers, flags and positions
|
||||
if (bClearUndoHistory) { UndoRedoRecordingStop(); }
|
||||
if (FocusedView.HideNonMatchedLines) { EditToggleView(hwnd); }
|
||||
@ -7441,9 +7393,7 @@ void EditDoStyling(DocPos iStartPos, DocPos iEndPos)
|
||||
{
|
||||
static bool guard = false; // protect against recursion by notification event SCN_STYLENEEDED
|
||||
|
||||
#ifdef NP3_LARGE_DOCUMENT_STYLES_NONE
|
||||
if (Flags.bLargeFileLoaded) { return; }
|
||||
#endif
|
||||
//~if (Flags.bLargeFileLoaded) { return; }
|
||||
|
||||
if (!guard)
|
||||
{
|
||||
|
||||
13
src/Styles.c
13
src/Styles.c
@ -968,17 +968,6 @@ static inline bool _IsItemInStyleString(LPCWSTR lpszStyleStrg, LPCWSTR item)
|
||||
//
|
||||
void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
{
|
||||
#ifdef NP3_LARGE_DOCUMENT_STYLES_NONE
|
||||
if (Flags.bLargeFileLoaded)
|
||||
{
|
||||
s_pLexCurrent = GetLargeFileLexer();
|
||||
SciCall_SetIdleStyling(SC_IDLESTYLING_ALL);
|
||||
SciCall_StartStyling(0);
|
||||
UpdateAllBars(false);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Select standard if NULL is specified
|
||||
if (!pLexNew) {
|
||||
pLexNew = Flags.bLargeFileLoaded ? GetLargeFileLexer() : GetDefaultLexer();
|
||||
@ -1480,6 +1469,8 @@ void Style_SetLexer(HWND hwnd, PEDITLEXER pLexNew)
|
||||
|
||||
Style_SetInvisible(hwnd, false); // set fixed invisible style
|
||||
|
||||
SciCall_StartStyling(0);
|
||||
|
||||
// apply lexer styles
|
||||
if (Flags.bLargeFileLoaded)
|
||||
{
|
||||
|
||||
@ -653,8 +653,6 @@ typedef struct _themeFiles
|
||||
|
||||
// --------- common defines --------
|
||||
|
||||
#define NP3_LARGE_DOCUMENT_STYLES_NONE 1
|
||||
|
||||
#define NOTEPAD3_MODULE_DIR_ENV_VAR L"NOTEPAD3MODULEDIR"
|
||||
|
||||
//~#define NP3_VIRTUAL_SPACE_ACCESS_OPTIONS (Settings2.DenyVirtualSpaceAccess ? SCVS_NONE : (SCVS_RECTANGULARSELECTION | SCVS_NOWRAPLINESTART | SCVS_USERACCESSIBLE))
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 20
|
||||
#define VERSION_REV 227
|
||||
#define VERSION_BUILD 1
|
||||
#define VERSION_BUILD 2
|
||||
#define SCINTILLA_VER 430
|
||||
#define ONIGURUMA_REGEX_VER 6.9.4
|
||||
#define UCHARDET_VER 2018.09.27
|
||||
|
||||
Loading…
Reference in New Issue
Block a user