Fix doc being wronly marked as saved bug after converting its encoding
Fix #11436, close #11440
This commit is contained in:
parent
66ca02a015
commit
48ee390cdd
|
@ -7233,6 +7233,7 @@ static const QuoteParams quotes[] =
|
|||
{TEXT("Anonymous #188"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("*Knock knock*\n\"Race condition\"\n\"Who's there?\"\n") },
|
||||
{TEXT("Anonymous #189"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("The two most difficult programming challenges are naming things, cache invalidation, and off-by-one errors.\n") },
|
||||
{TEXT("Anonymous #190"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("The greatest security vulnerability in any computer system is located between the keyboard and the chair.\n") },
|
||||
{TEXT("Anonymous #191"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("My biggest talent is always being able to tell what's in a wrapped present.\n\nIt's a gift.\n") },
|
||||
{TEXT("xkcd"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Never have I felt so close to another soul\nAnd yet so helplessly alone\nAs when I Google an error\nAnd there's one result\nA thread by someone with the same problem\nAnd no answer\nLast posted to in 2003\n\n\"Who were you, DenverCoder9?\"\n\"What did you see?!\"\n\n(ref: https://xkcd.com/979/)") },
|
||||
{TEXT("A developer"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("No hugs & kisses.\nOnly bugs & fixes.") },
|
||||
{TEXT("Elon Musk"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Don't set your password as your child's name.\nName your child after your password.") },
|
||||
|
@ -7260,6 +7261,7 @@ static const QuoteParams quotes[] =
|
|||
{TEXT("Chewbacca"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("Uuuuuuuuuur Ahhhhrrrrrr\nUhrrrr Ahhhhrrrrrr\nAaaarhg...")},
|
||||
{TEXT("Alexandria Ocasio-Cortez"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("No one ever makes a billion dollars.\nYou TAKE a billion dollars.")},
|
||||
{TEXT("Freddy Krueger"), QuoteParams::slow, false, SC_CP_UTF8, L_TEXT, TEXT("Never stop dreaming.\n")},
|
||||
{TEXT("Ricky Gervais"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Feel free to mock my lack of belief in any Gods.\nIt won't hurt my feelings.\nIt won't damage my faith in reason.\nAnd I won't kill you for it.")},
|
||||
{TEXT("Francis bacon"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Knowledge is power. France is bacon.\n\nWhen I was young my father said to me: \"Knowledge is power, Francis Bacon.\" I understood it as \"Knowledge is power, France is bacon.\"\n\nFor more than a decade I wondered over the meaning of the second part and what was the surreal linkage between the two. If I said the quote to someone, \"Knowledge is power, France is Bacon\", they nodded knowingly. Or someone might say, \"Knowledge is power\" and I'd finish the quote \"France is Bacon\" and they wouldn't look at me like I'd said something very odd, but thoughtfully agree. I did ask a teacher what did \"Knowledge is power, France is bacon\" mean and got a full 10-minute explanation of the \"knowledge is power\" bit but nothing on \"France is bacon\". When I prompted further explanation by saying \"France is bacon?\" in a questioning tone I just got a \"yes\". At 12 I didn't have the confidence to press it further. I just accepted it as something I'd never understand.\n\nIt wasn't until years later I saw it written down that the penny dropped.\n")},
|
||||
{TEXT("Space Invaders"), QuoteParams::speedOfLight, false, SC_CP_UTF8, L_TEXT, TEXT("\n\n ▄██▄\n ▄██████▄ █ █ █▀▀▀\n ██▄██▄██ █ █ █▄▄\n ▄▀▄▄▀▄ █ █ █ █\n ▀ ▀ ▀ ▀ ▀▀ ▀▀ ▀▀▀▀\n\n ▀▄ ▄▀ ▄█▀▀▀ ▄█▀▀█▄ █▀▄▀█ █▀▀▀\n ▄█▀███▀█▄ █ █ █ █ ▀ █ █▄▄\n █ █▀▀▀▀▀█ █ █▄ █▄ ▄█ █ █ █\n ▀▀ ▀▀ ▀▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀\n\n ▄▄█████▄▄ ▀█▀ █▀▄ █\n ██▀▀███▀▀██ █ █ ▀▄ █\n ▀▀██▀▀▀██▀▀ █ █ ▀▄█\n ▄█▀ ▀▀▀ ▀█▄ ▀▀▀ ▀ ▀▀\n\n ▄▄████▄▄ █▀▀█ █▀▀▀ ▄▀▀▄ ▄█▀▀▀ █▀▀▀\n ▄██████████▄ █▄▄█ █▄▄ █▄▄█ █ █▄▄ \n ▄██▄██▄██▄██▄██▄ █ █ █ █ █▄ █ \n ▀█▀ ▀▀ ▀█▀ ▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀\n\n") },
|
||||
{TEXT("#JeSuisCharlie"), QuoteParams::rapid, false, SC_CP_UTF8, L_TEXT, TEXT("Freedom of expression is like the air we breathe, we don't feel it, until people take it away from us.\n\nFor this reason, Je suis Charlie, not because I endorse everything they published, but because I cherish the right to speak out freely without risk even when it offends others.\nAnd no, you cannot just take someone's life for whatever he/she expressed.\n\nHence this \"Je suis Charlie\" edition.\n")}
|
||||
|
|
|
@ -2915,6 +2915,9 @@ void Notepad_plus::command(int id)
|
|||
|
||||
//Do not free anything, EmptyClipboard does that
|
||||
_pEditView->execute(SCI_EMPTYUNDOBUFFER);
|
||||
|
||||
// The "save" point is on dirty state, so let's memorize it
|
||||
buf->setSavePointDirty(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||
if (buf->isUnsync()) // buffer in Notepad++ is not syncronized with the file on disk - in this case the buffer is always dirty
|
||||
isDirty = true;
|
||||
|
||||
if (buf->isSavePointDirty())
|
||||
isDirty = true;
|
||||
|
||||
buf->setDirty(isDirty);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -797,6 +797,8 @@ bool FileManager::reloadBuffer(BufferID id)
|
|||
buf->setUnsync(false);
|
||||
buf->setDirty(false); // if the _isUnsync was true before the reloading, the _isDirty had been set to true somehow in the loadFileData()
|
||||
|
||||
buf->setSavePointDirty(false);
|
||||
|
||||
setLoadedBufferEncodingAndEol(buf, UnicodeConvertor, loadedFileFormat._encoding, loadedFileFormat._eolFormat);
|
||||
}
|
||||
|
||||
|
@ -1178,6 +1180,7 @@ SavingStatus FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool i
|
|||
buffer->setFileName(fullpath, language);
|
||||
buffer->setDirty(false);
|
||||
buffer->setUnsync(false);
|
||||
buffer->setSavePointDirty(false);
|
||||
buffer->setStatus(DOC_REGULAR);
|
||||
buffer->checkFileState();
|
||||
_pscratchTilla->execute(SCI_SETSAVEPOINT);
|
||||
|
|
|
@ -293,6 +293,9 @@ public:
|
|||
bool isUnsync() const { return _isUnsync; }
|
||||
void setUnsync(bool val) { _isUnsync = val; }
|
||||
|
||||
bool isSavePointDirty() const { return _isSavePointDirty; }
|
||||
void setSavePointDirty(bool val) { _isSavePointDirty = val; }
|
||||
|
||||
bool isLargeFile() const { return _isLargeFile; }
|
||||
|
||||
void startMonitoring() {
|
||||
|
@ -378,6 +381,9 @@ private:
|
|||
|
||||
bool _isLargeFile = false; // The loading of huge files will disable automatically 1. auto-completion 2. snapshot periode backup 3. backup on save 4. word wrap
|
||||
|
||||
bool _isSavePointDirty = false; // After converting document to another ecoding, the document becomes dirty, and all the undo states are emptied.
|
||||
// This variable member keeps this situation in memory and when the undo state back to the save_point_reached, it'll still be dirty (its original state)
|
||||
|
||||
// For the monitoring
|
||||
HANDLE _eventHandle = nullptr;
|
||||
bool _isMonitoringOn = false;
|
||||
|
|
Loading…
Reference in New Issue