Skip to content

Commit

Permalink
diaglog insertion now compatible with the last hotspot problem fix
Browse files Browse the repository at this point in the history
  • Loading branch information
erinata committed Mar 17, 2012
1 parent f358742 commit cfdb64e
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
changelog (for developer use only, include unreleased versions)

0.5.58
****** The last hotspot problem works for diaglog insertion too

0.5.57.2
****** restrict the addition of $[0[]0] to snippet with no hotspot and it's inserted to a document with no hotspot following the insertion

Expand Down
6 changes: 3 additions & 3 deletions Config/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@

#define TESTING

#define VERSION_TEXT "0.5.57.1"
#define VERSION_NUM 0,5,57,1
#define VERSION_LINEAR 557
#define VERSION_TEXT "0.5.58"
#define VERSION_NUM 0,5,58,0
#define VERSION_LINEAR 558
#define VERSION_KEEP_CONFIG_START 549
#define VERSION_STAGE "(Alpha)"
#ifdef TESTING
Expand Down
5 changes: 4 additions & 1 deletion DllMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
//TODO: investigate better way to write this (may be use SC_MULTISTEPUNDOREDO and SC_LASTSTEPINUNDOREDO)
if ((nppLoaded) & ((notifyCode->modificationType & (SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_LASTSTEPINUNDOREDO)) && (!(notifyCode->modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEFOLD)))))
{
g_onHotSpot = false;
//g_onHotSpot = false;
//
turnOffOptionMode();
::SendScintilla(SCI_AUTOCCANCEL,0,0);
if (!(notifyCode->modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)))
Expand All @@ -168,6 +169,8 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
if (!(notifyCode->modificationType & (SC_MOD_INSERTTEXT))) snippetHintUpdate();
refreshAnnotation();
}

//if (notifyCode->modificationType & (SC_MOD_DELETETEXT)) g_onHotSpot = false;

}
break;
Expand Down
7 changes: 3 additions & 4 deletions DuckEval/DuckEval.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//This file is part of FingerText, a notepad++ snippet plugin.
//
//DuckEval is currently not released but will be released as a separate project later.
//Currently it is part of the project Fingertext.
// DuckEval is originally developed as part of Fingertext.
// It will be released as a separate project later.
// Currently there is no license for sharing and reusing.

#include "DuckEval.h"

Expand Down
7 changes: 3 additions & 4 deletions DuckEval/DuckEval.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//This file is part of FingerText, a notepad++ snippet plugin.
//
//DuckEval is currently not released but will be released as a separate project later.
//Currently it is part of the project Fingertext.
// DuckEval is originally developed as part of Fingertext.
// It will be released as a separate project later.
// Currently there is no license for sharing and reusing.

#ifndef DUCKEVAL_H
#define DUCKEVAL_H
Expand Down
25 changes: 19 additions & 6 deletions PluginDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4635,16 +4635,18 @@ void selectionMonitor(int contentChange)
int selectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0);
int selectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0);


if (selectionStart==selectionEnd)
{
g_onHotSpot = false;
g_onHotSpot = false;
withSelection = false;

} else if ((!withSelection) && (selectionStart!=selectionEnd))
{
withSelection = true;
updateDockItems(true,false,"%",true);
}

}

}
Expand Down Expand Up @@ -5699,6 +5701,9 @@ bool diagActivate(char* tag)
i--;
} while ((navSpot <= 0) && (i >= 0));
}



//TODO: this line is position here so the priority spot can be implement, but this cause the
// 1st hotspot not undoable when the snippet is triggered. More investigation on how to
// manipulate the undo list is required to make these 2 features compatible
Expand All @@ -5708,26 +5713,35 @@ bool diagActivate(char* tag)
{
if ((navSpot > 0) || (dynamicSpot)) ::SendScintilla(SCI_AUTOCCANCEL,0,0);
}

if ((navSpot > 0) || (dynamicSpot)) g_onHotSpot = true;

} else
{
if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_ENDUNDOACTION, 0, 0);
}

retVal = true;

} else
{

// clear the tag
::SendScintilla(SCI_SETSEL,posCurrent-triggerLength, posCurrent);
::SendScintilla(SCI_REPLACESEL,0,(LPARAM)"");
retVal = false;
if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_ENDUNDOACTION, 0, 0);
}

g_selectionMonitor++;
pc.configInt[LIVE_HINT_UPDATE]++;

}
}


return retVal;

}

void tabActivate()
Expand Down Expand Up @@ -5900,7 +5914,7 @@ void doTabActivate(bool navOnly)
} while ((navSpot <= 0) && (i >= 0));
}

if ((navSpot > 0) || (dynamicSpot)) g_onHotSpot = true;

//TODO: this line is position here so the priority spot can be implement, but this cause the
// 1st hotspot not undoable when the snippet is triggered. More investigation on how to
// manipulate the undo list is required to make these 2 features compatible
Expand All @@ -5910,14 +5924,16 @@ void doTabActivate(bool navOnly)
{
if ((navSpot > 0) || (dynamicSpot)) ::SendScintilla(SCI_AUTOCCANCEL,0,0);
}

if ((navSpot > 0) || (dynamicSpot)) g_onHotSpot = true;
} else
{
if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_ENDUNDOACTION, 0, 0);
}

bool snippetHint = false;

if (g_onHotSpot)
if ((g_onHotSpot) && (posSelectionStart!=posSelectionEnd))
{
if ((navSpot == 0) && (tagFound == false) && (dynamicSpot==false))
{
Expand All @@ -5927,9 +5943,6 @@ void doTabActivate(bool navOnly)

} else
{





int completeFound = -1;
Expand Down

0 comments on commit cfdb64e

Please sign in to comment.