diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..2d01d71
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,13 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+
+ # Maintain dependencies for GitHub Actions
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
diff --git a/.github/workflows/CI_build.yml b/.github/workflows/CI_build.yml
new file mode 100644
index 0000000..43d552f
--- /dev/null
+++ b/.github/workflows/CI_build.yml
@@ -0,0 +1,33 @@
+name: CI_build
+
+on: [push, pull_request]
+
+jobs:
+ build:
+
+ runs-on: windows-latest
+ strategy:
+ max-parallel: 6
+ matrix:
+ build_configuration: [Release, Debug]
+ build_platform: [x64, Win32, ARM64]
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v4
+
+ - name: Add msbuild to PATH
+ uses: microsoft/setup-msbuild@v1
+
+ - name: MSBuild of plugin dll
+ working-directory: .\
+ run: msbuild LuaScript.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="v143"
+
+ - name: Archive artifacts
+ if: matrix.build_configuration == 'Release'
+ uses: actions/upload-artifact@v3
+ with:
+ name: plugin_dll_${{ matrix.build_platform }}
+ path: |
+ bin\${{ matrix.build_configuration }}_${{ matrix.build_platform }}\LuaScript.dll
+ bin\${{ matrix.build_configuration }}_${{ matrix.build_platform }}\Lua.dll
diff --git a/.gitignore b/.gitignore
index f7d7d2e..28a90c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,28 +1,56 @@
-## From https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
-
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
+*.userosscache
*.sln.docstates
-# Build results
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+# Build results
[Dd]ebug/
+[Dd]ebugPublic/
[Rr]elease/
+[Rr]eleases/
x64/
-build/
+x86/
+bld/
[Bb]in/
[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+**/Properties/launchSettings.json
+
*_i.c
*_p.c
+*_i.h
*.ilk
*.meta
*.obj
@@ -42,21 +70,31 @@ build/
*.vssscc
.builds
*.pidb
-*.log
+*.svclog
*.scc
+# Chutzpah Test files
+_Chutzpah*
+
# Visual C++ cache files
ipch/
*.aps
*.ncb
+*.opendb
*.opensdf
*.sdf
*.cachefile
+*.VC.db
+*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
# Guidance Automation Toolkit
*.gpState
@@ -64,6 +102,10 @@ ipch/
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
# TeamCity is a build add-in
_TeamCity*
@@ -71,9 +113,21 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
# NCrunch
-*.ncrunch*
+_NCrunch_*
.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
# Installshield output folder
[Ee]xpress/
@@ -92,68 +146,148 @@ DocProject/Help/html
publish/
# Publish Web Output
-*.Publish.xml
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
-# NuGet Packages Directory
-## TODO: If you have NuGet Package Restore enabled, uncomment the next line
-#packages/
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
-# Windows Azure Build Output
-csx
+# Microsoft Azure Build Output
+csx/
*.build.csdef
-# Windows Store app package directory
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
# Others
-sql/
-*.Cache
ClientBin/
-[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
-*.[Pp]ublish.xml
+*.dbproj.schemaview
+*.jfm
*.pfx
*.publishsettings
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
# RIA/Silverlight projects
Generated_Code/
-# Backup & report files from converting an old project file to a newer
-# Visual Studio version. Backup files are not needed, because we have git ;-)
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
-App_Data/*.mdf
-App_Data/*.ldf
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Typescript v1 declaration files
+typings/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
-# =========================
-# Windows detritus
-# =========================
+# CodeRush
+.cr/
-# Windows image file caches
-Thumbs.db
-ehthumbs.db
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
-# Folder config file
-Desktop.ini
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
-# Recycle Bin used on file shares
-$RECYCLE.BIN/
+# Telerik's JustMock configuration file
+*.jmconfig
-# Mac crap
-.DS_Store
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
-/Unicode Release
-/Unicode Debug
-/Release
-/Debug
-/ResEdit-x64
LuaDist
-gh-pages
/docs_gen/Editor.lua
+bin/
+src/build/
diff --git a/LuaScript.sln b/LuaScript.sln
index 10bf81f..341b109 100644
--- a/LuaScript.sln
+++ b/LuaScript.sln
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.40629.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.645
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LuaScript", "src\LuaScript.vcxproj", "{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}"
ProjectSection(ProjectDependencies) = postProject
@@ -12,24 +12,34 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Lua", "src\Lua.vcxproj", "{
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
+ Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|ARM64.Build.0 = Debug|ARM64
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|Win32.ActiveCfg = Debug|Win32
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|Win32.Build.0 = Debug|Win32
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|x64.ActiveCfg = Debug|x64
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Debug|x64.Build.0 = Debug|x64
+ {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|ARM64.ActiveCfg = Release|ARM64
+ {1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|ARM64.Build.0 = Release|ARM64
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|Win32.ActiveCfg = Release|Win32
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|Win32.Build.0 = Release|Win32
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|x64.ActiveCfg = Release|x64
{1590D7CD-7D3A-4AB7-A355-EE02F7FB987D}.Release|x64.Build.0 = Release|x64
+ {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|ARM64.Build.0 = Debug|ARM64
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|Win32.ActiveCfg = Debug|Win32
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|Win32.Build.0 = Debug|Win32
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|x64.ActiveCfg = Debug|x64
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Debug|x64.Build.0 = Debug|x64
+ {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|ARM64.ActiveCfg = Release|ARM64
+ {FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|ARM64.Build.0 = Release|ARM64
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|Win32.ActiveCfg = Release|Win32
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|Win32.Build.0 = Release|Win32
{FCFBB3B0-8628-4CD0-A9B7-1BFB34E31E2A}.Release|x64.ActiveCfg = Release|x64
diff --git a/README.md b/README.md
index e6c8812..12f886a 100644
--- a/README.md
+++ b/README.md
@@ -1,62 +1,42 @@
# LuaScript
-Notepad++ plugin for [Lua](http://www.lua.org/) scripting capabilities. Provides control over all of Scintilla's features and options with a light-weight, fully-functional programming language. Download it from the [Release](https://github.com/dail8859/LuaScript/releases) page.
+
+[](https://ci.appveyor.com/project/dail8859/luascript)
+
+Notepad++ plugin for [Lua](http://www.lua.org/) scripting capabilities. This provides control over all of Scintilla's features and options with a light-weight, fully-functional programming language.
Major features include:
- Assign Lua functions to shortcut keys
-- Register callbacks to specific events
+- Register callback functions for events
- Full Lua 5.3 functionality
- Interactive console with auto-completion
- Requires no special permissions
-## Documentation
-The full API documentation can be found [here](http://dail8859.github.io/LuaScript/).
+## Getting Started
+Install the plugin using the Notepad++ Plugin Admin, or you can manually download it from the [Release](https://github.com/dail8859/LuaScript/releases) page and extract the zip into your `plugins` folder.
-## Examples
-Just show me what it can do! Also, check out the [examples](/examples/) directory.
+#### Lua Console
+LuaScript provides an interactive console for running Lua commands. This can be shown by `Plugins > LuaScript > Show Console`.
-- Change Notepad++'s ugly marker symbols:
-```lua
--- Notepad++ uses 24 internally
-editor:MarkerDefine(24, SC_MARK_BOOKMARK)
-editor.MarkerFore[24] = 0x0000EE
-editor.MarkerBack[24] = 0x6060F2
-```
+#### Startup Script
+LuaScript looks for the `\plugins\config\startup.lua` file and automatically runs it on Notepad++ startup. You can easily edit this file via `Plugins > LuaScript > Edit Startup Script`. You can include any commands you want to immediately execute on program startup, as well as register any additional shortcuts or callbacks.
-- Find all instances of `image345.jpg`, `image123.png`, etc and modify the number:
-```lua
-for m in editor:match("(image)(\\d+)(\\.(jpg|png))", SCFIND_REGEXP) do
- i = tonumber(editor.Tag[2])
- m:replace(editor.Tag[1] .. i + 1 .. editor.Tag[3])
-end
-```
+#### Registering New Shortcuts
+New functions can be added as shortcuts by using [AddShortcut](https://dail8859.github.io/LuaScript/classes/Notepad.html#Notepad.AddShortcut). The new menu items are listed under the `Plugins > LuaScript` menu. For example [this script](https://dail8859.github.io/LuaScript/examples/visualstudiolinecopy.lua.html) adds 2 new menu items.
-- Get some of Visual Studio's copy and paste functionality:
-```lua
--- Mimic Visual Studio's "Ctrl+C" that copies the entire line if nothing is selected
-npp.AddShortcut("Copy Allow Line", "Ctrl+C", function()
- editor:CopyAllowLine()
-end)
+#### Registering Callback Functions
+Scripts can also register functions to be called when certain events occur, such as a file being opened, text being modified, etc. Each callback provides a different set of parameters. See the documentation for [callbacks](https://dail8859.github.io/LuaScript/topics/callbacks.md.html) to see the entire list of possible events and parameters provided.
--- Mimic Visual Studio's "Ctrl+X" that cuts the line if nothing is selected
-npp.AddShortcut("Cut Allow Line", "Ctrl+X", function()
- if editor.SelectionEmpty then
- editor:CopyAllowLine()
- editor:LineDelete()
- else
- editor:Cut()
- end
-end)
-```
+## Documentation
+The full API documentation can be found [here](http://dail8859.github.io/LuaScript/). Also be sure to check out the [examples](/examples/) directory.
## Development
-The code has been developed using MSVC 2013. To compile the code:
+The code has been developed using Visual Studio 2019. To compile the code:
1. Open the `LuaScript.sln` file
-2. Select the `Win32` platform (x64 is currently experimental)
-3. Press `F7` and that's it!
+1. Press `F7` and that's it!
-For convenience, MSVC automatically copies the DLL into the Notepad++ plugin directory.
+For convenience, Visual Studio automatically copies the DLL into the Notepad++ plugin directory.
## License
This code is released under the [GNU General Public License version 2](http://www.gnu.org/licenses/gpl-2.0.txt).
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..b2609f9
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,93 @@
+version: 0.10.1.{build}
+image: Visual Studio 2019
+
+platform:
+ - x64
+ - Win32
+ - arm64
+
+configuration:
+ - Release
+ - Debug
+
+install:
+ - if "%platform%"=="x64" set archi=amd64
+ - if "%platform%"=="x64" set build_platform=x64
+
+ - if "%platform%"=="Win32" set archi=x86
+ - if "%platform%"=="Win32" set build_platform=Win32
+
+ - if "%platform%"=="arm64" set archi=amd64_arm64
+ - if "%platform%"=="arm64" set build_platform=arm64
+
+ - call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" %archi%
+
+
+build_script:
+ - cd "%APPVEYOR_BUILD_FOLDER%"
+ - msbuild LuaScript.sln /m /p:Configuration="%configuration%" /p:Platform="%build_platform%" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
+
+after_build:
+ - cd "%APPVEYOR_BUILD_FOLDER%"
+ - ps: >-
+
+ $BuildPath = "$($env:APPVEYOR_BUILD_FOLDER)\bin\$($env:CONFIGURATION)_$($env:BUILD_PLATFORM)"
+
+ Push-AppveyorArtifact "$($BuildPath)\LuaScript.dll" -FileName LuaScript.dll
+
+ Push-AppveyorArtifact "$($BuildPath)\Lua.dll" -FileName Lua.dll
+
+ if ($env:BUILD_PLATFORM -eq "x64") {
+ $SdkFileName = "LuaScript_SDK_x64.zip"
+ }
+ if ($env:BUILD_PLATFORM -eq "arm64") {
+ $SdkFileName = "LuaScript_SDK_arm64.zip"
+ }
+ if ($env:BUILD_PLATFORM -eq "Win32") {
+ $SdkFileName = "LuaScript_SDK.zip"
+ }
+
+ 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lauxlib.h"
+
+ 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lua.h"
+
+ 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lua.hpp"
+
+ 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\luaconf.h"
+
+ 7z a $SdkFileName "$($env:APPVEYOR_BUILD_FOLDER)\src\lua\src\lualib.h"
+
+ 7z a $SdkFileName "$($BuildPath)\Lua.lib"
+
+ Push-AppveyorArtifact $SdkFileName -FileName $SdkFileName
+
+ if ($($env:APPVEYOR_REPO_TAG) -eq "true" -and $env:CONFIGURATION -eq "Release") {
+ if ($env:BUILD_PLATFORM -eq "x64") {
+ $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME)_x64.zip"
+ }
+ if ($env:BUILD_PLATFORM -eq "arm64") {
+ $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME)_arm64.zip"
+ }
+ if ($env:BUILD_PLATFORM -eq "Win32") {
+ $ZipFileName = "LuaScript_$($env:APPVEYOR_REPO_TAG_NAME).zip"
+ }
+ 7z a $ZipFileName "$($BuildPath)\LuaScript.dll"
+
+ 7z a $ZipFileName "$($BuildPath)\Lua.dll"
+ }
+
+artifacts:
+ - path: LuaScript*.zip
+ name: releases
+
+deploy:
+ provider: GitHub
+ auth_token:
+ secure: qrw+nu8dQKFLG+lNmky6buHsvHFwlibAai0r0aJ3MYbyBniONVxvgnmyx37bPh44
+ artifact: releases
+ draft: true
+ prerelease: false
+ force_update: true
+ on:
+ appveyor_repo_tag: true
+ configuration: Release
diff --git a/docs/classes/Editor.html b/docs/classes/Editor.html
index d2236c3..2a586a6 100644
--- a/docs/classes/Editor.html
+++ b/docs/classes/Editor.html
@@ -23,7 +23,7 @@
This is a straight forward API to directly control Scintilla. This documentation is not intended to fully describe the Scintilla API, but only to give a brief description. The official Scintilla documentation should be consulted for more details. All constants from the official documentation are exposed as Lua globals variables.
+
Some Scintilla messages, such as "SCI_SETxxx" and "SCI_GETxxx", are implemented in LuaScript as a single property. For example Editor.CurrentPos is a read/write property that calls both "SCI_GETCURRENTPOS" and "SCI_SETCURRENTPOS". The automatically generated documentation below may only refer to one or the other.
+
This class cannot be instantiated, rather predefined globals are available to use.
The edge may be displayed by a line (EDGE_LINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
+
The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
Delete a range of text in the document.
@@ -2818,14 +3043,14 @@
See also:
Parameters:
-
pos
+
startposition
-
deleteLength
- int
+
lengthDelete
+ position
@@ -2916,7 +3141,7 @@
See also:
Editor:ReleaseAllExtendedStyles()
- Release all extended (>255) style numbers
+ Release all extended (>255) style numbers
@@ -2934,7 +3159,7 @@
See also:
Editor:AllocateExtendedStyles(numberStyles)
- Allocate some extended (>255) style numbers and return the start of the range
+ Allocate some extended (>255) style numbers and return the start of the range
- Sets the position that ends the target which is used for updating the document without affecting the scroll position.
+ Sets the virtual space of the target start
- Sets both the start and end of the target in one call.
+ Sets the position that ends the target which is used for updating the document without affecting the scroll position.
-
Set the search flags used by SearchInTarget.
@@ -3190,7 +3485,7 @@
See also:
Editor:SearchInTarget(text)
- Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns length of range or -1 for failure in which case target is not moved.
+ Search for a counted string in the target and set the target to the found range. Text is counted so it can contain NULs. Returns start of found range or -1 for failure in which case target is not moved.
- Get position of start of word.
+ Given a valid document position, return the next position taking code page into account. Maximum value returned is the last position in the document.
- Given a valid document position, return the previous position taking code page into account. Returns 0 if passed 0.
+ Measure the pixel width of some text in a particular style. NUL terminated text argument. Does not handle tab or control characters.
- Given a valid document position, return the next position taking code page into account. Maximum value returned is the last position in the document.
+ Retrieve the height of a particular line of text in pixels.
- Given a valid document position, return a position that differs in a number of characters. Returned value is always between 0 and last position in document.
+ read-only
-
- Count characters between two positions.
+ Find the position of a column on a line taking into account tabs and multi-byte characters. If beyond end of line, return line end position.
- Set whether multiple selections can be made
+ Given a valid document position, return a position that differs in a number of characters. Returned value is always between 0 and last position in document.
+
- Change the effect of pasting when there are multiple selections.
+ Given a valid document position, return a position that differs in a number of UTF-16 code units. Returned value is always between 0 and last position in document. The result may point half way (2 bytes) inside a non-BMP character.
+
- On GTK+, allow selecting the modifier key to use for mouse-based rectangular selection. Often the window manager requires Alt+Mouse Drag for moving windows. Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
+ read-only
- Which selection is the main selection
+ On GTK, allow selecting the modifier key to use for mouse-based rectangular selection. Often the window manager requires Alt+Mouse Drag for moving windows. Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
- Set the foreground colour of additional selections. Must have previously called SetSelFore with non-zero first argument for this to have an effect.
+ Set the virtual space of the caret of the nth selection.
- Set the background colour of additional selections. Must have previously called SetSelBack with non-zero first argument for this to have an effect.
+ Set the anchor position of the nth selection.
+ Set the foreground colour of additional selections. Must have previously called SetSelFore with non-zero first argument for this to have an effect.
+
+
+
+ Set the background colour of additional selections. Must have previously called SetSelBack with non-zero first argument for this to have an effect.
+
+
+
+ Add the next occurrence of the main selection to the set of selections as main. If the current selection is empty then select word around caret.
+
+
+
+
+
+
+ Add each occurrence of the main selection in the target to the set of selections. If the current selection is empty then select word around caret.
+
+
+
+
+
+
+ Scroll the argument positions and the range between them into view giving priority to the primary position then the secondary position. This may be used to make a search match visible.
-
- Ensure the caret is visible.
+ Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.
+
+
+
- Scroll the argument positions and the range between them into view giving priority to the primary position then the secondary position. This may be used to make a search match visible.
+ Make white space characters invisible, always visible or visible outside indentation.
-
- Set the way the caret is kept visible when going sideways. The exclusion zone is given in pixels.
+ Set the foreground colour of all whitespace and whether to use this setting.
- Set the way the line the caret is on is kept visible. The exclusion zone is given in lines.
+ Set the background colour of all whitespace and whether to use this setting.
- Set the way the display area is determined when a particular line is to be moved to by Find, FindNext, GotoLine, etc.
+ Set the size of the dots used to mark space characters.
-
- Sets the scroll range so that maximum scroll position has the last line at the bottom of the view (default). Setting this to false allows scrolling one page below the last line.
+ Set whether the mouse wheel can be active outside the window.
- Convert all line endings in the document to one mode.
+ Set the set of characters making up words for when moving or selecting by word. First sets defaults like SetCharsDefault.
-
- Make the end of line characters visible or invisible.
+ Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.
- Set the current styling position to pos and the styling mask to mask. The styling mask can be used to protect some bits in each styling byte from modification.
+ Set the current styling position to start. The unused parameter is no longer used and should be set to 0.
- If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.
+ Set the end of line annotation text for a line
- In one phase draw, text is drawn in a series of rectangular blocks with no overlap. In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. In multiple phase draw, each element is drawn over the whole drawing area, allowing text to overlap from one line to the next.
+ Set the style number for the end of line annotations for a line
- In twoPhaseDraw mode, drawing is performed in two phases, first the background and then the foreground. This avoids chopping off characters that overlap the next run.
+ Set the visibility for the end of line annotations for a view
-
TwoPhaseDraw
- bool
+
EOLAnnotationVisible
+ int
@@ -8766,21 +9748,21 @@
- Choose the quality level for text from the FontQuality enumeration.
+ If drawing is buffered then each line of text is drawn into a bitmap buffer before drawing it to the screen to avoid flicker.
- Set the code page used to interpret the bytes of the document as characters. The SC_CP_UTF8 value can be used to enter Unicode mode.
+ In one phase draw, text is drawn in a series of rectangular blocks with no overlap. In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. In multiple phase draw, each element is drawn over the whole drawing area, allowing text to overlap from one line to the next.
- Set the set of characters making up words for when moving or selecting by word. First sets defaults like SetCharsDefault.
+ Choose the quality level for text from the FontQuality enumeration.
- Set the set of characters making up whitespace for when moving or selecting by word. Should be called after SetWordChars.
+ Set the code page used to interpret the bytes of the document as characters. The SC_CP_UTF8 value can be used to enter Unicode mode.
- Find the position of a matching brace or INVALID_POSITION if no match.
+ Find the position of a matching brace or INVALID_POSITION if no match. The maxReStyle must be 0 for now. It may be defined in a future release.
Parameters:
@@ -9160,6 +10154,12 @@
Parameters:
+
+
maxReStyle
+ int
+
+
+
@@ -9179,11 +10179,78 @@
See also:
+
+
+
+ Editor:BraceMatchNext(pos, startPos)
+
+
+ Similar to BraceMatch, but matching starts at the explicit start position.
+
+
+
HighlightGuide
- int
+ position
@@ -9818,7 +10885,7 @@
See also:
Editor:MarkerEnableHighlight(enabled)
- Enable/disable highlight for current folding bloc (smallest one that contains the caret)
+ Enable/disable highlight for current folding block (smallest one that contains the caret)
- Display a auto-completion list. The lenEntered parameter indicates how many characters before the caret should be used to provide context.
+ Display a auto-completion list. The lengthEntered parameter indicates how many characters before the caret should be used to provide context.
- Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button.
+ Set whether a pop up menu is displayed automatically when the user presses the wrong mouse button on certain areas.
Parameters:
-
allowPopUp
- bool
+
popUpMode
+ int
@@ -13294,7 +14443,7 @@
Direct access
DirectFunction
- int
+ pointer
@@ -13320,7 +14469,7 @@
See also:
DirectPointer
- int
+ pointer
@@ -13346,7 +14495,7 @@
See also:
CharacterPointer
- int
+ pointer
@@ -13364,22 +14513,22 @@
- Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to rangeLength bytes.
+ Return a read-only pointer to a range of characters in the document. May move the gap so that the range is contiguous, but will only move up to lengthRange bytes.
Parameters:
-
position
- int
+
start
+ position
-
rangeLength
- int
+
lengthRange
+ position
@@ -13389,7 +14538,7 @@
Parameters:
Returns:
- int
+ pointer
@@ -13443,7 +14592,7 @@
Multiple views
DocPointer
- int
+ pointer
@@ -13461,17 +14610,32 @@
+ The edge may be displayed by a line (EDGE_LINE/EDGE_MULTILINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
+
+
+
- Make the displayed text smaller by decreasing the sizes by 1 point.
+ Set the column number of the edge. If text goes past the edge then it is highlighted.
+
- Set the zoom level. This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.
+ Change the colour used in edge indication.
- The edge may be displayed by a line (EDGE_LINE) or by highlighting text that goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE).
+ Add a new vertical edge to the view.
+
eventstring
- name of the desired event
+ name of the desired event (can also be an array of strings)
callbackfunction
- function to call when the event is triggered
+ function to call when the event(s) is triggered
@@ -533,7 +547,7 @@
Parameters:
shortcutstring
- the modifier and key (e.g. "Ctrl+Alt+Shift+D"). The key must be A-Z, 0-9, or F1-F12
+ the modifier and key (e.g. "Ctrl+Alt+Shift+D"). The key must be one of: A-Z, 0-9, F1-F12, ;, /, ~, [, \, ], \, ,, -, ., =, up, down, left, right, space, pageup, pagedown, backspace, delete, escape
callbackfunction
@@ -580,6 +594,77 @@
Parameters:
+
+
+
+ Notepad.StartTimer(ms, callback)
+
+
+ Continuously calls a function at a set interval.
+
+
Note: The timer will continue to fire until StopTimer is called. Also, these timers run synchronously in the same thread as Notepad++, meaning that if Notepad++ is busy processing the file (such as doing search/replace) the timer event will get delayed. It is safe to access any of the globally defined LuaScript objects in the callback.
+
+
+
Parameters:
+
+
ms
+ int
+ milliseconds to wait between calls
+
+
callback
+ function
+ function to be called. It will be passed a singe parameter, the opaque timer object
+
-- A trivial example...save a copy of the current file every 10 seconds, unless the file is too big
+npp.StartTimer(10000, function(timer)
+ if editor.Length < 1000then
+ npp:SaveCurrentFileAs(true, [[C:\path\to\current\file.backup]])
+ else
+ npp.StopTimer(timer)
+ end
+end)
+
+
+
+
+
+ Notepad.StopTimer(timer)
+
+
+ Stops a previously created timer.
+
+
+
Parameters:
+
+
timer
+ the opaque timer object returned from StartTimer or passed into the callback
+