Comments (3)
Note that the Notepad++ code for allocating indicators will NOT store a -1 in the calling argument upon failure as the corresponding marker allocation code will.
Preliminary documentation for the API is here: notepad-plus-plus/npp-usermanual#542
from pythonscript.
Here's some test code exercising the call in Notepad++:
# -*- coding: utf-8 -*-
from __future__ import print_function
from Npp import *
from ctypes import ( addressof, WinDLL )
from ctypes.wintypes import ( HWND, UINT, WPARAM, LPARAM, DWORD )
LRESULT = LPARAM
user32 = WinDLL('user32')
SendMessageW = user32.SendMessageW
SendMessageW.restype = LRESULT
SendMessageW.argtypes = [ HWND, UINT, WPARAM, LPARAM ]
WM_USER = 0x400
NPPMSG = (WM_USER + 1000)
def notepad_allocateIndicator_RAW(num_indicators_to_alloc):
NPPM_ALLOCATEINDICATOR = (NPPMSG + 113)
lowest_allocated_indicator_id = DWORD() # not sure DWORD is the correct thing to use here...
__ = SendMessageW(notepad.hwnd, NPPM_ALLOCATEINDICATOR, num_indicators_to_alloc, addressof(lowest_allocated_indicator_id))
return None if __ == 0 else lowest_allocated_indicator_id
num_indicators_needed = 3
start_indicator_id = notepad_allocateIndicator_RAW(num_indicators_needed)
if start_indicator_id is None:
print('could not allocate enough indicator(s) to fulfill request')
else:
start_indicator_id = start_indicator_id.value # c_ulong to int
print('allocated indicator ids:', list(range(start_indicator_id, start_indicator_id + num_indicators_needed)))
from pythonscript.
Thanks @chcg Christian!
from pythonscript.
Related Issues (20)
- [feature req.] Menu entry (command for shortcut) to Run the script in the current tab HOT 15
- `exit()` in a pythonscript causes Notepad++ to CRASH HOT 13
- editor.getUserLineSelection() and editor.getUserCharSelection() should allow other defaults if empty selection HOT 13
- Script hangs when using notepad.runMenuCommand with non-existent menu items HOT 5
- No more compatibile Notepad plugin HOT 8
- Console not persistent visible during relaunch HOT 2
- editor.getTextRange() crashes notepad HOT 3
- Possible to get same filepath in multiple tabs using notepad.saveAs() HOT 3
- Script bound to Ctrl-only keycombo can't be opened for edit by holding Ctrl and clicking it in menu HOT 7
- Sys.Path missing some directories in latest 3.0.17 version HOT 6
- Sys.Path (still) missing some directories in latest 3.0.17 version HOT 8
- editor.research() and editor.search() won't search backwards HOT 3
- editor.research() assigns empty string to non-participating groups (instead of the preferred None)
- [Feature Enhancement] Have 'Run Previous Script' ignore first-level scripts
- "☑ Automatically open console on error" should be default behavior HOT 2
- Wrap text in console HOT 5
- Donations links broken in npppythonscript.sourceforge.net
- Two methods, editor.markerAdd and editor.markerSetBack, have errors. How do I modify our setback? HOT 4
- permanent setting HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonscript.