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). > > 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. ---- test.c ---- #include <stdio.h> #define CTRL_X_OMNI 13 void judge(int ctrl_x_mode); int main(void) { int i; for (i=0; i<20; i++) judge(i); return 0; } void judge(int ctrl_x_mode) { int result = ((ctrl_x_mode & CTRL_X_OMNI) == 0); printf("ctrl_x_mode: %d, result is %d\n", ctrl_x_mode, result); return; } -------- $ gcc -Wall test.c $ ./a.out ctrl_x_mode: 0, result is 1 ctrl_x_mode: 1, result is 0 ctrl_x_mode: 2, result is 1 ctrl_x_mode: 3, result is 0 ctrl_x_mode: 4, result is 0 ctrl_x_mode: 5, result is 0 ctrl_x_mode: 6, result is 0 ctrl_x_mode: 7, result is 0 ctrl_x_mode: 8, result is 0 ctrl_x_mode: 9, result is 0 ctrl_x_mode: 10, result is 0 ctrl_x_mode: 11, result is 0 ctrl_x_mode: 12, result is 0 ctrl_x_mode: 13, result is 0 ctrl_x_mode: 14, result is 0 ctrl_x_mode: 15, result is 0 ctrl_x_mode: 16, result is 1 ctrl_x_mode: 17, result is 0 ctrl_x_mode: 18, result is 1 ctrl_x_mode: 19, result is 0 Thanks for the response. Best regards, Hirohito Higashi (a.k.a h_east) -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.