nano-devel
[Top][All Lists]
Advanced

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

Re: [Nano-devel] do_para_begin bug


From: David Lawrence Ramsey
Subject: Re: [Nano-devel] do_para_begin bug
Date: Thu, 29 Jul 2004 05:25:36 +0200
User-agent: Mutt/1.5.6+20040523i

--- David Benbennick <address@hidden> wrote:
>Hi DLR, et. al.
>
>I felt like hacking again, so I took a look at the new justify code.  
>There's a bug in do_para_begin().  The attached file consists of 3 
>paragraphs (have autoindent turned off!).  From the third line, do 
>^W^W.
>  
>The cursor moves up two lines, not one.  Add a character to the end of 
>the second line, and it works correctly.

That's definitely odd.

>The code for do_para_begin and do_para_end was too complicated for me 
>to understand (a static local variable and a goto in do_para_search 
>didn't help), so I just rewrote them.

That static/goto was my attempt at dealing with the case of the user's 
pressing ^W^W on the furst line of a paragraph.  It was supposed to 
restart the search from the previous line in that case; without it, the 
cursor wouldn't move at all.  But you're right, it definitely isn't the 
easiest to understand in its current form.

>They're now stand-alone, and pretty simple.  I also simplified 
>do_para_search, since it is now only called from do_justify.

Yes, the new versions of do_para_start() and do_para_end() are much more 
understandable.  I have one quick question, though: why is old_place set 
to the value of xplustabs() instead of just placewewant?  I figure that 
they should be equivalent at that point.  Or am I missing something?

Aside from the above question, the patch looks good to me as a whole in 
terms of bug fixing and code cleanup.  However, for now, I'd like to 
stay with the idea of not using static functions, though, since the 
code's still in flux to such a degree that having to keep track of both 
static and non-static functions now will just make things more 
complicated than they need to be.  (Just so you know, I've already made 
begpar() and inpar() non-static on my end and synced the patch with 
current CVS, so you don't need to worry about either.)

>Finally, the attached patch makes the quote string regular expression 
>be compiled once, globally.  That simplifies the justify code a bit.
>
>Next, I intend to rework do_justify.  It's currently quadratic runtime; 
>I think I can make it linear.

Sounds good.  Good luck with it.

>By the way: can we use the "bool" data type instead of "int" for 
>boolean values?  If it'll get applied, I'll be happy to make a patch 
>that does that change globally.

Go ahead.  I've been meaning to get to that in the process of all the 
internal cleanups I've been doing, but I haven't had time yet.




reply via email to

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