1

我想为 Screen 开发一个选择工具,它忽略选择中的前导空格和数字。

问题

  1. C-a Esc影响Screen 中选择工具的代码是什么?
  2. 要创建一个算法,该算法从选择开始忽略行号和空格:

替代文字 http://files.getdropbox.com/u/175564/%20selection-less.png

以下 Perl-regex 似乎与行首匹配

 {5}[1-9]{1-4} {8}         # not tested

选择工具显然通过将选择的增加连接到当前选择来工作。例如,选择了一行。我选择另一个:一个新行被添加到选择队列中。反过来也适用于选择的减少。

我想在选择相反时使用 Perl 正则表达式,\n以便考虑该行的无知。

4

1 回答 1

5

我想你想选择列。这比正则表达式容易得多。

屏幕手册页:

   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.

因此,在您的屏幕截图中,按C-a [,将光标移动到文本的开头,按SPACE,然后按c。移至选择的末尾,然后再次按SPACE。现在你有了你想要的文本。

希望这不是太多的信息。你用初学者标记了它,所以我不确定你是 perl 还是 screen 初学者。

于 2009-07-08T21:20:47.627 回答