Re: Request for a "Rewrap paragraph" function

From: phayz <russelldicken....at.gmail.com>
Date: Wed, 9 Jun 2010 18:04:20 -0700 (PDT)

On Jun 10, 9:11 am, Brian Schott <briancsch....at.gmail.com> wrote:
> On Wed, Jun 9, 2010 at 4:02 PM, phayz <russelldicken....at.gmail.com> wrote:
> > On May 3, 9:11 pm, Frank Smit <61924....at.gmail.com> wrote:
> > > The wiki page was full of crap. I restored it, but I don't know if
> > > it's alright now.
>
> > > 2010/5/2 Brian Schott <briancsch....at.gmail.com>:
>
> > > > Thewrapfunction should be fixed now.
>
> > > >http://caladbolg.net/textadeptwiki/index.php?n=Main.Linewrap
>
> > > > - Brian
>
> > Brian et al,
>
> > I am having trouble with this function. If I use wrap2.lua, it
> > *almost* works as expected, but when wrapping a long line into several
> > lines, it fails to complete the job. The long line is broken down into
> > shorter lines, but the very last line of the resulting paragraph
> > exceeds the long line value.
>
> > I have tried the older version - wrap.lua - and get even stranger
> > results with it. For example, the first line is re-wrapped OK. When I
> > then move the cursor to the next line, and press Control+h, nothing
> > happens, except that the cursor is moved up a line. However if I put
> > the cursor on the line *below* the line which is to be wrapped, the
> > line is re-wrapped perfectly.
>
> > Would you prefer that I switch back to wrap2.lua and work to
> > troubleshoot the problem?
>
> > Regards,
>
> > Russell Dickenson
>
>
> Hm. I just noticed that the version I have on my computer is different from
> the one on the wiki. I uploaded the one from my computer. Try this:
>
> http://caladbolg.net/textadeptwiki/uploads/wrap.lua

Brian,

Wow! Thanks for such a prompt reply. I have re-tested and am getting
the same results. In my test file I have 6 lines:

1) long line (my theme contains "buffer.edge_column = 80")
2) blank line
3) long line
4) blank line
5) long line
6) blank line

To have the long lines re-wrapped, I put the cursor on the blank line
*below* the long line and press Control+h and bingo!, the line is
rewrapped as desired. This sequence of actions works for each of the
long lines. What I had *expected* was that I put the cursor on the
long line, and then press Control+h. Oddly enough, this works for the
very first long line, which is the first line in the file. For all the
other long lines though, the rewrapping will only work if the cursor
is on the line *below* them.

I have previously looked over the code and can't see what's wrong, but
I am very much a newbie when it comes to Lua.

Regards,
Received on Wed 09 Jun 2010 - 21:04:20 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:41:24 EST