Patch 8.2.2935

17 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 4, 2021, 1:17:41 PM6/4/21
to vim...@googlegroups.com

Patch 8.2.2935 (after 8.2.2934)
Problem: Calculating register width is not always needed. (Christian
Brabandt)
Solution: Only calculate the width when the type is MBLOCK.
Files: src/register.c


*** ../vim-8.2.2934/src/register.c 2021-06-04 18:33:46.476081798 +0200
--- src/register.c 2021-06-04 19:13:46.606773878 +0200
***************
*** 2836,2842 ****
char_u **ss;
char_u **pp;
long maxlen;
- int charlen;

if (y_ptr->y_array == NULL) // NULL means empty register
y_ptr->y_size = 0;
--- 2836,2841 ----
***************
*** 2895,2917 ****
{
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
{
! charlen = MB_CHARLEN(*ss);
! i = (long)STRLEN(*ss);
! pp[lnum] = vim_strnsave(*ss, i);
! if (charlen > maxlen)
! maxlen = charlen;
}
}
else
{
for (start = 0; start < len + extraline; start += i + 1)
{
! charlen = 0;
for (i = start; i < len; ++i) // find the end of the line
{
if (str[i] == '\n')
break;
! charlen += mb_ptr2cells_len(str + i, len - i);
}
i -= start; // i is now length of line
if (charlen > maxlen)
--- 2894,2921 ----
{
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
{
! pp[lnum] = vim_strsave(*ss);
! if (type == MBLOCK)
! {
! int charlen = mb_string2cells(*ss, -1);
!
! if (charlen > maxlen)
! maxlen = charlen;
! }
}
}
else
{
for (start = 0; start < len + extraline; start += i + 1)
{
! int charlen = 0;
!
for (i = start; i < len; ++i) // find the end of the line
{
if (str[i] == '\n')
break;
! if (type == MBLOCK)
! charlen += mb_ptr2cells_len(str + i, len - i);
}
i -= start; // i is now length of line
if (charlen > maxlen)
*** ../vim-8.2.2934/src/version.c 2021-06-04 18:33:46.476081798 +0200
--- src/version.c 2021-06-04 19:05:11.760138025 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2935,
/**/

--
A law to reduce crime states: "It is mandatory for a motorist with criminal
intentions to stop at the city limits and telephone the chief of police as he
is entering the town.
[real standing law in Washington, United States of America]

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jun 4, 2021, 3:46:58 PM6/4/21
to vim...@googlegroups.com

On Fr, 04 Jun 2021, Bram Moolenaar wrote:

>
> Patch 8.2.2935 (after 8.2.2934)
> Problem: Calculating register width is not always needed. (Christian
> Brabandt)
> Solution: Only calculate the width when the type is MBLOCK.
> Files: src/register.c

Now you might #ifdef mb_charlen_len again.

Best,
Christian
--
Wußten Sie schon...
... daß ein Schiffskoch immer an "Backbord" arbeitet, weil dort der Ofen
steht?

Bram Moolenaar

unread,
Jun 4, 2021, 4:18:11 PM6/4/21
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> > Patch 8.2.2935 (after 8.2.2934)
> > Problem: Calculating register width is not always needed. (Christian
> > Brabandt)
> > Solution: Only calculate the width when the type is MBLOCK.
> > Files: src/register.c
>
> Now you might #ifdef mb_charlen_len again.

Until the next time we need it... I'm too lazy for this.

--
Another bucket of what can only be described as human ordure hits ARTHUR.
ARTHUR: ... Right! (to the KNIGHTS) That settles it!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

Christian Brabandt

unread,
Jun 4, 2021, 4:27:16 PM6/4/21
to vim...@googlegroups.com

On Fr, 04 Jun 2021, Bram Moolenaar wrote:

> Christian wrote:
>
> > > Patch 8.2.2935 (after 8.2.2934)
> > > Problem: Calculating register width is not always needed. (Christian
> > > Brabandt)
> > > Solution: Only calculate the width when the type is MBLOCK.
> > > Files: src/register.c
> >
> > Now you might #ifdef mb_charlen_len again.
>
> Until the next time we need it... I'm too lazy for this.

fair enough.

Best,
Christian
--
Beredte Menschen sprechen mit solcher Klarheit, daß die meisten
glauben, sie sprächen auch tief.
-- Luc de Clapiers Vauvenargues
Reply all
Reply to author
Forward
0 new messages