Patch 8.2.0956

17 views
Skip to first unread message

Bram Moolenaar

unread,
Jun 10, 2020, 4:18:30 PM6/10/20
to vim...@googlegroups.com

Patch 8.2.0956 (after 8.2.0953)
Problem: Spell test fails.
Solution: Add missing change the spell checking.
Files: src/spell.c


*** ../vim-8.2.0955/src/spell.c 2020-06-10 15:32:04.455653633 +0200
--- src/spell.c 2020-06-10 21:33:53.462633840 +0200
***************
*** 173,178 ****
--- 173,180 ----
int wrongcaplen = 0;
int lpi;
int count_word = docount;
+ int use_camel_case = *wp->w_s->b_p_spo != NUL;
+ int camel_case = 0;

// A word never starts at a space or a control character. Return quickly
// then, skipping over the character.
***************
*** 204,212 ****
mi.mi_fend = ptr;
if (spell_iswordp(mi.mi_fend, wp))
{
do
MB_PTR_ADV(mi.mi_fend);
! while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp));

if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL)
{
--- 206,232 ----
mi.mi_fend = ptr;
if (spell_iswordp(mi.mi_fend, wp))
{
+ int prev_upper;
+ int this_upper;
+
+ if (use_camel_case)
+ {
+ c = PTR2CHAR(mi.mi_fend);
+ this_upper = SPELL_ISUPPER(c);
+ }
+
do
+ {
MB_PTR_ADV(mi.mi_fend);
! if (use_camel_case)
! {
! prev_upper = this_upper;
! c = PTR2CHAR(mi.mi_fend);
! this_upper = SPELL_ISUPPER(c);
! camel_case = !prev_upper && this_upper;
! }
! } while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp)
! && !camel_case);

if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL)
{
***************
*** 237,242 ****
--- 257,266 ----
MAXWLEN + 1);
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);

+ if (camel_case)
+ // Introduce a fake word end space into the folded word.
+ mi.mi_fword[mi.mi_fwordlen - 1] = ' ';
+
// The word is bad unless we recognize it.
mi.mi_result = SP_BAD;
mi.mi_result2 = SP_BAD;
*** ../vim-8.2.0955/src/version.c 2020-06-10 22:11:59.922786692 +0200
--- src/version.c 2020-06-10 22:17:16.561791496 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 956,
/**/

--
Futility Factor: No experiment is ever a complete failure - it can always
serve as a negative example.

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

Tony Mechelynck

unread,
Jun 11, 2020, 1:52:45 AM6/11/20
to vim_dev
On Wed, Jun 10, 2020 at 10:18 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Patch 8.2.0956 (after 8.2.0953)
> Problem: Spell test fails.
> Solution: Add missing change the spell checking.
> Files: src/spell.c

This gives me a warning -Wmaybe-uninitialized in all +eval builds, as follows:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread
-I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0
-I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0
-I/usr/lib64/dbus-1.0/include -I/usr/include/gtk-3.0
-I/usr/include/gio-unix-2.0 -I/usr/include/libxkbcommon
-I/usr/include/wayland -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2
-fno-strength-reduce -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
-o objects/spell.o spell.c
spell.c: In function ‘spell_check’:
spell.c:226:16: warning: ‘this_upper’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
camel_case = !prev_upper && this_upper;
^~~~~~~~~~~

Best regards,
Tony.

Bram Moolenaar

unread,
Jun 11, 2020, 6:31:00 AM6/11/20
to vim...@googlegroups.com, Tony Mechelynck
Thanks for reporting. We need to initialize this_upper, gcc can't
figure out it was already set.

--
ARTHUR: Well, it doesn't matter. Will you go and tell your master that
Arthur from the Court of Camelot is here.
GUARD #1: Listen, in order to maintain air-speed velocity, a swallow
needs to beat its wings 43 times every second, right?
ARTHUR: Please!
The Quest for the Holy Grail (Monty Python)
Reply all
Reply to author
Forward
0 new messages