Permalink
Browse files

fallback tab

  • Loading branch information...
erinata committed Sep 22, 2011
1 parent 0be2cb3 commit b42cbe101ab9585301a9a1cb9ac22d3dd36fc16f
Showing with 48 additions and 14 deletions.
  1. +5 −0 Changelog.txt
  2. +1 −0 Config/PluginConfig.cpp
  3. +7 −3 Config/PluginConfig.h
  4. +1 −1 Config/Version.h
  5. +4 −1 DllMain.cpp
  6. +27 −8 PluginDefinition.cpp
  7. +3 −1 PluginDefinition.h
View
@@ -1,5 +1,10 @@
changelog (for developer use only, include unreleased versions)
+0.5.43
+****** Changed: prevent settings window to be saved in the session
+****** Added: fallback_tab option, when you use UNDO after a tab completion or a snippet triggering. Fingertext will restore the TAB action
+
+
0.5.42
- Fixed: critical bug fix of the compatibility of (opt) and several lexer
- Fixed: option hotspot UNDO bug
View
@@ -120,6 +120,7 @@ void PluginConfig::configSetUp()
setTextVariables();
version = ::GetPrivateProfileInt(TEXT(PLUGIN_NAME), TEXT("version"), 0, iniPath);
+ versionOld = version;
if (version == VERSION_LINEAR) // current version
{
View
@@ -35,7 +35,7 @@
//#include "Version.h"
// Config file content
-#define CONFIG_INT_COUNT 12
+#define CONFIG_INT_COUNT 13
#define CONFIG_TEXT_COUNT 3
#define SNIPPET_LIST_ORDER_TAG_TYPE 0
@@ -50,6 +50,7 @@
#define EDITOR_CARET_BOUND 9
#define FORCE_MULTI_PASTE 10
#define USE_NPP_SHORTKEY 11
+#define FALLBACK_TAB 12
#define CUSTOM_SCOPE 0
#define CUSTOM_ESCAPE_CHAR 1
@@ -68,7 +69,8 @@ const int configIntDefault[CONFIG_INT_COUNT] =
1, // LIVE_PREVIEW_BOX
1, // EDITOR_CARET_BOUND
1, // FORCE_MULTI_PASTE
- 1 // USE_NPP_SHORTKEY
+ 1, // USE_NPP_SHORTKEY
+ 1 // FALLBACK_TAB
};
const TCHAR configIntNames[CONFIG_INT_COUNT][MAX_PATH] =
@@ -84,7 +86,8 @@ const TCHAR configIntNames[CONFIG_INT_COUNT][MAX_PATH] =
TEXT("live_preview_box"),
TEXT("editor_caret_bound"),
TEXT("force_multipaste"),
- TEXT("use_npp_shortkey")
+ TEXT("use_npp_shortkey"),
+ TEXT("fallback_tab")
};
const TCHAR configTextDefault[CONFIG_TEXT_COUNT][MAX_PATH] =
@@ -133,6 +136,7 @@ class PluginConfig
// Core Variables
int version;
+ int versionOld;
bool newUpdate;
// variable from ini file
View
@@ -49,4 +49,4 @@ Usage Guide and Source code:\r\n\
http://github.com/erinata/FingerText \r\n\r\n\
"
-#define MENU_LENGTH 15 //15
+#define MENU_LENGTH 18 //15
View
@@ -74,7 +74,7 @@ LRESULT CALLBACK SubWndProcNpp(HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
retVal = ::CallWindowProc(wndProcNpp, hWnd, message, wParam, lParam);
break;
case WM_CLOSE:
- closeEditWindow(); // Doing this before the callwindowproc will prevent the ftb window to go into the session
+ closeNonSessionTabs(); // Doing this before the callwindowproc will prevent the ftb window to go into the session
retVal = ::CallWindowProc(wndProcNpp, hWnd, message, wParam, lParam);
updateMode(); //Need to Do this because when a user attempt to close npp and the buffer shift to a file that's not saved, The bufferactivated message is not activated.
break;
@@ -156,8 +156,11 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
{
turnOffOptionMode();
+
if (!(notifyCode->modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)))
{
+
+
if (!(notifyCode->modificationType & (SC_MOD_INSERTTEXT))) snippetHintUpdate();
refreshAnnotation();
}
View
@@ -173,20 +173,25 @@ void dataBaseInit()
sqlite3_stmt *stmt;
if (SQLITE_OK == sqlite3_prepare_v2(g_db,
- "CREATE TABLE snippets (tag TEXT, tagType TEXT, snippet TEXT)"
+ "CREATE TABLE snippets (tag TEXT, tagType TEXT, snippet TEXT, package TEXT)"
, -1, &stmt, NULL))
{
sqlite3_step(stmt);
}
sqlite3_finalize(stmt);
+ //TODO: a checking on new update can be done by calling pc.newUpdate == false
+ // for those who upgrade from old database
if (SQLITE_OK == sqlite3_prepare_v2(g_db,
"ALTER TABLE snippets ADD COLUMN package TEXT"
, -1, &stmt, NULL))
{
sqlite3_step(stmt);
}
sqlite3_finalize(stmt);
+
+ //alert(pc.version);
+ //alert(pc.versionOld);
}
// Initialization of plugin commands
@@ -423,9 +428,10 @@ void selectionToSnippet()
g_selectionMonitor++;
}
-void closeEditWindow()
+void closeNonSessionTabs()
{
closeTab(g_ftbPath);
+ closeTab(pc.iniPath);
}
@@ -4648,6 +4654,7 @@ std::vector<std::string> smartSplit(int start, int end, char delimiter, int part
return retVal;
}
+
void tabActivate()
{
if (sciFocus)
@@ -4684,17 +4691,25 @@ void tabActivate()
int posSelectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0);
int posSelectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0);
- if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_BEGINUNDOACTION, 0, 0);
+
if (g_optionMode)
{
+
+ if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_BEGINUNDOACTION, 0, 0);
//g_optionMode = false;
turnOffOptionMode();
::SendScintilla(SCI_GOTOPOS,g_optionEndPosition,0);
snippetHintUpdate();
} else
- {
-
+ {
+ if (pc.configInt[FALLBACK_TAB]==1) ::SendScintilla(SCI_TAB, 0, 0);
+ if (pc.configInt[PRESERVE_STEPS]==0) ::SendScintilla(SCI_BEGINUNDOACTION, 0, 0);
+ if (pc.configInt[FALLBACK_TAB]==1)
+ {
+ ::SendScintilla(SCI_SETSELECTION, posSelectionStart, ::SendScintilla(SCI_GETCURRENTPOS, 0, 0));
+ ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)"");
+ }
if (posSelectionStart==posSelectionEnd) tagFound = triggerTag(posCurrent);
if (tagFound)
{
@@ -4776,10 +4791,14 @@ void tabActivate()
::SendScintilla(SCI_GOTOPOS, posSelectionStart, 0);
posCurrent = posSelectionStart;
- ::SendScintilla(SCI_TAB, 0, 0);
+
+ if (pc.configInt[FALLBACK_TAB]==1) ::SendScintilla(SCI_TAB, 0, 0);
::SendScintilla(SCI_BEGINUNDOACTION, 0, 0);
- ::SendScintilla(SCI_SETSELECTION, posSelectionStart, ::SendScintilla(SCI_GETCURRENTPOS, 0, 0));
- ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)"");
+ if (pc.configInt[FALLBACK_TAB]==1)
+ {
+ ::SendScintilla(SCI_SETSELECTION, posSelectionStart, ::SendScintilla(SCI_GETCURRENTPOS, 0, 0));
+ ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)"");
+ }
//completeFound = snippetComplete();
//completeFound = triggerTag(posCurrent,true);
completeFound = tagComplete();
View
@@ -156,8 +156,10 @@ std::vector<std::string> smartSplit(int start, int end, char delimiter, int part
void removehook();
void installhook();
-void closeEditWindow();
+void closeNonSessionTabs();
+void turnOffSnippetTriggering();
+void makeUpTab();
void updateOptionCurrent(bool toNext);
void cleanOptionItem();

0 comments on commit b42cbe1

Please sign in to comment.