vile
[Top][All Lists]
Advanced

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

Re: question regarding `c' operator acting on rectangular region


From: joerg van den hoff
Subject: Re: question regarding `c' operator acting on rectangular region
Date: Sat, 27 May 2023 13:44:38 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0



On 27.05.23 13:27, Paul Fox wrote:
joerg van den hoff wrote:
  > rarely using rectangular regions (and when, then for deletion), so
  > I was surprised by the following:
  >
  > issuing something like
  >
  > c^Aqjq
  >
  > to select a rectangle with a width of one character and a height of
  > 2 lines and trying to replace the rectangle by a multicharacter
  > string fails.  only the first character of the replacement string
  > specified in response to the "Rectangular text:" query is inserted.
  >
  > e.g. with an input of
  >
  > 1 2 3
  > 1 2 3
  >
  > and selecting the 2nd column as rectangle and trying to replace the
  > 2s by "abc" results in
  >
  > 1 a 3
  > 1 a 3
  >
  > I would have expected the text to the right of the rectangle to be
  > shifted to the right to make room for the full replacement string?
  >
  > questions:
  >
  > * am I doing it wrong?

I'm afraid not.  This is the current behavior.

understood. thank you for clarifying.


  >
  > * if no, is this to be expected behaviour or a bug?
  >
  > * if not a bug, is there a canonical way to achieve the desired
  > * edit result, i.e.
  >
  > 1 abc 3
  > 1 abc 3

No easy way.  I find myself using ^A-r to open a rectangle with the
right amount of space (and it's usually too much :-/ ), then put in
the text I want, then delete the extra, if any.  I don't know how hard
it would be internally to force the new empty space in order to make
room for the new string.  Currently if the new text is shorter than
the rectangle width, it's padded with spaces -- to be consistent, the
rectangle should probably be shrunk to match the string length.

yes, I see. I was considering that as a work around if need be. but then
settled on (m)awk an hour ago :).


I seem to recall I wasn't terribly happy with the way the rectangular
operations turned out, after implementing them, and I think this was
part of it.

they are still quite useful without doubt...

but regarding the `c' operator it would sure be nicer if it would behave on rectangles like it does on, say, words: adjust the selected region's width to the replacement string width. since ^A-r is available/working (and the underlying code could be used to inject something else than blanks I guess), I wonder how difficult it would be to make c^A-q do the "expected" thing?

but in any case thanks again for explaining the situation. I just didn't know. and one of course can work around the given limitation.

joerg


paul

  >
  > in this example?
  >
  > thank you
  > joerg
  >


=----------------------
paul fox, pgf@foxharp.boston.ma.us (arlington, ma)





reply via email to

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