The Scintilla component provides 4 optional, different margins on the left of any document view. Notepad++ uses them as follows:
- Margin 0 is devoted to line numbers;
- Margin 1 is used by bookmarks, hidden line markers and similar
- Margin 2 holds fold symbols (by default, square boxes)
- Margin 3 is used for margin indicators, like changed line bars.
In addition, there are left and right margins. The left margin appears between the abovementioned margins and the text.
Scintilla has provisions for one more numbered margin, but it is not used by Notepad++. Giving it a non zero width is enough to make it visible.
Most of the appearance of the margins can be changed through the Notepad++ user interface. A few other settings can be changed using macros that send messages to the underlying Scintilla component.
For all margins
You can control the appearance and behaviour of any numbered margin (not the gutters) using the following macro:
<Macro name="macro_4 Ctrl="yes" Alt="yes" Shift="no" key="100"> <Action type="0" message=msg_id wParam=margin_number lParam=behaviour_parameter sParam=""/> </Macro>
with the following variations:
- margin_number is a double quoted integer, between 0 and 4.
- msg_id depends on the desired action, according to the table below. It is always a double quoted integer.
- behaviour_parameter is a double quoted integer, whose meaning depends on msg_id .
|Action||Message id||behaviour parameter meaning|
|Adjust the width of a margin||"2242"||width in pixels|
|Adjust the width of the left gutter||"2155"||width in pixels|
|Adjust the width of the right gutter||"2157"||width in pixels|
|Trap mouse clicks on a margin||"2246"||"1" to enable (default), "0" to disable. Gutters are always sensitive. See the special note at the bottom.|
|Set margin type||"2244"|| |
NOTE: for a margin to be usable for line selection by mouse click, it must be "insensitive", ie the mouse click trapping is disabled. This is the default state of a margin. For instance, the fold margin is sensitive and the line number margin is not. This is the Scintilla documentation terminology.
Line number margin
It is toggled on and off from he Settings -> Preferences -> Editing -> Display line numbers margin checkbox. The Change Markers plugin menu also has a menu entry to toggle it.
Appearance settings are set from the Settings -> Styler Configurator -> Global Styles , Line number margin tab.
Since the width of the margin is computed whenever display changes, setting its width may not be useful. The width is computed to be as large as needed, with a minimum of three digits (to avoid annoying jump effects btween line 99 and 100).
It is toggled on and off from he Settings -> Preferences -> Editing -> Display bookmarks margin checkbox.
The margin is shown if the language being used has code blocks, or some related structures which it may make sense to selectively fold or unfold. User defined languages are assumed to do.
Its colours are set from the Settings -> Styler Configurator -> Global Styles , Fold margin tab, while the folding symbols colours are set in the Settings -> Styler Configurator -> Global Styles , Fold tab. The symbols appearance, however, is set in Settings -> Preferences -> Editing -> Folder margin style frame. Note that choosing the "None" style not only disable fold markers, but also hides the fold margin completely.
Whenever document is activated, the fold margin width is reset to some default value.
Change markers margin
The Change Markers plugin menu has a menu entry to toggle it on or off. The colour of the markers can be set in the Settings -> Styler Configurator -> Global Styles , Unsaved/Saved change markers tab.