Skip to content

Commit

Permalink
Update to Scintilla v4.1.4 files, fix PA zip
Browse files Browse the repository at this point in the history
Closes #11
  • Loading branch information
dail8859 committed Jun 30, 2019
1 parent bebbeda commit 862ed3f
Show file tree
Hide file tree
Showing 12 changed files with 763 additions and 395 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ to use `*`, `-` and `_` to act as surround characters as the above examples do.
## Installation

Use the built in Plugin Admin to automatically install the plugin.

## Development
The code has been developed using Visual Studio 2017. Building the code will generate the DLL which can be used by Notepad++. For convenience, MSVC copies the DLL into the Notepad++ plugin directory.
The code is developed using Visual Studio 2017. Building the code will generate a DLL which can be used by Notepad++. For convenience, Visual Studio copies the DLL into the Notepad++ plugin directory.

This comment has been minimized.

Copy link
@MAPJe71

MAPJe71 Jul 19, 2019

"for convenience"?
Make sure you have a copy of the existing/stable plugin because you're probably overwriting it, ruining your working installation.

This comment has been minimized.

Copy link
@dail8859

dail8859 via email Jul 19, 2019

Author Owner

## License
This code is released under the [GNU General Public License version 2](http://www.gnu.org/licenses/gpl-2.0.txt).
4 changes: 2 additions & 2 deletions SurroundSelection.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SurroundSelection", "src\SurroundSelection.vcxproj", "{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}"
EndProject
Expand Down
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.3.0.{build}
version: 1.3.1.{build}
image: Visual Studio 2017

platform:
Expand Down Expand Up @@ -35,15 +35,13 @@ after_build:
Push-AppveyorArtifact "$($BuildPath)\SurroundSelection.dll" -FileName SurroundSelection.dll
if ($($env:APPVEYOR_REPO_TAG) -eq "true" -and $env:CONFIGURATION -eq "Release") {
mkdir SurroundSelection
Move-Item -Path "$($BuildPath)\SurroundSelection.dll" -Destination .\SurroundSelection
if ($env:BUILD_PLATFORM -eq "x64"){
$ZipFileName = "SurroundSelection_$($env:APPVEYOR_REPO_TAG_NAME)_x64.zip"
}
if ($env:BUILD_PLATFORM -eq "Win32"){
$ZipFileName = "SurroundSelection_$($env:APPVEYOR_REPO_TAG_NAME).zip"
}
7z a $ZipFileName .\SurroundSelection
7z a $ZipFileName "$($BuildPath)\SurroundSelection.dll"
}
artifacts:
Expand Down
4 changes: 2 additions & 2 deletions src/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#include "PluginInterface.h"
#include "ScintillaGateway.h"
#include "ScintillaEditor.h"
#include "resource.h"
#include "AboutDialog.h"

Expand All @@ -31,7 +31,7 @@ static NppData nppData;
static HHOOK hook = NULL;
static HKL keyboardLayout = NULL;
static bool hasFocus = true;
static ScintillaGateway editor;
static ScintillaEditor editor;
static LPWORD kbBuff = (LPWORD)new byte[buffChars];
static PBYTE kbState = new byte[256];
TCHAR addChars[1024];
Expand Down
89 changes: 53 additions & 36 deletions src/Npp/Notepad_plus_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP,\
L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77,\
L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77, L_BAANC, L_SREC,\
L_IHEX, L_TEHEX, L_SWIFT,\
L_ASN1, L_AVS, L_BLITZBASIC, L_PUREBASIC, L_FREEBASIC, \
L_CSOUND, L_ERLANG, L_ESCRIPT, L_FORTH, L_LATEX, \
L_MMIXAL, L_NIMROD, L_NNCRONTAB, L_OSCRIPT, L_REBOL, \
L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\
// Don't use L_JS, use L_JAVASCRIPT instead
// The end of enumated language type, so it should be always at the end
L_EXTERNAL};

enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10};
enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 };



Expand Down Expand Up @@ -174,7 +180,11 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
//BOOL NPPM_GETENABLETHEMETEXTUREFUNC(0, 0)

#define NPPM_GETPLUGINSCONFIGDIR (NPPMSG + 46)
//void NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str)
//INT NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str)
// Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user
// Returns the number of TCHAR copied/to copy.
// Users should call it with "str" be NULL to get the required number of TCHAR (not including the terminating nul character),
// allocate "str" buffer with the return value + 1, then call it again to get the path.

#define NPPM_MSGTOPLUGIN (NPPMSG + 47)
//BOOL NPPM_MSGTOPLUGIN(TCHAR *destModuleName, CommunicationInfo *info)
Expand Down Expand Up @@ -213,7 +223,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// returned value : TRUE if tab bar is hidden, otherwise FALSE

#define NPPM_GETPOSFROMBUFFERID (NPPMSG + 57)
// INT NPPM_GETPOSFROMBUFFERID(INT bufferID, INT priorityView)
// INT NPPM_GETPOSFROMBUFFERID(UINT_PTR bufferID, INT priorityView)
// Return VIEW|INDEX from a buffer ID. -1 if the bufferID non existing
// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly
//
Expand All @@ -223,11 +233,11 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// SUB_VIEW 1

#define NPPM_GETFULLPATHFROMBUFFERID (NPPMSG + 58)
// INT NPPM_GETFULLPATHFROMBUFFERID(INT bufferID, TCHAR *fullFilePath)
// INT NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, TCHAR *fullFilePath)
// Get full path file name from a bufferID.
// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy
// User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character),
// allocate fullFilePath with the return values + 1, then call it again to get full path file name
// allocate fullFilePath with the return values + 1, then call it again to get full path file name

#define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59)
// LRESULT NPPM_GETBUFFERIDFROMPOS(INT index, INT iView)
Expand All @@ -240,64 +250,53 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// Returns active Buffer

#define NPPM_RELOADBUFFERID (NPPMSG + 61)
// VOID NPPM_RELOADBUFFERID(0, 0)
// VOID NPPM_RELOADBUFFERID(UINT_PTR bufferID, BOOL alert)
// Reloads Buffer
// wParam: Buffer to reload
// lParam: 0 if no alert, else alert


#define NPPM_GETBUFFERLANGTYPE (NPPMSG + 64)
// INT NPPM_GETBUFFERLANGTYPE(INT bufferID, 0)
// INT NPPM_GETBUFFERLANGTYPE(UINT_PTR bufferID, 0)
// wParam: BufferID to get LangType from
// lParam: 0
// Returns as int, see LangType. -1 on error

#define NPPM_SETBUFFERLANGTYPE (NPPMSG + 65)
// BOOL NPPM_SETBUFFERLANGTYPE(INT bufferID, INT langType)
// BOOL NPPM_SETBUFFERLANGTYPE(UINT_PTR bufferID, INT langType)
// wParam: BufferID to set LangType of
// lParam: LangType
// Returns TRUE on success, FALSE otherwise
// use int, see LangType for possible values
// L_USER and L_EXTERNAL are not supported

#define NPPM_GETBUFFERENCODING (NPPMSG + 66)
// INT NPPM_GETBUFFERENCODING(INT bufferID, 0)
// INT NPPM_GETBUFFERENCODING(UINT_PTR bufferID, 0)
// wParam: BufferID to get encoding from
// lParam: 0
// returns as int, see UniMode. -1 on error

#define NPPM_SETBUFFERENCODING (NPPMSG + 67)
// BOOL NPPM_SETBUFFERENCODING(INT bufferID, INT encoding)
// BOOL NPPM_SETBUFFERENCODING(UINT_PTR bufferID, INT encoding)
// wParam: BufferID to set encoding of
// lParam: encoding
// Returns TRUE on success, FALSE otherwise
// use int, see UniMode
// Can only be done on new, unedited files

#define NPPM_GETBUFFERFORMAT (NPPMSG + 68)
// INT NPPM_GETBUFFERFORMAT(INT bufferID, 0)
// wParam: BufferID to get format from
// INT NPPM_GETBUFFERFORMAT(UINT_PTR bufferID, 0)
// wParam: BufferID to get EolType format from
// lParam: 0
// returns as int, see formatType. -1 on error
// returns as int, see EolType format. -1 on error

#define NPPM_SETBUFFERFORMAT (NPPMSG + 69)
// BOOL NPPM_SETBUFFERFORMAT(INT bufferID, INT format)
// wParam: BufferID to set format of
// BOOL NPPM_SETBUFFERFORMAT(UINT_PTR bufferID, INT format)
// wParam: BufferID to set EolType format of
// lParam: format
// Returns TRUE on success, FALSE otherwise
// use int, see formatType

/*
#define NPPM_ADDREBAR (NPPMSG + 57)
// BOOL NPPM_ADDREBAR(0, REBARBANDINFO *)
// Returns assigned ID in wID value of struct pointer
#define NPPM_UPDATEREBAR (NPPMSG + 58)
// BOOL NPPM_ADDREBAR(INT ID, REBARBANDINFO *)
//Use ID assigned with NPPM_ADDREBAR
#define NPPM_REMOVEREBAR (NPPMSG + 59)
// BOOL NPPM_ADDREBAR(INT ID, 0)
//Use ID assigned with NPPM_ADDREBAR
*/
// use int, see EolType format


#define NPPM_HIDETOOLBAR (NPPMSG + 70)
// BOOL NPPM_HIDETOOLBAR(0, BOOL hideOrNot)
Expand Down Expand Up @@ -333,7 +332,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey *sk)
// get your plugin command current mapped shortcut into sk via cmdID
// You may need it after getting NPPN_READY notification
// returned value : TRUE if this function call is successful and shorcut is enable, otherwise FALSE
// returned value : TRUE if this function call is successful and shortcut is enable, otherwise FALSE

#define NPPM_DOOPEN (NPPMSG + 77)
// BOOL NPPM_DOOPEN(0, const TCHAR *fullPathName2Open)
Expand All @@ -345,7 +344,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W

#define NPPM_GETCURRENTNATIVELANGENCODING (NPPMSG + 79)
// INT NPPM_GETCURRENTNATIVELANGENCODING(0, 0)
// returned value : the current native language enconding
// returned value : the current native language encoding

#define NPPM_ALLOCATESUPPORTED (NPPMSG + 80)
// returns TRUE if NPPM_ALLOCATECMDID is supported
Expand All @@ -364,15 +363,15 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W

#define NPPM_GETLANGUAGENAME (NPPMSG + 83)
// INT NPPM_GETLANGUAGENAME(int langType, TCHAR *langName)
// Get programing language name from the given language type (LangType)
// Get programming language name from the given language type (LangType)
// Return value is the number of copied character / number of character to copy (\0 is not included)
// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy.
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time
// by passing allocated buffer as argument langName

#define NPPM_GETLANGUAGEDESC (NPPMSG + 84)
// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc)
// Get programing language short description from the given language type (LangType)
// Get programming language short description from the given language type (LangType)
// Return value is the number of copied character / number of character to copy (\0 is not included)
// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy.
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time
Expand All @@ -389,7 +388,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W

#define NPPM_GETAPPDATAPLUGINSALLOWED (NPPMSG + 87)
// BOOL NPPM_GETAPPDATAPLUGINSALLOWED(0, 0)
// Check to see if loading plugins from "%APPDATA%\Notepad++\plugins" is allowed.
// Check to see if loading plugins from "%APPDATA%\..\Local\Notepad++\plugins" is allowed.

#define NPPM_GETCURRENTVIEW (NPPMSG + 88)
// INT NPPM_GETCURRENTVIEW(0, 0)
Expand Down Expand Up @@ -419,6 +418,19 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
#define NPPM_DISABLEAUTOUPDATE (NPPMSG + 95) // 2119 in decimal
// VOID NPPM_DISABLEAUTOUPDATE(0, 0)

#define NPPM_REMOVESHORTCUTBYCMDID (NPPMSG + 96) // 2120 in decimal
// BOOL NPPM_REMOVESHORTCUTASSIGNMENT(int cmdID)
// removes the assigned shortcut mapped to cmdID
// returned value : TRUE if function call is successful, otherwise FALSE

#define NPPM_GETPLUGINHOMEPATH (NPPMSG + 97)
// INT NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR *pluginRootPath)
// Get plugin home root path. It's useful if plugins want to get its own path
// by appending <pluginFolderName> which is the name of plugin without extension part.
// Returns the number of TCHAR copied/to copy.
// Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character),
// allocate pluginRootPath buffer with the return value + 1, then call it again to get the path.

#define RUNCOMMAND_USER (WM_USER + 3000)
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
#define NPPM_GETCURRENTDIRECTORY (RUNCOMMAND_USER + CURRENT_DIRECTORY)
Expand All @@ -427,6 +439,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
#define NPPM_GETEXTPART (RUNCOMMAND_USER + EXT_PART)
#define NPPM_GETCURRENTWORD (RUNCOMMAND_USER + CURRENT_WORD)
#define NPPM_GETNPPDIRECTORY (RUNCOMMAND_USER + NPP_DIRECTORY)
#define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR)
// BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str)
// where str is the allocated TCHAR array,
// strLen is the allocated array size
Expand All @@ -440,6 +453,8 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// INT NPPM_GETCURRENTCOLUMN(0, 0)
// return the caret current position column

#define NPPM_GETNPPFULLFILEPATH (RUNCOMMAND_USER + NPP_FULL_FILE_PATH)

#define VAR_NOT_RECOGNIZED 0
#define FULL_CURRENT_PATH 1
#define CURRENT_DIRECTORY 2
Expand All @@ -450,6 +465,8 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
#define NPP_DIRECTORY 7
#define CURRENT_LINE 8
#define CURRENT_COLUMN 9
#define NPP_FULL_FILE_PATH 10
#define GETFILENAMEATCURSOR 11


// Notification code
Expand Down Expand Up @@ -541,10 +558,10 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
//scnNotification->nmhdr.hwndFrom = bufferID;
//scnNotification->nmhdr.idFrom = docStatus;
// where bufferID is BufferID
// docStatus can be combined by DOCSTAUS_READONLY and DOCSTAUS_BUFFERDIRTY
// docStatus can be combined by DOCSTATUS_READONLY and DOCSTATUS_BUFFERDIRTY

#define DOCSTAUS_READONLY 1
#define DOCSTAUS_BUFFERDIRTY 2
#define DOCSTATUS_READONLY 1
#define DOCSTATUS_BUFFERDIRTY 2

#define NPPN_DOCORDERCHANGED (NPPN_FIRST + 17) // To notify plugins that document order is changed
//scnNotification->nmhdr.code = NPPN_DOCORDERCHANGED;
Expand Down
29 changes: 29 additions & 0 deletions src/Npp/Sci_Position.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Scintilla source code edit control
/** @file Sci_Position.h
** Define the Sci_Position type used in Scintilla's external interfaces.
** These need to be available to clients written in C so are not in a C++ namespace.
**/
// Copyright 2015 by Neil Hodgson <[email protected]>
// The License.txt file describes the conditions under which this software may be distributed.

#ifndef SCI_POSITION_H
#define SCI_POSITION_H

#include <stddef.h>

// Basic signed type used throughout interface
typedef ptrdiff_t Sci_Position;

// Unsigned variant used for ILexer::Lex and ILexer::Fold
typedef size_t Sci_PositionU;

// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
typedef long Sci_PositionCR;

#ifdef _WIN32
#define SCI_METHOD __stdcall
#else
#define SCI_METHOD
#endif

#endif
Loading

0 comments on commit 862ed3f

Please sign in to comment.