diff --git a/Config/PluginConfig.cpp b/Config/PluginConfig.cpp index 8540988..78cf0e3 100644 --- a/Config/PluginConfig.cpp +++ b/Config/PluginConfig.cpp @@ -309,7 +309,7 @@ void PluginConfig::settings() { ::SendMessage(nppData._nppHandle, NPPM_DOOPEN, 0, (LPARAM)iniPath); } - int lineCount = ::SendScintilla(SCI_GETLINECOUNT, 0, 0)-1; + sptr_t lineCount = ::SendScintilla(SCI_GETLINECOUNT, 0, 0)-1; ::SendScintilla(SCI_ANNOTATIONCLEARALL, 0, 0); //TODO: move this part (and other text) to const char in another file. ::SendScintilla(SCI_ANNOTATIONSETTEXT, lineCount, (LPARAM)"\ @@ -390,7 +390,7 @@ For step by step usage guide, please visit http://github.com/erinata/FingerText void PluginConfig::about() { - int length = _tcslen(TEXT(PLUGIN_NAME))+_tcslen(TEXT(VERSION_TEXT))+_tcslen(TEXT(VERSION_STAGE))+_tcslen(TEXT(VERSION_STAGE_ADD))+_tcslen(TEXT(DATE_TEXT))+_tcslen(TEXT(AUTHOR_TEXT))+_tcslen(TEXT(EMAIL_TEXT))+_tcslen(TEXT(ABOUT_TEXT))+50; + sptr_t length = _tcslen(TEXT(PLUGIN_NAME))+_tcslen(TEXT(VERSION_TEXT))+_tcslen(TEXT(VERSION_STAGE))+_tcslen(TEXT(VERSION_STAGE_ADD))+_tcslen(TEXT(DATE_TEXT))+_tcslen(TEXT(AUTHOR_TEXT))+_tcslen(TEXT(EMAIL_TEXT))+_tcslen(TEXT(ABOUT_TEXT))+50; TCHAR* versionText = new TCHAR[length]; diff --git a/Dialogs/InsertionDialog.cpp b/Dialogs/InsertionDialog.cpp index 48639ed..fdf346e 100644 --- a/Dialogs/InsertionDialog.cpp +++ b/Dialogs/InsertionDialog.cpp @@ -108,7 +108,7 @@ int InsertionDlg::getEditPos() TCHAR* InsertionDlg::getEditText() { - int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); + LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); TCHAR* bufferWide = new TCHAR[length+1]; ::GetDlgItemText(_hSelf, IDC_INSERTION_EDIT ,bufferWide,length+1); return bufferWide; @@ -137,13 +137,13 @@ void InsertionDlg::setDlgText(int dlg, TCHAR* showText) } -void InsertionDlg::getSelectText(TCHAR* &buffer, int index) +void InsertionDlg::getSelectText(TCHAR* &buffer, LRESULT index) { HWND hwndList = GetDlgItem(_hSelf, IDC_INSERTION_LIST); - if (index = -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0); + if (index == -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0); if (index <= 0) index = 0; - int length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0); + LRESULT length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0); if (length >= 1) { @@ -242,7 +242,7 @@ bool InsertionDlg::completeSnippets() bool retVal = false; SendDlgItemMessage(_hSelf, IDC_INSERTION_LIST, LB_SETSEL, 0, 0); showPreview(false,true); - int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); + LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); SendDlgItemMessage(_hSelf, IDC_INSERTION_EDIT, EM_SETSEL, length, -1); //TODO: complete snippet in dialog @@ -267,11 +267,11 @@ void InsertionDlg::changeMode(bool withComment) void InsertionDlg::setTextTarget(bool fromTab) { - int index = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCURSEL, 0, 0); + LRESULT index = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCURSEL, 0, 0); if ((fromTab) || (index)==0) { - int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); + LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); SetFocus(GetDlgItem(_hSelf, IDC_INSERTION_EDIT)); SendDlgItemMessage(_hSelf, IDC_INSERTION_EDIT, EM_SETSEL, length, -1); } @@ -280,7 +280,7 @@ void InsertionDlg::setTextTarget(bool fromTab) void InsertionDlg::setListTarget() { - int count = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCOUNT, 0, 0); + LRESULT count = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_LIST), LB_GETCOUNT, 0, 0); if (count>0) { SetFocus(GetDlgItem(_hSelf, IDC_INSERTION_LIST)); @@ -293,7 +293,7 @@ void InsertionDlg::updateInsertionHint() { if (::GetFocus() == GetDlgItem(_hSelf, IDC_INSERTION_EDIT)) { - int length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); + LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_EDIT), EM_LINELENGTH, 0, 0); if (length>0) { TCHAR* bufferWide = new TCHAR[length+1]; @@ -325,9 +325,9 @@ void InsertionDlg::adjustTextHintPosition() { int fontWidth = 7; int offset = 4; - int length1 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT), EM_LINELENGTH, 0, 0); - int length2 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT), EM_LINELENGTH, 0, 0); - int length3 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_POST), EM_LINELENGTH, 0, 0); + LRESULT length1 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT), EM_LINELENGTH, 0, 0); + LRESULT length2 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT), EM_LINELENGTH, 0, 0); + LRESULT length3 = SendMessage(GetDlgItem(_hSelf, IDC_INSERTION_HINT_POST), EM_LINELENGTH, 0, 0); SetWindowPos(GetDlgItem(_hSelf, IDC_INSERTION_HINT) ,NULL,5 ,35,offset+length1*fontWidth,20,SWP_NOACTIVATE); SetWindowPos(GetDlgItem(_hSelf, IDC_INSERTION_HINT_HIGHLIGHT),NULL,5+offset+length1*fontWidth ,35,offset+length2*fontWidth,20,SWP_NOACTIVATE); diff --git a/Dialogs/InsertionDialog.h b/Dialogs/InsertionDialog.h index 9efb17e..a630b0f 100644 --- a/Dialogs/InsertionDialog.h +++ b/Dialogs/InsertionDialog.h @@ -58,7 +58,7 @@ class InsertionDlg : public StaticDialog void InsertionDlg::setListTarget(); bool InsertionDlg::completeSnippets(); int InsertionDlg::getEditPos(); - void InsertionDlg::getSelectText(TCHAR* &buffer, int index = -1); + void InsertionDlg::getSelectText(TCHAR* &buffer, LRESULT index = -1); void InsertionDlg::setDlgText(int dlg, TCHAR* showText); void InsertionDlg::changeMode(bool withComment); void InsertionDlg::changeExpand(); diff --git a/Dialogs/SnippetDock.cpp b/Dialogs/SnippetDock.cpp index 57564d7..d3eaf9f 100644 --- a/Dialogs/SnippetDock.cpp +++ b/Dialogs/SnippetDock.cpp @@ -31,7 +31,7 @@ #include "SnippetDock.h" bool normalMode = true; -int insertMode = 1; +LRESULT insertMode = 1; //int previewMode = 1; int selectMode = 1; //extern NppData nppData; @@ -71,7 +71,7 @@ void DockingDlg::resizeListBox(int height,int width) int minimumHeight = 100; - if (height = -1) + if (height == -1) { RECT rect; GetWindowRect(_hSelf, &rect); @@ -147,9 +147,9 @@ void DockingDlg::toggleSave(bool buttonOn) } -int DockingDlg::getSelection() +LRESULT DockingDlg::getSelection() { - int retVal; + LRESULT retVal; HWND hwndList = GetDlgItem(_hSelf, IDC_SNIPPET_LIST); retVal = SendMessage(hwndList, LB_GETCURSEL, 0, 0); retVal = SendMessage(hwndList, LB_GETANCHORINDEX, 0, 0); @@ -158,13 +158,13 @@ int DockingDlg::getSelection() } -void DockingDlg::getSelectText(TCHAR* &buffer, int index) +void DockingDlg::getSelectText(TCHAR* &buffer, LRESULT index) { HWND hwndList = GetDlgItem(_hSelf, IDC_SNIPPET_LIST); - if (index = -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0); + if (index == -1) index = SendMessage(hwndList, LB_GETCURSEL, 0, 0); if (index <= 0) index = 0; - int length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0); + LRESULT length = SendMessage(hwndList, LB_GETTEXTLEN, index, 0); if (length >= 1) { @@ -204,22 +204,22 @@ void DockingDlg::setupHotspotCombo() -int DockingDlg::searchSnippetList(wchar_t* key) +LRESULT DockingDlg::searchSnippetList(wchar_t* key) { return SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_FINDSTRINGEXACT, -1, (LPARAM)key); } -void DockingDlg::setTopIndex(int index) +void DockingDlg::setTopIndex(LRESULT index) { SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_SETTOPINDEX, index, 0); } -int DockingDlg::getTopIndex() +LRESULT DockingDlg::getTopIndex() { return SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_GETTOPINDEX, 0, 0); } -void DockingDlg::selectSnippetList(int selection) +void DockingDlg::selectSnippetList(LRESULT selection) { SendMessage(GetDlgItem(_hSelf, IDC_SNIPPET_LIST), LB_SETCURSEL, selection, 0); } @@ -227,7 +227,7 @@ void DockingDlg::selectSnippetList(int selection) void DockingDlg::insertHotspot() { - int type = SendMessage(GetDlgItem(_hSelf, IDC_COMBO_HOTSPOT), CB_GETCURSEL, 0, 0); + LRESULT type = SendMessage(GetDlgItem(_hSelf, IDC_COMBO_HOTSPOT), CB_GETCURSEL, 0, 0); //::insertHotSpotSign(select); insertTagSign(type); ::SetFocus(::getCurrentScintilla()); @@ -350,7 +350,7 @@ void DockingDlg::switchDock(bool toNormal) //alert(); } -void DockingDlg::switchInsertMode(int insert) +void DockingDlg::switchInsertMode(LRESULT insert) { insertMode = insert; SendMessage(GetDlgItem(_hSelf, IDC_RADIO_INSERT), BM_SETCHECK, insert, 0); @@ -452,11 +452,11 @@ INT_PTR CALLBACK DockingDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa { if (::GetFocus() == GetDlgItem(_hSelf, IDC_FILTER)) { - int length = SendMessage(GetDlgItem(_hSelf, IDC_FILTER), EM_LINELENGTH, 0, 0); + LRESULT length = SendMessage(GetDlgItem(_hSelf, IDC_FILTER), EM_LINELENGTH, 0, 0); if (length>0) { TCHAR* bufferWide = new TCHAR[length+1]; - ::GetDlgItemText(_hSelf, IDC_FILTER ,bufferWide,length+1); + ::GetDlgItemText(_hSelf, IDC_FILTER ,bufferWide,(int)(length+1)); char* buffer = toCharArray(bufferWide); bool leadingSpace = 0; bool trailingSpace = 0; diff --git a/Dialogs/SnippetDock.h b/Dialogs/SnippetDock.h index e9a94af..2392a25 100644 --- a/Dialogs/SnippetDock.h +++ b/Dialogs/SnippetDock.h @@ -49,19 +49,19 @@ class DockingDlg : public DockingDlgInterface void clearDock(); void setDlgText(int dlg, TCHAR* showText); void toggleSave(bool buttonOn); - int getSelection(); + LRESULT getSelection(); //void setSelction(); void DockingDlg::setupHotspotCombo(); - void DockingDlg::switchInsertMode(int insert = 1); + void DockingDlg::switchInsertMode(LRESULT insert = 1); //int getCount(); void DockingDlg::updateSnippetCount(wchar_t* count); void DockingDlg::insertHotspot(); void DockingDlg::switchDock(bool toNormal = true); - void DockingDlg::selectSnippetList(int selection); - int DockingDlg::searchSnippetList(wchar_t* key); - int DockingDlg::getTopIndex(); - void DockingDlg::setTopIndex(int index); - void DockingDlg::getSelectText(TCHAR* &buffer, int index = -1); + void DockingDlg::selectSnippetList(LRESULT selection); + LRESULT DockingDlg::searchSnippetList(wchar_t* key); + LRESULT DockingDlg::getTopIndex(); + void DockingDlg::setTopIndex(LRESULT index); + void DockingDlg::getSelectText(TCHAR* &buffer, LRESULT index = -1); protected : diff --git a/DuckEval/DuckEval.cpp b/DuckEval/DuckEval.cpp index ab69975..c4d7028 100644 --- a/DuckEval/DuckEval.cpp +++ b/DuckEval/DuckEval.cpp @@ -125,8 +125,8 @@ bool Expression::isDigit(const char &c) std::string Expression::rephrasing(std::string input) { - int length = input.length(); - for (int j=0; j operand2) { @@ -427,7 +427,7 @@ long Expression::ncr(long operand1, long operand2) return factorial(operand2)/(factorial(operand1)*factorial(operand2 - operand1)); } -long Expression::npr(long operand1, long operand2) +double Expression::npr(double operand1, double operand2) { if (operand1 < 0 || operand2 < 0 || operand1 > operand2) { @@ -438,11 +438,11 @@ long Expression::npr(long operand1, long operand2) return factorial(operand2)/factorial(operand2 - operand1); } -long Expression::factorial(long number) +double Expression::factorial(double number) { if (number < 0) isError = 1; - long result = 1; - for (long i = number; i>0; i--) result = result * i; + double result = 1; + for (double i = number; i>0; i--) result = result * i; return result; } diff --git a/DuckEval/DuckEval.h b/DuckEval/DuckEval.h index 0ac5a9c..edd0599 100644 --- a/DuckEval/DuckEval.h +++ b/DuckEval/DuckEval.h @@ -49,7 +49,7 @@ class Expression void Expression::toPostfix(std::string infix); double Expression::operate(const std::string &, const double &, const double &); // calculate result by operator and operand void Expression::signReplace(std::string& str, const std::string& oldStr, const std::string& newStr,bool negative = false); - long Expression::factorial(long number); + double Expression::factorial(double number); int Expression::isNotEqual(double operand1, double operand2); int Expression::isEqual(double operand1, double operand2); int Expression::isSmallerOrEqual(double operand1, double operand2); @@ -58,8 +58,8 @@ class Expression int Expression::isGreater(double operand1, double operand2); int Expression::operateOr(double operand1, double operand2); int Expression::operateAnd(double operand1, double operand2); - long Expression::ncr(long operand1, long operand2); - long Expression::npr(long operand1, long operand2); + double Expression::ncr(double operand1, double operand2); + double Expression::npr(double operand1, double operand2); long Expression::randomNumber(double operand1); double Expression::randomFraction(double operand1); diff --git a/FingerText.vcxproj b/FingerText.vcxproj index a2a60a6..502d709 100644 --- a/FingerText.vcxproj +++ b/FingerText.vcxproj @@ -1,5 +1,5 @@  - + Unicode Debug @@ -30,26 +30,26 @@ Unicode false true - v120_xp + v140_xp DynamicLibrary Unicode false true - v120_xp + v140_xp DynamicLibrary Unicode true - v120_xp + v140_xp DynamicLibrary Unicode true - v120_xp + v143 diff --git a/NppApi/NppApiHelpers.cpp b/NppApi/NppApiHelpers.cpp index 21dd628..2ca2667 100644 --- a/NppApi/NppApiHelpers.cpp +++ b/NppApi/NppApiHelpers.cpp @@ -109,7 +109,7 @@ int showMessageBox(TCHAR* text, int flags) return ::MessageBox(nppData._nppHandle, text, TEXT(PLUGIN_NAME), flags); } -int searchNext(char* searchText, bool regExp) +sptr_t searchNext(char* searchText, bool regExp) { int searchFlags = 0; if (regExp) searchFlags = SCFIND_REGEXP; @@ -117,7 +117,7 @@ int searchNext(char* searchText, bool regExp) return ::SendScintilla(SCI_SEARCHNEXT, searchFlags,(LPARAM)searchText); } -int searchPrev(char* searchText, bool regExp) +sptr_t searchPrev(char* searchText, bool regExp) { int searchFlags = 0; if (regExp) searchFlags = SCFIND_REGEXP; @@ -126,7 +126,7 @@ int searchPrev(char* searchText, bool regExp) } -unsigned int sciGetText(char **text, int start, int end) +sptr_t sciGetText(char **text, sptr_t start, sptr_t end) { if (start == -1) { @@ -143,7 +143,7 @@ unsigned int sciGetText(char **text, int start, int end) tr.chrg.cpMin = start; tr.chrg.cpMax = end; tr.lpstrText = *text; - return (int)SendScintilla(SCI_GETTEXTRANGE, 0, reinterpret_cast(&tr)); + return SendScintilla(SCI_GETTEXTRANGE, 0, reinterpret_cast(&tr)); } else { strcpy(*text,""); diff --git a/NppApi/NppApiHelpers.h b/NppApi/NppApiHelpers.h index 9f63706..4580bec 100644 --- a/NppApi/NppApiHelpers.h +++ b/NppApi/NppApiHelpers.h @@ -44,11 +44,11 @@ int setCommand(TCHAR *cmdName = TEXT(""), PFUNCPLUGINCMD pFunc = NULL, ShortcutK int showMessageBox(TCHAR* text = TEXT(""), int flags = MB_OK); // Search in Scintilla -int searchNext(char* searchText, bool regExp = false); -int searchPrev(char* searchText, bool regExp = false); +sptr_t searchNext(char* searchText, bool regExp = false); +sptr_t searchPrev(char* searchText, bool regExp = false); // Getting Text from Scintilla -unsigned int sciGetText(char **text, int start = -1, int end = -1); +sptr_t sciGetText(char **text, sptr_t start = -1, sptr_t end = -1); //unsigned int sciGetText(HWND hwnd, char **text, int start, int end) void closeTab(TCHAR* path); diff --git a/NppApi/Scintilla.h b/NppApi/Scintilla.h index c64443f..724dd4e 100644 --- a/NppApi/Scintilla.h +++ b/NppApi/Scintilla.h @@ -1063,8 +1063,8 @@ namespace Scintilla { #endif struct Sci_CharacterRange { - long cpMin; - long cpMax; + sptr_t cpMin; + sptr_t cpMax; }; struct Sci_TextRange { diff --git a/PluginDefinition.cpp b/PluginDefinition.cpp index 00961aa..02a4cde 100644 --- a/PluginDefinition.cpp +++ b/PluginDefinition.cpp @@ -108,21 +108,21 @@ bool g_freezeDock = false; bool g_enable = true; bool g_editorView; -int g_editorLineCount; +sptr_t g_editorLineCount; std::string g_snippetCount = ""; bool g_fingerTextList; -int g_lastTriggerPosition = 0; +sptr_t g_lastTriggerPosition = 0; std::string g_customClipBoard = ""; std::string g_selectedText = ""; // For option hotspot bool g_optionMode = false; -int g_optionStartPosition = 0; -int g_optionEndPosition = 0; -int g_optionCurrent = 0; +sptr_t g_optionStartPosition = 0; +sptr_t g_optionEndPosition = 0; +size_t g_optionCurrent = 0; std::vector g_optionArray; // List of acceptable tagSigns @@ -503,8 +503,8 @@ void selectionToSnippet(bool forceNew) //pc.configInt[EDITOR_CARET_BOUND]--; //HWND curScintilla = getCurrentScintilla(); - int selectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0); - int selectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); + sptr_t selectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0); + sptr_t selectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); bool withSelection = false; char* selection; @@ -574,8 +574,8 @@ void insertSnippet() char* buffer = toCharArray(bufferWide); buffer = quickStrip(buffer, ' '); - int scopeLength = ::strchr(buffer,'>') - buffer - 1; - int triggerTextLength = strlen(buffer)-scopeLength - 2; + size_t scopeLength = ::strchr(buffer,'>') - buffer - 1; + size_t triggerTextLength = strlen(buffer)-scopeLength - 2; char* tempTriggerText = new char [ triggerTextLength+1]; char* tempScope = new char[scopeLength+1]; @@ -595,7 +595,7 @@ void insertSnippet() void editSnippet() { - int topIndex = -1; + LRESULT topIndex = -1; if (g_editorView) topIndex = snippetDock.getTopIndex(); TCHAR* bufferWide; @@ -611,8 +611,8 @@ void editSnippet() // return; //} // - int scopeLength = ::strchr(buffer,'>') - buffer - 1; - int triggerTextLength = strlen(buffer)-scopeLength - 2; + size_t scopeLength = ::strchr(buffer,'>') - buffer - 1; + size_t triggerTextLength = strlen(buffer)-scopeLength - 2; char* tempTriggerText = new char [ triggerTextLength+1]; char* tempScope = new char[scopeLength+1]; @@ -687,7 +687,7 @@ void editSnippet() delete [] tempTriggerText; delete [] tempScope; - int scrollPos = snippetDock.searchSnippetList(bufferWide); + LRESULT scrollPos = snippetDock.searchSnippetList(bufferWide); snippetDock.selectSnippetList(scrollPos); if (topIndex == -1) { @@ -703,15 +703,15 @@ void editSnippet() void deleteSnippet() { - int topIndex = snippetDock.getTopIndex(); + LRESULT topIndex = snippetDock.getTopIndex(); TCHAR* bufferWide; snippetDock.getSelectText(bufferWide); char* buffer = toCharArray(bufferWide); buffer = quickStrip(buffer, ' '); - int scopeLength = ::strchr(buffer,'>') - buffer - 1; - int triggerTextLength = strlen(buffer)-scopeLength - 2; + size_t scopeLength = ::strchr(buffer,'>') - buffer - 1; + size_t triggerTextLength = strlen(buffer)-scopeLength - 2; char* tempTriggerText = new char [ triggerTextLength+1]; char* tempScope = new char[scopeLength+1]; @@ -752,16 +752,16 @@ bool getLineChecked(char **buffer, int lineNumber, TCHAR* errorText) ::SendScintilla(SCI_GOTOLINE,lineNumber,0); - int tagPosStart = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t tagPosStart = ::SendScintilla(SCI_GETCURRENTPOS,0,0); - int tagPosEnd; + sptr_t tagPosEnd; if (lineNumber == 3) { tagPosEnd = ::SendScintilla(SCI_GETLENGTH,0,0); } else { - int tagPosLineEnd = ::SendScintilla(SCI_GETLINEENDPOSITION,lineNumber,0); + sptr_t tagPosLineEnd = ::SendScintilla(SCI_GETLINEENDPOSITION,lineNumber,0); //char* wordChar; //if (lineNumber==2) @@ -806,7 +806,7 @@ bool getLineChecked(char **buffer, int lineNumber, TCHAR* errorText) if (lineNumber == 3) { ::SendScintilla(SCI_GOTOPOS,tagPosStart,0); - int spot = searchNext("[>END<]"); + sptr_t spot = searchNext("[>END<]"); if (spot<0) { showMessageBox(TEXT("You should put an \"[>END<]\" (without quotes) at the end of your snippet content.")); @@ -829,7 +829,7 @@ void saveSnippet() { //HWND curScintilla = getCurrentScintilla(); g_selectionMonitor--; - int docLength = ::SendScintilla(SCI_GETLENGTH,0,0); + sptr_t docLength = ::SendScintilla(SCI_GETLENGTH,0,0); // insert a space at the end of the doc so the ::SendMessage(curScintilla,SCI_SEARCHNEXT,0,(LPARAM)" "); will not get into error // TODO: Make sure that it is not necessary to keep this line //::SendMessage(curScintilla, SCI_INSERTTEXT, docLength, (LPARAM)" "); @@ -953,7 +953,7 @@ void saveSnippet() //TODO: This is not working. The scrolling works but the snippetdock reset the scrolling after thei savesnippet() finished wchar_t* searchItem = constructDockItems(toString(tagTypeText),toString(tagText),14); - int scrollPos = snippetDock.searchSnippetList(searchItem); + LRESULT scrollPos = snippetDock.searchSnippetList(searchItem); snippetDock.selectSnippetList(scrollPos); snippetDock.setTopIndex(scrollPos); @@ -966,7 +966,7 @@ void saveSnippet() } -void restoreTab(int &posCurrent, int &posSelectionStart, int &posSelectionEnd) +void restoreTab(sptr_t &posCurrent, sptr_t &posSelectionStart, sptr_t &posSelectionEnd) { // restoring the original tab action ::SendScintilla(SCI_GOTOPOS,posCurrent,0); @@ -975,18 +975,18 @@ void restoreTab(int &posCurrent, int &posSelectionStart, int &posSelectionEnd) } //TODO: refactor searchPrevMatchedSign and searchNextMatchedTail -int searchPrevMatchedSign(char* tagSign, char* tagTail) +sptr_t searchPrevMatchedSign(char* tagSign, char* tagTail) { //This function works when the caret is at the beginning of tagtail // it return the position at the beginning of the tagsign if found - int signSpot = -1; - int tailSpot = -1; - int unmatchedTail = 0; + sptr_t signSpot = -1; + sptr_t tailSpot = -1; + sptr_t unmatchedTail = 0; do { - int posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); tailSpot = searchPrev(tagTail); ::SendScintilla(SCI_GOTOPOS,posCurrent,0); signSpot = searchPrev(tagSign); @@ -1015,23 +1015,23 @@ int searchPrevMatchedSign(char* tagSign, char* tagTail) return -1; } -int searchNextMatchedTail(char* tagSign, char* tagTail) +sptr_t searchNextMatchedTail(char* tagSign, char* tagTail) { // TODO: this function is not returning the position correctly, but it stop at the place where is find the tail // This function is tested to work when the position is at the end of tagSign // And this return the position at the END of tailsign, if found - int signSpot = -1; - int tailSpot = -1; - int unmatchedSign = 0; + sptr_t signSpot = -1; + sptr_t tailSpot = -1; + sptr_t unmatchedSign = 0; - int signLength = strlen(tagSign); - int tailLength = strlen(tagTail); + size_t signLength = strlen(tagSign); + size_t tailLength = strlen(tagTail); do { - int posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); signSpot = searchNext(tagSign); if (signSpot != -1) signSpot = signSpot+signLength; ::SendScintilla(SCI_GOTOPOS,posCurrent,0); @@ -1061,10 +1061,10 @@ int searchNextMatchedTail(char* tagSign, char* tagTail) return -1; } -bool dynamicHotspot(int &startingPos, char* tagSign, char* tagTail) +bool dynamicHotspot(sptr_t &startingPos, char* tagSign, char* tagTail) { - int checkPoint = startingPos; + sptr_t checkPoint = startingPos; bool normalSpotTriggered = false; //char tagSign[] = "$[!["; @@ -1077,8 +1077,8 @@ bool dynamicHotspot(int &startingPos, char* tagSign, char* tagTail) char* hotSpotText = 0; char* hotSpot = 0; - int spot = -1; - int spotComplete = -1; + sptr_t spot = -1; + sptr_t spotComplete = -1; int spotType = 0; int limitCounter = 0; @@ -1102,8 +1102,8 @@ bool dynamicHotspot(int &startingPos, char* tagSign, char* tagTail) if (spotComplete>=0) { - int firstPos = ::SendScintilla(SCI_GETCURRENTPOS,0,0); - int secondPos = 0; + sptr_t firstPos = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t secondPos = 0; spotType = grabHotSpotContent(&hotSpotText, &hotSpot, firstPos, secondPos, tagSignLength,spot); @@ -1196,7 +1196,7 @@ bool dynamicHotspot(int &startingPos, char* tagSign, char* tagTail) return false; } -void paramsInsertion(int &firstPos, char* hotSpot, int &checkPoint) +void paramsInsertion(sptr_t &firstPos, char* hotSpot, sptr_t &checkPoint) { if (!g_hotspotParams.empty()) { @@ -1211,7 +1211,7 @@ void paramsInsertion(int &firstPos, char* hotSpot, int &checkPoint) //::SendScintilla(SCI_SETSEL,firstPos,secondPos+3); bool first = true; - int found; + sptr_t found; do { ::SendScintilla(SCI_GOTOPOS,firstPos,0); @@ -1239,16 +1239,16 @@ void paramsInsertion(int &firstPos, char* hotSpot, int &checkPoint) } -void chainSnippet(int &firstPos, char* hotSpotText) +void chainSnippet(sptr_t &firstPos, char* hotSpotText) { //TODO: there may be a bug here. When the chain snippet contains content with CUT, the firstPos is not updated. - int triggerPos = strlen(hotSpotText)+firstPos; + sptr_t triggerPos = strlen(hotSpotText)+firstPos; ::SendScintilla(SCI_GOTOPOS,triggerPos,0); triggerTag(triggerPos,strlen(hotSpotText)); } -void webRequest(int &firstPos, char* hotSpotText) +void webRequest(sptr_t &firstPos, char* hotSpotText) { TCHAR requestType[20]; int requestTypeLength = 0; @@ -1298,11 +1298,11 @@ void webRequest(int &firstPos, char* hotSpotText) } - int triggerPos = strlen(hotSpotText)+firstPos-requestTypeLength; + sptr_t triggerPos = strlen(hotSpotText)+firstPos-requestTypeLength; //TODO: rewrite this part so that it doesn't rely on searchNext, and separate it out to another function to prepare for the implementation of "web snippet import" SendScintilla(SCI_GOTOPOS,firstPos,0); - int spot1 = searchNext("://"); - int serverStart; + sptr_t spot1 = searchNext("://"); + sptr_t serverStart; if ((spot1<0) || (spot1>triggerPos)) { serverStart = firstPos; @@ -1312,9 +1312,9 @@ void webRequest(int &firstPos, char* hotSpotText) } SendScintilla(SCI_GOTOPOS,serverStart,0); - int spot2 = searchNext("/"); + sptr_t spot2 = searchNext("/"); - int serverEnd; + sptr_t serverEnd; if (spot2<0 || spot1>triggerPos) { serverEnd = triggerPos; @@ -1379,11 +1379,11 @@ void webRequest(int &firstPos, char* hotSpotText) // _pclose( pPipe ); //} -void executeCommand(int &firstPos, char* hotSpotText) +void executeCommand(sptr_t &firstPos, char* hotSpotText) { //TODO: cater the problem that the path can have spaces..... as shown in the security remarks in http://msdn.microsoft.com/en-us/library/ms682425%28v=vs.85%29.aspx - int triggerPos = strlen(hotSpotText)+firstPos; + sptr_t triggerPos = strlen(hotSpotText)+firstPos; ::SendScintilla(SCI_SETSEL,firstPos,triggerPos); ::SendScintilla(SCI_REPLACESEL,0,(LPARAM)""); @@ -1660,12 +1660,12 @@ std::string evaluateCall(char* expression) } -void evaluateHotSpot(int &firstPos, char* hotSpotText) +void evaluateHotSpot(sptr_t &firstPos, char* hotSpotText) { std::string evaluateResult; //TODO: should allow for a more elaborate comparison output - int triggerPos = strlen(hotSpotText)+firstPos; + sptr_t triggerPos = strlen(hotSpotText)+firstPos; SendScintilla(SCI_GOTOPOS,firstPos,0); int mode = 0; @@ -1673,14 +1673,14 @@ void evaluateHotSpot(int &firstPos, char* hotSpotText) char delimiter1 = '?'; char delimiter2 = ':'; std::string verboseText = " => "; - int offset=0; + sptr_t offset=0; if (strncmp(hotSpotText,"VERBOSE'",8) == 0) { mode = 1; ::SendScintilla(SCI_GOTOPOS,firstPos + 8,0); - int delimitEnd = searchNext("':"); + sptr_t delimitEnd = searchNext("':"); if ((delimitEnd >= 0) && (delimitEnd < firstPos+strlen(hotSpotText))) { @@ -1702,7 +1702,7 @@ void evaluateHotSpot(int &firstPos, char* hotSpotText) mode = 0; ::SendScintilla(SCI_GOTOPOS,firstPos + 8,0); - int delimitEnd = searchNext("':"); + sptr_t delimitEnd = searchNext("':"); if ((delimitEnd >= 0) && (delimitEnd < firstPos+strlen(hotSpotText))) { @@ -1765,7 +1765,7 @@ void evaluateHotSpot(int &firstPos, char* hotSpotText) double d = toDouble(evaluateResult); - if (d > secondSplit.size()-1) d = secondSplit.size()-1; + if (d > secondSplit.size()-1) d = (double)(secondSplit.size()-1); else if (d < 0) d = 0; evaluateResult = secondSplit[d]; @@ -1785,10 +1785,10 @@ void evaluateHotSpot(int &firstPos, char* hotSpotText) delete [] result; } -void launchMessageBox(int &firstPos, char* hotSpotText) +void launchMessageBox(sptr_t &firstPos, char* hotSpotText) { //TODO: need to find a better way to organize different types of messageboxes, there is probably no need to include all of them - int triggerPos = strlen(hotSpotText)+firstPos; + sptr_t triggerPos = strlen(hotSpotText)+firstPos; ::SendScintilla(SCI_SETSEL,firstPos,triggerPos); char* getTerm; @@ -1844,14 +1844,14 @@ void launchMessageBox(int &firstPos, char* hotSpotText) delete [] getTermWide; } -void textCopyCut(int sourceType, int operationType, int &firstPos, char* hotSpotText, int &startingPos, int &checkPoint) +void textCopyCut(int sourceType, int operationType, sptr_t &firstPos, char* hotSpotText, sptr_t &startingPos, sptr_t &checkPoint) { ::SendScintilla(SCI_REPLACESEL,0,(LPARAM)""); if (firstPos != 0) { - int scriptStart; - int selectionStart; - int selectionEnd; + sptr_t scriptStart; + sptr_t selectionStart; + sptr_t selectionEnd; //::SendScintilla(SCI_SETSEL,firstPos-1,firstPos); //::SendScintilla(SCI_REPLACESEL,0,(LPARAM)""); @@ -1894,9 +1894,9 @@ void textCopyCut(int sourceType, int operationType, int &firstPos, char* hotSpot paramNumber = 1; } - int targetLine = (::SendScintilla(SCI_LINEFROMPOSITION,firstPos-1,0)) - paramNumber + 1; + sptr_t targetLine = (::SendScintilla(SCI_LINEFROMPOSITION,firstPos-1,0)) - paramNumber + 1; if (targetLine<0) targetLine = 0; - int targetPos = ::SendScintilla(SCI_POSITIONFROMLINE,targetLine,0); + sptr_t targetPos = ::SendScintilla(SCI_POSITIONFROMLINE,targetLine,0); ::SendScintilla(SCI_SETSELECTION, targetPos, firstPos-1); @@ -1912,7 +1912,7 @@ void textCopyCut(int sourceType, int operationType, int &firstPos, char* hotSpot getTerm = new char[strlen(hotSpotText)]; strcpy(getTerm,hotSpotText+keywordLength); - int scriptFound = -1; + sptr_t scriptFound = -1; if (strlen(getTerm)>0) scriptFound = searchPrev(getTerm); delete [] getTerm; @@ -1984,10 +1984,10 @@ void textCopyCut(int sourceType, int operationType, int &firstPos, char* hotSpot } -void keyWordSpot(int &firstPos, char* hotSpotText, int &startingPos, int &checkPoint) +void keyWordSpot(sptr_t &firstPos, char* hotSpotText, sptr_t &startingPos, sptr_t &checkPoint) { - int hotSpotTextLength = strlen(hotSpotText); - int triggerPos = hotSpotTextLength+firstPos; + size_t hotSpotTextLength = strlen(hotSpotText); + sptr_t triggerPos = hotSpotTextLength+firstPos; ::SendScintilla(SCI_SETSEL,firstPos,triggerPos); //TODO: At least I should rearrange the keyword a little bit for efficiency @@ -2198,7 +2198,7 @@ void keyWordSpot(int &firstPos, char* hotSpotText, int &startingPos, int &checkP if (fileStream.is_open()) { fileStream.seekg (0, std::ios::end); - int length = fileStream.tellg(); + std::streamoff length = fileStream.tellg(); fileStream.seekg (0, std::ios::beg); buffer = new char [length+1]; @@ -2222,7 +2222,7 @@ void keyWordSpot(int &firstPos, char* hotSpotText, int &startingPos, int &checkP if (fileStream.is_open()) { fileStream.seekg (0, std::ios::end); - int length = fileStream.tellg(); + std::streamoff length = fileStream.tellg(); fileStream.seekg (0, std::ios::beg); buffer = new char [length+1]; @@ -2477,7 +2477,7 @@ void searchAndReplace(std::string key, std::string text, bool regexp) char* replaceText = new char[text.length()+1]; strcpy(searchKey,key.c_str()); strcpy(replaceText,text.c_str()); - int keySpot = -1; + sptr_t keySpot = -1; keySpot = searchNext(searchKey,regexp); while (keySpot >= 0) @@ -2592,7 +2592,7 @@ bool fingerTextListActive() } -int hotSpotNavigation(char* tagSign, char* tagTail) +sptr_t hotSpotNavigation(char* tagSign, char* tagTail) { int retVal = 0; // TODO: consolidate this part with dynamic hotspots? @@ -2606,7 +2606,7 @@ int hotSpotNavigation(char* tagSign, char* tagTail) char *hotSpotText; char *hotSpot; - int tagSpot = searchNext(tagTail); // Find the tail first so that nested snippets are triggered correctly + sptr_t tagSpot = searchNext(tagTail); // Find the tail first so that nested snippets are triggered correctly if (tagSpot >= 0) { @@ -2616,8 +2616,8 @@ int hotSpotNavigation(char* tagSign, char* tagTail) //int tailPos = ::SendScintilla(SCI_GETCURRENTPOS,0,0); if (searchPrev(tagSign) >= 0) { - int firstPos = ::SendScintilla(SCI_GETCURRENTPOS,0,0); - int secondPos = 0; + sptr_t firstPos = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t secondPos = 0; grabHotSpotContent(&hotSpotText, &hotSpot, firstPos, secondPos, tagSignLength, tagSpot); if (strncmp(hotSpotText,"(lis)",5) == 0) @@ -2636,7 +2636,7 @@ int hotSpotNavigation(char* tagSign, char* tagTail) ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)hotSpotText); ::SendScintilla(SCI_GOTOPOS,firstPos,0); - int triggerPos = firstPos + strlen(hotSpotText); + sptr_t triggerPos = firstPos + strlen(hotSpotText); ::SendScintilla(SCI_SETSELECTION,firstPos,firstPos+5); ::SendScintilla(SCI_REPLACESEL,0,(LPARAM)""); triggerPos -= 5; @@ -2645,13 +2645,13 @@ int hotSpotNavigation(char* tagSign, char* tagTail) int mode = 0; char* preParam; char delimiter = '|'; - int offset=0; + sptr_t offset=0; if (strncmp(hotSpotText+5,"DELIMIT'",8) == 0) // TODO: the +5 is not necessary, should delete the (opt) first...... { mode = 0; ::SendScintilla(SCI_GOTOPOS,firstPos + 8,0); - int delimitEnd = searchNext("':"); + sptr_t delimitEnd = searchNext("':"); if ((delimitEnd >= 0) && (delimitEnd < triggerPos)) { @@ -2696,7 +2696,7 @@ int hotSpotNavigation(char* tagSign, char* tagTail) std::vector rangeString = toVectorString(getTerm,'-'); delete [] getTerm; - int numLength = 1; + size_t numLength = 1; long rangeStart; long rangeEnd; @@ -2719,7 +2719,7 @@ int hotSpotNavigation(char* tagSign, char* tagTail) rangeStart = abs(rangeStart); rangeEnd = abs(rangeEnd); - int length; + size_t length; if (rangeEnd>=rangeStart) { for (int i = rangeStart; i<=rangeEnd; i++) @@ -2826,8 +2826,8 @@ int hotSpotNavigation(char* tagSign, char* tagTail) ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)hotSpotText); ::SendScintilla(SCI_GOTOPOS,firstPos,0); - int hotSpotFound=-1; - int tempPos[100]; + sptr_t hotSpotFound=-1; + sptr_t tempPos[100]; int i=1; //TODO: consider refactor this part to another function for (i=1;i<=98;i++) @@ -2883,7 +2883,7 @@ int hotSpotNavigation(char* tagSign, char* tagTail) return retVal; } -int grabHotSpotContent(char **hotSpotText,char **hotSpot, int firstPos, int &secondPos, int signLength, int tailPos) +int grabHotSpotContent(char **hotSpotText,char **hotSpot, sptr_t firstPos, sptr_t&secondPos, int signLength, sptr_t tailPos) { int spotType = 0; @@ -2982,8 +2982,8 @@ void showPreview(bool top,bool insertion) char* buffer = toCharArray(bufferWide); buffer = quickStrip(buffer, ' '); - int scopeLength = ::strchr(buffer,'>') - buffer - 1; - int triggerTextLength = strlen(buffer)-scopeLength - 2; + size_t scopeLength = ::strchr(buffer,'>') - buffer - 1; + size_t triggerTextLength = strlen(buffer)-scopeLength - 2; char* tempTriggerText = new char [ triggerTextLength+1]; char* tempScope = new char[scopeLength+1]; @@ -3152,9 +3152,9 @@ void showPreview(bool top,bool insertion) -std::vector snippetTextBrokenDown(std::string editText, std::vector params, char** tempTriggerText, char** snippetContent, int position) +std::vector snippetTextBrokenDown(std::string editText, std::vector params, char** tempTriggerText, char** snippetContent, size_t position) { - int location = 0; + size_t location = 0; if (position<=editText.length()) { @@ -3185,8 +3185,8 @@ std::vector snippetTextBrokenDown(std::string editText, std::vector std::vector spotVector; - int endPos; - int startPos; + sptr_t endPos; + sptr_t startPos; int i = g_listLength-1; do @@ -3217,7 +3217,7 @@ std::vector snippetTextBrokenDown(std::string editText, std::vector } else { ::SendScintilla(SCI_SETSEL,startPos,endPos); - int found = -1; + sptr_t found = -1; do { ::SendScintilla(SCI_REPLACESEL,0,(LPARAM)""); @@ -3315,20 +3315,20 @@ void insertEndSign() //} -void insertTagSign(int type) +void insertTagSign(LRESULT type) { if (g_editorView) { - int posStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); - int lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION, posStart, 0); + sptr_t posStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); + sptr_t lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION, posStart, 0); if (lineCurrent<3) ::SendScintilla(SCI_GOTOLINE,3,0); - int start = -1; - int end = -1; + sptr_t start = -1; + sptr_t end = -1; switch (type) { @@ -3425,16 +3425,16 @@ void insertTagSign(int type) } -bool replaceTag(char *expanded, int &posCurrent, int &posBeforeTag) +bool replaceTag(char *expanded, sptr_t &posCurrent, sptr_t &posBeforeTag) { char *expanded_eolfix; - int eolmode = ::SendScintilla(SCI_GETEOLMODE, 0, 0); + sptr_t eolmode = ::SendScintilla(SCI_GETEOLMODE, 0, 0); char *eol[3] = {"\r\n","\r","\n"}; expanded_eolfix = replaceAll(expanded, "\n", eol[eolmode]); - int lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION, posCurrent, 0); - int initialIndent = ::SendScintilla(SCI_GETLINEINDENTATION, lineCurrent, 0); + sptr_t lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION, posCurrent, 0); + sptr_t initialIndent = ::SendScintilla(SCI_GETLINEINDENTATION, lineCurrent, 0); ::SendScintilla(SCI_INSERTTEXT, posCurrent, (LPARAM)"____`[SnippetInserting]"); @@ -3450,15 +3450,15 @@ bool replaceTag(char *expanded, int &posCurrent, int &posBeforeTag) ::SendScintilla(SCI_GOTOPOS,posBeforeTag,0); searchNext("`[SnippetInserting]"); - int posEndOfInsertedText = ::SendScintilla(SCI_GETCURRENTPOS,0,0)+19; + sptr_t posEndOfInsertedText = ::SendScintilla(SCI_GETCURRENTPOS,0,0)+19; // adjust indentation according to initial indentation if (pc.configInt[INDENT_REFERENCE]==1) { - int lineInsertedSnippet = ::SendScintilla(SCI_LINEFROMPOSITION, posEndOfInsertedText, 0); + sptr_t lineInsertedSnippet = ::SendScintilla(SCI_LINEFROMPOSITION, posEndOfInsertedText, 0); - int lineIndent=0; - for (int i=lineCurrent+1;i<=lineInsertedSnippet;i++) + sptr_t lineIndent=0; + for (sptr_t i=lineCurrent+1;i<=lineInsertedSnippet;i++) { lineIndent = ::SendScintilla(SCI_GETLINEINDENTATION, i, 0); ::SendScintilla(SCI_SETLINEINDENTATION, i, initialIndent+lineIndent); @@ -3469,14 +3469,14 @@ bool replaceTag(char *expanded, int &posCurrent, int &posBeforeTag) ::SendScintilla(SCI_GOTOPOS,posBeforeTag,0); searchNext("[>END<]"); - int posEndOfSnippet = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t posEndOfSnippet = ::SendScintilla(SCI_GETCURRENTPOS,0,0); ::SendScintilla(SCI_SETSELECTION,posEndOfSnippet,posEndOfInsertedText); ::SendScintilla(SCI_REPLACESEL, 0, (LPARAM)""); ::SendScintilla(SCI_GOTOPOS,posBeforeTag,0); //int stopFound = searchNext(g_stopCharArray); - int stopFound = searchNext("\\$\\[.\\[",true); + sptr_t stopFound = searchNext("\\$\\[.\\[",true); //int stopFound = -1; if (stopFound"; - int scopeLength; + size_t scopeLength; scopeLength = maxlength - newText.length(); if (scopeLength < 3) scopeLength = 3; for (int i=0;i generateScopeList() } -bool triggerTag(int &posCurrent, int triggerLength) +bool triggerTag(sptr_t &posCurrent, sptr_t triggerLength) { - int paramPos = -1; + sptr_t paramPos = -1; char* previousChar; sciGetText(&previousChar, posCurrent-1, posCurrent); if (strcmp(previousChar,")")==0) paramPos = ::SendScintilla(SCI_BRACEMATCH,posCurrent-1,0); @@ -5321,7 +5321,7 @@ bool triggerTag(int &posCurrent, int triggerLength) bool tagFound = false; char *tag; - int tagLength = getCurrentTag(posCurrent, &tag, triggerLength); + size_t tagLength = getCurrentTag(posCurrent, &tag, triggerLength); if (((triggerLength<=0) && (tag[0] == '_')) || (tagLength == 0)) { @@ -5329,7 +5329,7 @@ bool triggerTag(int &posCurrent, int triggerLength) } else if (tagLength > 0) //TODO: changing this to >0 fixed the problem of tag_tab_completion, but need to investigate more about the side effect { - int posBeforeTag = posCurrent - tagLength; + sptr_t posBeforeTag = posCurrent - tagLength; std::vector scopeList = generateScopeList(); @@ -5359,8 +5359,8 @@ bool triggerTag(int &posCurrent, int triggerLength) if (paramPos>=0) { // Here the logic is, if it's chain snippet triggering, triggerLength>=0 and so the BEGINUNDOACTION is not going to fire. other wise, it will fire and tagFound will be equal to true. - int paramStart = ::SendScintilla(SCI_GETCURRENTPOS,0,0); - int paramEnd = ::SendScintilla(SCI_BRACEMATCH,paramStart,0) + 1; + sptr_t paramStart = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t paramEnd = ::SendScintilla(SCI_BRACEMATCH,paramStart,0) + 1; if (triggerLength<=0) { @@ -5653,7 +5653,7 @@ void httpToFile(TCHAR* server, TCHAR* request, TCHAR* requestType, TCHAR* pathWi -std::vector smartSplit(int start, int end, char delimiter, int parts) +std::vector smartSplit(sptr_t start, sptr_t end, TCHAR delimiter, int parts) { char filler; if (delimiter!=0) @@ -5668,8 +5668,8 @@ std::vector smartSplit(int start, int end, char delimiter, int part std::vector positions; char* partToSplit; sciGetText(&partToSplit, start, end); - int signSpot; - int tailSpot; + sptr_t signSpot; + sptr_t tailSpot; char* tagSignGet; char* tagTailGet; @@ -5690,7 +5690,7 @@ std::vector smartSplit(int start, int end, char delimiter, int part tailSpot = searchNextMatchedTail(tagSignGet,tagTailGet); if (tailSpot <= end && tailSpot> start) { - for (int i = signSpot - start; i smartSplit(int start, int end, char delimiter, int part positions.push_back(retVal[i].length()); } - int caret = start; + sptr_t caret = start; char* tempString; for (i = 0; i 0) || (dynamicSpot))) && (outBound)) { - int prevPos = g_lastTriggerPosition; + sptr_t prevPos = g_lastTriggerPosition; do { g_lastTriggerPosition = prevPos; @@ -5940,10 +5940,10 @@ void doTabActivate(bool navOnly) ::SendScintilla(SCI_AUTOCCOMPLETE,0,0); autoComplete = 1; } - int posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); + sptr_t posCurrent = ::SendScintilla(SCI_GETCURRENTPOS,0,0); //int posTriggerStart = ::SendScintilla(SCI_GETCURRENTPOS,0,0); - int lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION,posCurrent,0); + sptr_t lineCurrent = ::SendScintilla(SCI_LINEFROMPOSITION,posCurrent,0); if ((g_editorView == true) && (lineCurrent <=2)) { @@ -5965,8 +5965,8 @@ void doTabActivate(bool navOnly) pc.configInt[LIVE_HINT_UPDATE]--; g_selectionMonitor--; - int posSelectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); - int posSelectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0); + sptr_t posSelectionStart = ::SendScintilla(SCI_GETSELECTIONSTART,0,0); + sptr_t posSelectionEnd = ::SendScintilla(SCI_GETSELECTIONEND,0,0); if (g_optionMode) { @@ -5995,11 +5995,11 @@ void doTabActivate(bool navOnly) // the SCI_BEGINUNDOACTION is sent. - int navSpot = 0; + sptr_t navSpot = 0; bool dynamicSpotTemp = false; bool dynamicSpot = false; bool outBound = false; - int prevHotspotPos = -1; + sptr_t prevHotspotPos = -1; if (g_editorView == false) { @@ -6059,7 +6059,7 @@ void doTabActivate(bool navOnly) if ((!((navSpot > 0) || (dynamicSpot))) && (outBound)) { - int prevPos = g_lastTriggerPosition; //TODO: should be able to restructure and use the prevHotspotPos defined before + sptr_t prevPos = g_lastTriggerPosition; //TODO: should be able to restructure and use the prevHotspotPos defined before do { g_lastTriggerPosition = prevPos; diff --git a/PluginDefinition.h b/PluginDefinition.h index fea2b46..98a7907 100644 --- a/PluginDefinition.h +++ b/PluginDefinition.h @@ -86,22 +86,22 @@ void showInsertionDlg(); void setInsertionDialogState(int state); void toggleDisable(); -void restoreTab(int &posCurrent, int &posSelectionStart, int &posSelectionEnd); -int searchPrevMatchedSign(char* tagSign, char* tagTail); -int searchPrevMatchedTail(char* tagSign, char* tagTail); -bool dynamicHotspot(int &startingPos, char* tagSign = "$[![", char* tagTail = "]!]"); -void paramsInsertion(int &firstPos, char* hotSpot, int &checkPoint); -void textCopyCut(int sourceType, int operationType, int &firstPos, char* hotSpotText, int &startingPos, int &checkPoint); -void keyWordSpot(int &firstPos, char* hotSpotText, int &startingPos, int &checkPoint); -void webRequest(int &firstPos, char* hotSpotText); -void executeCommand(int &firstPos, char* hotSpotText); -void launchMessageBox(int &firstPos, char* hotSpotText); +void restoreTab(sptr_t &posCurrent, sptr_t &posSelectionStart, sptr_t &posSelectionEnd); +sptr_t searchPrevMatchedSign(char* tagSign, char* tagTail); +sptr_t searchPrevMatchedTail(char* tagSign, char* tagTail); +bool dynamicHotspot(sptr_t &startingPos, char* tagSign = "$[![", char* tagTail = "]!]"); +void paramsInsertion(sptr_t &firstPos, char* hotSpot, sptr_t &checkPoint); +void textCopyCut(int sourceType, int operationType, sptr_t &firstPos, char* hotSpotText, sptr_t &startingPos, sptr_t &checkPoint); +void keyWordSpot(sptr_t &firstPos, char* hotSpotText, sptr_t &startingPos, sptr_t &checkPoint); +void webRequest(sptr_t &firstPos, char* hotSpotText); +void executeCommand(sptr_t &firstPos, char* hotSpotText); +void launchMessageBox(sptr_t &firstPos, char* hotSpotText); std::string evaluateCall(char* expression); -void evaluateHotSpot(int &firstPos, char* hotSpotText); -void chainSnippet(int &firstPos, char* hotSpotText); -int hotSpotNavigation(char* tagSign = "$[![", char* tagTail = "]!]"); +void evaluateHotSpot(sptr_t &firstPos, char* hotSpotText); +void chainSnippet(sptr_t &firstPos, char* hotSpotText); +sptr_t hotSpotNavigation(char* tagSign = "$[![", char* tagTail = "]!]"); -int grabHotSpotContent(char **hotSpotText,char **hotSpot, int firstPos, int &secondPos, int signLength, int tailPos); +int grabHotSpotContent(char **hotSpotText,char **hotSpot, sptr_t firstPos, sptr_t&secondPos, int signLength, sptr_t tailPos); void showPreview(bool top = false,bool insertion = false); void doSelectionToSnippet(); @@ -119,18 +119,18 @@ void insertOptionSign(); void insertListSign(); void insertEndSign(); //void insertTagSign(char * tagSign); -void insertTagSign(int type); +void insertTagSign(LRESULT type); void searchAndReplace(std::string key, std::string text, bool regExp = false); bool getLineChecked(char **buffer, int lineNumber, TCHAR* errorText); -bool replaceTag(char *expanded, int &posCurrent, int &posBeforeTag); +bool replaceTag(char *expanded, sptr_t &posCurrent, sptr_t &posBeforeTag); void openDatabase(); -int getCurrentTag(int posCurrent, char **buffer, int triggerLength = 0); +size_t getCurrentTag(sptr_t posCurrent, char **buffer, sptr_t triggerLength = 0); void showSnippetDock(); void updateDockItems(bool withContent = true, bool withAll = false, char* tag = "%", bool populate = false, bool populateInsertion = false, bool searchType = false); -wchar_t* constructDockItems(std::string scope, std::string triggerText, int maxlength); +wchar_t* constructDockItems(std::string scope, std::string triggerText, size_t maxlength); void populateDockItems(bool withAll = true, bool insertion = false); bool fingerTextListActive(); @@ -185,12 +185,12 @@ void setFocusToWindow(); void searchWindowByName(std::string searchKey = "", HWND parentWindow = 0); //std::vector snippetTextBrokenDown(std::string editText, std::vector vs, char* tempTriggerText, char* snippetContent, int position); -std::vector snippetTextBrokenDown(std::string editText, std::vector params, char** tempTriggerText, char** snippetContent, int position); +std::vector snippetTextBrokenDown(std::string editText, std::vector params, char** tempTriggerText, char** snippetContent, size_t position); void selectionMonitor(int contentChange); std::vector generateScopeList(); -bool triggerTag(int &posCurrent,int triggerLength = 0); -int tagComplete(); +bool triggerTag(sptr_t &posCurrent, sptr_t triggerLength = 0); +sptr_t tagComplete(); void doTagComplete(); bool diagActivate(char* tag); void triggerDiagInsertion(); @@ -198,7 +198,7 @@ void triggerDiagInsertion(); void tabActivate(); void doTabActivate(bool navOnly = false); -std::vector smartSplit(int start, int end, char delimiter, int parts = 0); +std::vector smartSplit(sptr_t start, sptr_t end, TCHAR delimiter, int parts = 0); void removehook(); void installhook(); diff --git a/Utils/ConversionUtils.cpp b/Utils/ConversionUtils.cpp index 95d4ab5..e512155 100644 --- a/Utils/ConversionUtils.cpp +++ b/Utils/ConversionUtils.cpp @@ -137,7 +137,7 @@ long toLong(std::string source) return l; } -std::vector toVectorString(char* str, char c, int parts) +std::vector toVectorString(char* str, TCHAR c, int parts) { int i = 1; if (parts == 0) i = -1; diff --git a/Utils/ConversionUtils.h b/Utils/ConversionUtils.h index 424fbda..07ca641 100644 --- a/Utils/ConversionUtils.h +++ b/Utils/ConversionUtils.h @@ -52,7 +52,7 @@ double toDouble(const std::string &s); long toLong(std::string source); -std::vector toVectorString(char* str, char c = ' ', int parts = 0); +std::vector toVectorString(char* str, TCHAR c = ' ', int parts = 0); std::vector toSortedVectorString(std::vector v); int toVk(char* input); diff --git a/vs2022-x64-i386-build-specs.png b/vs2022-x64-i386-build-specs.png new file mode 100644 index 0000000..2c3f473 Binary files /dev/null and b/vs2022-x64-i386-build-specs.png differ