How to control and trim line lengths (zz)
2012-04-26 16:39
295 查看
What is a long line?
//z 2012-4-26 16:42:21 PM IS2120@CSDNWell it depends. Notepad++ has two distinct, independent answers to this:
When a line cannot display in the view it belongs to, and if word wrap is on, the line wraps to one or more extra lines that all fit inside the view. Word wrap is toggled by the "Wrap" menu item found in the View menu. The Scintilla component does not support
real-time wrapping at a fixed length.
When a line is longer than a predefined threshhold, the overflowing parts can be shown using some sort of markings. The relevant settings are to be found on theSettings -> Preferences -> Editing -> Vertical edge settings
frame.
If a line is too long only because of trailing whitespace, this may be removed using theEdit -> Trim Trailing Space command. Use this instead of the shipped macro with a similar name, as the latter is provided
mostly for testing and demonstration purposes.
Word Wrap
Word Wrap is toggled on or off using View -> Wrap. It takes place as you type, creating secondary lines when the current line wouldn't fit in the current window. If line numbers are displayed, a word-wrapped linecontinuation is designated by a period (".") in the line number column.
Word Wrap has been reported to noticeably slow down display updates when editing 20+ MB files. You may consider disabling it when processing such files.
Using Settings -> Preferences -> Editing -> Word wrap, you can control the appearance of spillover lines. Options are:
Default: no indent based on text layout
Align: Secondary lines indent like the primary line
Indent: Secondary lines indent one level more than primary line
Customizing Word Wrap further
The following macro sets the overhang indent of spillover lines that appear when a line wraps:<Macro name="macro_1" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="0" message="2464" wParam=new_indent lParam="0" sParam=""/> </Macro> |
new_indent is given in text columns. |
<Macro name="macro_2" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="0" message="2268" wParam=new_mode lParam="0" sParam=""/> </Macro> |
new_mode is either: 0 for no word wrap 1 for wrap at word boundaries only 2 for wrap at cutoff point Other values lead to undefined behaviour and should be avoided. |
<Macro name="macro_5" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="0" message="2406" wParam=new_mode lParam="0" sParam=""/> </Macro> |
new_mode is either: 0 for no word wrap 1 for wrap at word boundaries only 2 for wrap at cutoff point Other values lead to undefined behaviour and should be avoided. |
<Macro name="macro_3" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="0" message="2460" wParam=new_mode lParam="0" sParam=""/> </Macro> |
new_mode is either: 0 for no wrap markers 1 for wrap markers at the end of split lines 2 for wrap markers at the beginning of spillover lines 3 for both kinds of markers Other values lead to undefined behaviour and should be avoided. |
<Macro name="macro_4" Ctrl="yes" Alt="yes" Shift="no" Key="100"> <Action type="0" message="2462" wParam=new_mode lParam="0" sParam=""/> </Macro> |
new_mode is either: 0 for markers drawn close to margin/window edge 1 for wrap markers at the end of split lines drawn closer to text 2 for wrap markers at the beginning of spillover lines drawn closer to text 3 for all wrap markers close to text Other values lead to undefined behaviour and should be avoided. |
Note that the View -> Show Symbol -> Show wrap symbol toggle can be used to control whether Word Wrap symbols are displayed. This may be enough. Use the macros for finer appearance tuning.
Customising vertical edge display
The Settings -> Preferences -> Editing -> Vertical edge settings frame has:A checkbox to toggle edge display
Two radio buttons
Background mode, to cause overflowing text to appear with a fixed background
Line mode, to draw a vertical line at the desired position
A clickable link showing the current threshold. Click on it to change the threshold.
In addition, the edge color is configured from
Settings -> Styler Configurator -> Global Styles , Edge color.
Wrapping existing text at a fixed width
//z 2012-4-26 16:42:21 PM IS2120@CSDNWhile text won't wrap at a fixed width as you type, you can reformat existing text using the TextFX Edit plugin. To select a width, enter it somewhere and cut it to clipboard. If clipboard is empty, holds something that is not a number, or a number not between
8 and 2048, a value of 72 is assumed. Now select the text and use the Rewrap text to (Clipboard) or 72 command. Removing the wrapping is done using the Unwrap text command from the same TextFX Edit menu.
The Split line command (Ctrl+I) will split the current line, or the selected lines, at the right edge and at word boundaries if possible. While this is not wrapping, the effect is somehow similar. It is possible to devise a macro that splits the current
line/block at a fixed position, but the position is measured in pixels, which makes it harder to define correctly.
//z 2012-4-26 16:42:21 PM IS2120@CSDN
相关文章推荐
- xargs: How To Control and Use Command Line Arguments
- How to handle the MouseLeftButtonDown and MouseLeftButtonUp events of the Button control?
- How to open Firefox and chrome from command line
- How to easily open files and URLs from the command line
- How to manipulate pixels on a bitmap by scanline property(Ma Xiaoguang and Ma Xiaoming)
- How To Build Multi-control Components when Inheriting from an Existing Control (Intro and TextBox Example)
- About how to use Edit Control and SPin Control together! (关于怎么组合使用Edit Control 和 Spin Control 增加浮点数)
- HOW to get control your time and your life
- How to extract controlfiles, datafiles, and archived logs from SMR backupsets without using RMAN
- What is Favicon.ico and How to Create a Favicon Icon for Your Website?[zz]
- how to write your annotation types and make use of built-in annotations to control their behavior
- [WP7] How to press the mouse on a control, and detect MouseLeftButtonUp on another
- How to Control a Lamp With Voice Commands and a Raspberry Pi
- How to trim and edit videos in Photos for OS X
- How to Take Control of Your Line Height in Outlook.com
- How to run FTE and FTE from command line
- How to run java and junit in command line
- WinForms Controls > Examples > How to: Add New XtraForm, RibbonForm and XtraUserControl to Your Proj
- [zz]How to sign .EXE, .DLL and .CAB files?
- C++ How to avoid the enter key when using cin and getline