问题
I would like to develop a selection-tool for Screen which ignores the leading spaces and numbers in selection.
Problems
- What is the code which affects selection-tool
C-a Esc
in Screen? - To make an algorithm which ignores the linenumbers and the space at the beginning from the selection:
alt text http://files.getdropbox.com/u/175564/%20selection-less.png
The following Perl-regex seems to match the beginning of the line
{5}[1-9]{1-4} {8} # not tested
The selection tool apparently works by concatenating an increase in selection to the current selection. For instance, one line is selected. I select another one: a new line is added to the selection queue. The reverse is true also for a decrease in selection.
I want to put the Perl regex on when the selection obverses \n
such that the ignorance of the line is considered.
回答1:
I think you want to select columns. That'd be much easier than a regex.
From the screen manpage:
c or C to set the left or right margin respectively. If no repeat count is given, both default to the current cursor position. Example: Try this on a rather full text screen: "C-a [ M 20 l SPACE c 10 l 5 j C SPACE". This moves one to the middle line of the screen, moves in 20 columns left, marks the beginning of the paste buffer, sets the left column, moves 5 columns down, sets the right column, and then marks the end of the paste buffer. Now try: "C-a [ M 20 l SPACE 10 l 5 j SPACE" and notice the difference in the amount of text copied.
So, in your screenshot, press C-a [
, move the cursor to the beginning of your text, press SPACE
and then press c
. Move to the end of your selection and then press SPACE
again. Now you have the text you want.
Hope this wasn't too much info. You tagged it with beginner so I wasn't sure if you were a perl or screen beginner.
来源:https://stackoverflow.com/questions/1100556/to-ignore-linenumbers-selection-in-less-inside-screen