Skip to content

Commit 263a4bd

Browse files
committed
- add coding info to sample files
- removed whitespaces
1 parent 8fd8132 commit 263a4bd

21 files changed

+152
-142
lines changed

scripts/Samples/BracketHighlighter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
#From https://notepad-plus-plus.org/community/topic/14501/has-a-plugin-like-sublime-plugin-brackethighlighter/7
23

34
try:

scripts/Samples/CTags Based Autocompletion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
# You can for example bound this script to CTRL+SHIFT+C in Settings > Shortcut Mapper > Plugins Commands > Run Previous Script
23
# It will show a typical Notepad++/Scintilla autocompletion list, but based on the content of the `tags` file in the current file directory
34

scripts/Samples/ColumnLexer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
ColumnLexer - Demo
44
55
A column based lexer, odd and even columns will be styled differently.
6-
6+
77
Usage:
88
Default column separator is comma, redefine COLUMN_SEPARATOR if needed.
99
Run script.
@@ -22,7 +22,7 @@
2222
except NameError:
2323

2424
class COLUMN_LEXER_SINGLETON(type):
25-
''' Ensures that only one column lexer instance exists and
25+
''' Ensures that only one column lexer instance exists and
2626
prevents of getting multiple callbacks
2727
'''
2828
_instance = None
@@ -60,7 +60,7 @@ def column_lexer(self, start_pos, end_pos):
6060
''' Main lexing logic.
6161
Gets called by styleneeded callback
6262
'''
63-
63+
6464
def style_it(start, length, STYLE):
6565
''' Inform scintilla to do the styling'''
6666
if length >= 0:
@@ -123,7 +123,7 @@ def is_lexer_doc(self):
123123

124124

125125
def styleneeded_callback(self,args):
126-
''' Called by scintilla to inform the lexer
126+
''' Called by scintilla to inform the lexer
127127
about the need to style the document.
128128
If document is of interest call main logic (column_lexer) function
129129
Ensures that the start position is really the first position per line
@@ -146,7 +146,7 @@ def bufferactivated_callback(self,args):
146146
def langchanged_callback(self,args):
147147
''' Called by notepad when a built-in or udl language switch happens
148148
If document was previously styled by this lexer it will be reset
149-
and therefore will not be styled by this lexer anymore until
149+
and therefore will not be styled by this lexer anymore until
150150
script gets executed on this document again.
151151
'''
152152
if self.is_lexer_doc():
@@ -155,7 +155,7 @@ def langchanged_callback(self,args):
155155

156156
def main(self):
157157
''' Main entry point
158-
To prevent issues with other lexers document language will
158+
To prevent issues with other lexers document language will
159159
be set to normal text, then document does get the class name
160160
property assigned, styles do get initialized and main lexing
161161
function does get called on whole document

scripts/Samples/Disable Virtual Space.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12

23
# Disable the virtual space options for both Scintilla views, apart from for rectangular selection (the default in Notepad++)
34
# For more information, see the Scintilla documentation on virtual space and the SCI_SETVIRTUALSPACEOPTIONS message.

scripts/Samples/Enable Virtual Space.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
# -*- coding: utf-8 -*-
22

33
# Enable the virtual space options for both Scintilla views
44
# For more information, see the Scintilla documentation on virtual space and the SCI_SETVIRTUALSPACEOPTIONS message.

scripts/Samples/EnhancedPythonLexer.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
# -*- coding: utf-8 -*-
22
"""
33
EnhancedPythonLexer
4-
4+
55
Sometimes a built-in lexer isn't doing what one wants.
6-
To enhance the built-in lexer, indicators can be used, which also automatically
6+
To enhance the built-in lexer, indicators can be used, which also automatically
77
prevent clashes with the styling operations done by the built-in lexer.
88
The only potential issue might be using an indicator used by npp itself.
9-
10-
Usage:
9+
10+
Usage:
1111
In the main function
1212
- define the lexer_name to be enhanced and
1313
- create the regex_dict with the regular expressions and
1414
- the associate colours
15-
15+
1616
The regex dict must be in form key_tuple:value_tuple.
17-
17+
1818
The key_tuple needs to have an unique ID followed by a colour tuple,
19-
like (3, (181, 188, 201)).
19+
like (3, (181, 188, 201)).
2020
In this case the same colour can be used with different regexes.
21-
21+
2222
The value_tuple should use an unicode string followed by a number
23-
indicating the (sub-)match,
23+
indicating the (sub-)match,
2424
like (u'\\b(cls|self)\\b',0)
2525
which would colour the main match (the words cls and self) or like
2626
(u'(?:(?:def)\s\w+)\s*\((.*)\):',1)
2727
which would colour the first submatch, which is (.*) and in this case
28-
are basically the parameters of a python function.
29-
28+
are basically the parameters of a python function.
29+
3030
Run script.
31-
31+
3232
Note: could be used as an UDL alternative as well.
3333
3434
"""

scripts/Samples/Event Handler Demo.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
import datetime
23

34
# Just in case, we'll clear all the existing callbacks for FILEBEFORESAVE
@@ -12,10 +13,10 @@ def addSaveStamp(args):
1213
elif result == MESSAGEBOXFLAGS.RESULTYES:
1314
notepad.activateBufferID(args["bufferID"])
1415
editor.appendText("File saved on %s\r\n" % datetime.date.today())
15-
16-
17-
# ... and register the callback
16+
17+
18+
# ... and register the callback
1819
notepad.callback(addSaveStamp, [NOTIFICATION.FILEBEFORESAVE])
1920

20-
# As this is a sample, we'll inform the user
21+
# As this is a sample, we'll inform the user
2122
notepad.messageBox("FILEBEFORESAVE notification registered.\n*.log files will now automatically be modified before saving.\nCtrl-Click the script to edit.\n", "Python Script Demo", 0)

scripts/Samples/Formatter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
notepad.messageBox(('Unable to import Tkinter libraries,\n'
2222
'these are needed for the UI.\n\n'
2323
'Check your installation.\n\n'
24-
'{}'.format(e.message)),'Missing Library', MESSAGEBOXFLAGS.ICONERROR)
24+
'{}'.format(e.message)),'Missing Library', MESSAGEBOXFLAGS.ICONERROR)
2525
console.show()
2626
raise
2727

@@ -111,7 +111,7 @@ def reformat(separator,area):
111111
window.configure(background='#282C34')
112112
window.grid_columnconfigure(0, weight=1)
113113
window.grid_columnconfigure(1, weight=1)
114-
114+
115115
control_styles = ttk.Style()
116116
control_styles.configure('TButton', font=('courier', 16, 'bold'), background='#282C34', relief='flat')
117117
control_styles.configure('TCheckbutton', font=('courier', 12), background='#282C34', foreground='#B5BCC9')
@@ -120,7 +120,7 @@ def reformat(separator,area):
120120
control_styles.configure('TLabelframe', background='#282C34', foreground='#B5BCC9')
121121
control_styles.configure('TLabel', font=('courier', 12), background='#282C34', foreground='#B5BCC9')
122122
control_styles.configure('TFrame', background='#282C34')
123-
123+
124124
separator_value = tk.IntVar()
125125
reformat_value = tk.IntVar()
126126

@@ -153,7 +153,7 @@ def reformat(separator,area):
153153
btn_frame.configure(relief=tk.GROOVE)
154154
btn_frame.configure(borderwidth="2")
155155
btn_frame.configure(width=550)
156-
156+
157157
btn_reformat = ttk.Button(btn_frame)
158158
btn_reformat.place(relx=0.07, rely=0.24, height=47, width=207)
159159
btn_reformat.configure(text='Reformat')

scripts/Samples/GotoLineCol.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
Script: GotoLineCol.py
34
Utility: 1. Moves the cursor position to the specified line and column for a file in Notepad++.

scripts/Samples/GotoLineCol_Barebones.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
curLine = editor.lineFromPosition(editor.getCurrentPos())
24

35
line = int( notepad.prompt('Line Number:', 'Navigate to a line and character position', str(curLine + 1) ))

0 commit comments

Comments
 (0)