On Fri, Jan 16, 2015 at 08:31:16PM -0800, h_east wrote:
> Hi James,
> 
> 2015/1/17(Sat) 9:56:56 UTC+9 James McCoy:
> > On Fri, Jan 16, 2015 at 02:45:49PM -0800, h_east wrote:
> > > Hi Bram and list,
> > > 
> > > I found a strange code.
> > > 
> > > ins_compl_bs() in src/edit.c : L3397
> > >  3393     /* Stop completion when the whole word was deleted.  For Omni 
> > > completion
> > >  3394      * allow the word to be deleted, we won't match everything. */
> > >  3395     if ((int)(p - line) - (int)compl_col < 0
> > >  3396             || ((int)(p - line) - (int)compl_col == 0
> > >  3397                 && (ctrl_x_mode & CTRL_X_OMNI) == 0))
> > >  3398         return K_BS;
> > > 
> > > 
> > > `ctrl_x_mode` is assigned a kind of serial number. (CTRL_X_~)
> > > But L3397 implemented a logical AND operation.
> > > I think this is code typo. 
> > 
> > The logical AND is applied to the result of the "(ctrl_x_mode &
> > CTRL_X_OMNI) == 0" expression.  That expression is checking whether
> > ctrl_x_mode is anything except CTRL_X_OMNI, i.e. whether the bitwise AND
> > of ctrl_x_mode and CTRL_X_OMNI share no common bits (== 0).

I don't know what I was thinking here.  Even if ctrl_x_mode were being
set to bitwise independent values, my logic was off.

> > Your proposed patch has the same end result, but does make this code
> > more in line with most of the other uses of ctrl_x_mode in the file.
> 
> No. Please confirm this test code.

Indeed, you're right.  I noticed that there were other legitimate uses
of bitwise operations with ctrl_x_mode but didn't pay enough attention
to what they were.

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <[email protected]>

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: Digital signature

Raspunde prin e-mail lui