[Top][All Lists]

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

Re: [Nano-devel] [PATCH] text: let indenting/commenting skip the last li

From: David Ramsey
Subject: Re: [Nano-devel] [PATCH] text: let indenting/commenting skip the last line i
Date: Tue, 19 Dec 2017 14:34:45 -0600

Benno Schulenberg:
> If the marked region ends at the start of a line, do not include that
> line in the indenting/undenting or commenting/uncommenting.

Good idea.  However, in the patch's added function get_region():

+    if (*bot_x == 0) {
+       *bot = (*bot)->prev;
+       *bot_x = mbstrlen((*bot)->data);
+    }

This should use strlen() instead of mbstrlen().  The latter function
counts characters instead of bytes, and bot_x is not a character
count, but an index.

Also, even though both functions seem to produce the same result,
calling strlen() is faster than calling mbstrlen() when in UTF-8 mode,
since the extra processing done in mbstrlen() is unneeded.

reply via email to

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