Re: Hangs on scrolling and Auto-indent in comments

From: Angel Ortega <angel_triptico.com>
Date: Tue, 9 Oct 2007 07:53:06 +0200
Jeremy Cowgar (jeremy_cowgar.com) wrote:

> This was occurring in RC2 and RC3. At random (not often, but 3-4 times a 
> day) mp just hangs on me. It is *always* when I am scrolling up or down. It 
> seems to occur only while scrolling with the keyboard, either arrow up/down 
> or page up/down. I have not had it happen when using the mouse, however, I 
> rarely do, so that might not be conclusive.

Strange! Didn't happen to me, and I use MP as the one and only editor
every day. This happens in the MS Windows version, doesn't it?

I'll investigate it.

> Auto indentation needs a bit of help still, I think. Here's a synario:
>
> /****
> * Hello World
> * Note:
> *       Indented line. This is a test. INSERT NEW LINE HERE
>          CURSOR APPEARS HERE
>
>
> I then have to backspace out to insert the next * character, then space 
> back it. It would be *super* fantastic if it would detect I am in a comment 
> and automatically insert the * for me and indent to that line, but I'd be 
> happy with it indenting to just the first non-whitespace character.

Certainly, a mode-savvy indenting should be great, but it isn't trivial to
implement.

But 'ignoring' the asterisk is intentional. It's an inherited behaviour
from the 3.x version that somebody asked for, to autoindent correctly
paragraphs like this:

 * This is a paragraph that should be long enough to not fit in a line and
   wrap in the next one.

It treats *, - and + as special 'almost-space' characters. Yes, I know it's
odd.

There is a way to change it: look at the mp.break_line() function in
mp_edit.mpsl. The following paragraph contains the regex:

		/* extract leading blanks in the original line
		   to prepend them to the line to be inserted */
		local i = regex("/^[ \t]*[-\+\*]?[ \t]+/", c, 0);

This regex (that should be configurable and live in mp.config) takes the
above into account. Just delete the [ \t]*[-\+\*]? part and indentation
will stop in the first non-blank character.

Certainly, this should be tunable by other, more flexible, means.

-- 
Angel Ortega



-- 
To unsubscribe, send mail to mp-unsubscribe_lists.triptico.com.


Received on Tue Oct 09 2007 - 07:52:26 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 10 2008 - 08:59:26 CEST