Re: ` visual selection -- inconsistent?

2006-04-30 Thread Benji Fisher
On Sat, Apr 29, 2006 at 04:11:21PM -0600, Eric Arnold wrote:
  :set selection=exclusive
 
  Use this text:
 
  123456
  2abcde
  3abcde
  4abcde
  5abcde
 
  Go to line 4, col 2.  Hit ^V or (^Q whichever works).  Type kkll
  until you've highlighted
  abc
  abc
  abc
 
  Type ESC
 
  For me, now the cursor is on c, and ` and `  go to a and c.
 
  Now start at line 2, col 2 and highlight the same 3x3 square, and type
  ESC.
 
  Now the cursor is on d, and ` and ` go to a and d.
 
  If it doesn't do this, try starting at the other corners.  Sometimes I
  *think* I've had it work differently, but I can't remember exactly
  what the conditions were.

 If you want to determine the selected text from a script, I guess
the answer is that you should exclude the character at ` if

selection == exclusive  col(')  col(')

HTH --Benji Fisher


Re: ` visual selection -- inconsistent?

2006-04-30 Thread Eric Arnold

On 4/30/06, Benji Fisher [EMAIL PROTECTED] wrote:

On Sat, Apr 29, 2006 at 04:11:21PM -0600, Eric Arnold wrote:
  :set selection=exclusive
 
  Use this text:
 
  123456
  2abcde
  3abcde
  4abcde
  5abcde
 
  Go to line 4, col 2.  Hit ^V or (^Q whichever works).  Type kkll
  until you've highlighted
  abc
  abc
  abc
 
  Type ESC
 
  For me, now the cursor is on c, and ` and `  go to a and c.
 
  Now start at line 2, col 2 and highlight the same 3x3 square, and type
  ESC.
 
  Now the cursor is on d, and ` and ` go to a and d.
 
  If it doesn't do this, try starting at the other corners.  Sometimes I
  *think* I've had it work differently, but I can't remember exactly
  what the conditions were.

 If you want to determine the selected text from a script, I guess
the answer is that you should exclude the character at ` if

selection == exclusive  col(')  col(')


That's the problem, you don't know when to exclude the character,
because exclusive mode includes the character when selected from
certain directions.


Re: ` visual selection -- inconsistent?

2006-04-30 Thread Benji Fisher
On Sun, Apr 30, 2006 at 08:36:14AM -0600, Eric Arnold wrote:
 On 4/30/06, Benji Fisher [EMAIL PROTECTED] wrote:
 On Sat, Apr 29, 2006 at 04:11:21PM -0600, Eric Arnold wrote:
   :set selection=exclusive
  
   Use this text:
  
   123456
   2abcde
   3abcde
   4abcde
   5abcde
  
   Go to line 4, col 2.  Hit ^V or (^Q whichever works).  Type kkll
   until you've highlighted
   abc
   abc
   abc
  
   Type ESC
  
   For me, now the cursor is on c, and ` and `  go to a and c.
  
   Now start at line 2, col 2 and highlight the same 3x3 square, and type
   ESC.
  
   Now the cursor is on d, and ` and ` go to a and d.
  
   If it doesn't do this, try starting at the other corners.  Sometimes I
   *think* I've had it work differently, but I can't remember exactly
   what the conditions were.
 
  If you want to determine the selected text from a script, I guess
 the answer is that you should exclude the character at ` if
 
 selection == exclusive  col(')  col(')
 
 That's the problem, you don't know when to exclude the character,
 because exclusive mode includes the character when selected from
 certain directions.

 That is my attempt at a *solution* to the problem.  I guess you
should also check visualmode():  the above conditional assumes you were
using blockwise selection.

HTH --Benji Fisher


Re: ` visual selection -- inconsistent?

2006-04-29 Thread Benji Fisher
On Sat, Apr 29, 2006 at 12:03:12AM -0600, Eric Arnold wrote:
 :set selection=exclusive
 
 Use this text:
 
 123456
 2abcde
 3abcde
 4abcde
 5abcde
 
 Go to line 4, col 2.  Hit ^V or (^Q whichever works).  Type kkll 
 until you've highlighted
 abc
 abc
 abc
 
 Type ESC
 
 For me, now the cursor is on c, and ` and `  go to a and c.
 
 Now start at line 2, col 2 and highlight the same 3x3 square, and type 
 ESC.
 
 Now the cursor is on d, and ` and ` go to a and d.
 
 If it doesn't do this, try starting at the other corners.  Sometimes I
 *think* I've had it work differently, but I can't remember exactly
 what the conditions were.

 I tried your experiment.  I notice that, when I start at the
upper-left corner, the cursor is on a d when three lines of abc are
selected.  When I start at the lower-left corner, the cursor is on the
c when three lines of abc are selected.  In other words, when I
start at the lower-left corner, I do not see a difference between
setting 'selection' to inclusive or exclusive.

 The ` mark seems to be set on the top line of the Visual
selection, and the ` mark at the bottom.  The two of them are set at
the two corners where I started and ended the selection.  This disagrees
with what you described when starting at the lower left.  It is also odd
in the following situation:  after

C-VhhhEsc

the point where I entered Visual mode is ` , but if I then do

gvjjEsc

then the same point is ` .  I think this is inconsistent with the docs:

'  `  To the first character of the last selected Visual
area in the current buffer.  {not in Vi}.

I read this as saying that ` should always refer to the upper-left
corner (and ` should always refer to the lower-right).

HTH --Benji Fisher


Re: ` visual selection -- inconsistent?

2006-04-29 Thread Eric Arnold

On 4/29/06, Benji Fisher [EMAIL PROTECTED] wrote:

On Sat, Apr 29, 2006 at 12:03:12AM -0600, Eric Arnold wrote:
 :set selection=exclusive

 Use this text:

 123456
 2abcde
 3abcde
 4abcde
 5abcde

 Go to line 4, col 2.  Hit ^V or (^Q whichever works).  Type kkll
 until you've highlighted
 abc
 abc
 abc

 Type ESC

 For me, now the cursor is on c, and ` and `  go to a and c.

 Now start at line 2, col 2 and highlight the same 3x3 square, and type
 ESC.

 Now the cursor is on d, and ` and ` go to a and d.

 If it doesn't do this, try starting at the other corners.  Sometimes I
 *think* I've had it work differently, but I can't remember exactly
 what the conditions were.

 I tried your experiment.  I notice that, when I start at the
upper-left corner, the cursor is on a d when three lines of abc are
selected.  When I start at the lower-left corner, the cursor is on the
c when three lines of abc are selected.  In other words, when I
start at the lower-left corner, I do not see a difference between
setting 'selection' to inclusive or exclusive.



Yes, it seems that this is where the exclusive rule isn't being exclusive.
   
---




 The ` mark seems to be set on the top line of the Visual
selection, and the ` mark at the bottom.  The two of them are set at
the two corners where I started and ended the selection.  This disagrees
with what you described when starting at the lower left.  It is also

odd

I'm not sure I understand.  For me, if I start at L4, C2, and drag the
selection rectangle to L2, C4, and hit ESC, then ` is at L4, C2 and
` is at L2, C4.

Anyway, what I was stressing was whether it was on the c or d of
the ending line/corner, meaning column 4 vs column 5.



in the following situation:  after

C-VhhhEsc

the point where I entered Visual mode is ` , but if I then do

gvjjEsc

then the same point is ` .  I think this is inconsistent with the docs:

'  `  To the first character of the last selected Visual
area in the current buffer.  {not in Vi}.

I read this as saying that ` should always refer to the upper-left
corner (and ` should always refer to the lower-right).

HTH --Benji Fisher



I dunno.  I can't tell any difference between `` and ''  for
visual block mode.


` visual selection -- inconsistent?

2006-04-28 Thread Eric Arnold
The end of the visual selection as gotten by`   seems to depend
on whether the cursor was  between the end_col - 1, and end_col,  or
between end_col, and end_col + 1.  The GUI gvim seems to have the
notion of the the cursor being between characters in visual mode.

` sometimes lands you on the character *after* the last col of the
visual selection.

So, the question is, how do I get the real last column of the Visual selection?


Re: ` visual selection -- inconsistent?

2006-04-28 Thread Eric Arnold
On 4/28/06, Eric Arnold [EMAIL PROTECTED] wrote:
 The end of the visual selection as gotten by`   seems to depend
 on whether the cursor was  between the end_col - 1, and end_col,  or
 between end_col, and end_col + 1.  The GUI gvim seems to have the
 notion of the the cursor being between characters in visual mode.

 ` sometimes lands you on the character *after* the last col of the
 visual selection.

 So, the question is, how do I get the real last column of the Visual 
 selection?


Actually, this seems be inconsistent mostly when you start a
visual-block selections from different corners.


Re: ` visual selection -- inconsistent?

2006-04-28 Thread Gerald Lai

On Fri, 28 Apr 2006, Eric Arnold wrote:


On 4/28/06, Eric Arnold [EMAIL PROTECTED] wrote:

The end of the visual selection as gotten by`   seems to depend
on whether the cursor was  between the end_col - 1, and end_col,  or
between end_col, and end_col + 1.  The GUI gvim seems to have the
notion of the the cursor being between characters in visual mode.

` sometimes lands you on the character *after* the last col of the
visual selection.

So, the question is, how do I get the real last column of the Visual selection?



Actually, this seems be inconsistent mostly when you start a
visual-block selections from different corners.



It works as expected for me. For example,

  1. Start :new buffer.
  2. From Normal mode, type iab.
  3. Hit Enter.
  4. Type cd, and hit Esc. Then do gg0. You should have:

   ab
   cd

 with the Normal cursor on a.

  5. Start visual block with C-v, and hit jl. Press Esc.

Now, from Insert mode, if you did

  6. C-o followed by `

the Insert cursor will be between c and d. If, instead, you hit
j2l in step 5, then (after step 6) the Insert cursor will appear after
d.

Remember, visual modes are able to highlight _past_ the end-of-line,
unlike the Normal mode cursor.

Please provide an example if you still see a problem.

HTH.
--
Gerald