help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: virtual space?


From: Stefan Monnier
Subject: Re: virtual space?
Date: Tue, 21 Oct 2003 15:04:35 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> Hmm, come to think of it, I can actually find a valid use for it.
> Imagine this text in a buffer:

> blah blah blah
> blah blah<-buffer ends here

> If you have the buffer text above, it is *impossible* to copy a
> rectangle with  all the content of the buffer without needing to add
> extra spaces at the end of the last line to get the cursor to the same
> column as the third "blah" on the first line. Right?

Of course you can: place point at beginning of second line press C-SPC,
then press C-p C-e to go to the end of first line and C-x r k to kill
the rectangle.

But your point does hold in the following case:

blabla
blablabla
blabla

> Having a virtual cursor would solve the problem.

There are two other ways to solve the problem:
- use SPC instead of C-f (if you also use transient-mark-mode, this will
  turn off the mark, so you'll need to hit C-x C-x when done to reactivate
  it).
- use CUA, which has a very good support for rectangles, including special
  commands to highlight/grow/shrink/shift the currently selected rectangle,
  and which inserts spaces as needed, just like picture-mode.

> Anyway, this is no big problem for *me*.

Neither is it for me.  At first, it would seem like it'd be very difficult
to implement, but now that I think about it, I believe it can be done purely
in elisp: When going "past the last char" of a line, just add an overlay at
the end of the line with an `after-string' property of "     ".  At least
here (Emacs-CVS), it seems to move the cursor according to the number of
spaces you've put, so you can place the cursor where you want on screen
without modifying the buffer text.  The tricky part will be to make the
other commands work correctly by replacing the overlay with actual spaces
before doing an insertion.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]