comparison src/ops.c @ 7551:f624d7671e0c v7.4.1076

commit https://github.com/vim/vim/commit/6a3c8aff0439c8406082760c54b26e00ff19a90c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 10 14:13:40 2016 +0100 patch 7.4.1076 Problem: CTRL-A does not work well in right-left mode. Solution: Remove reversing the line, add a test. (Hirohito Higashi)
author Christian Brabandt <cb@256bit.org>
date Sun, 10 Jan 2016 14:15:03 +0100
parents 6d969668bfc8
children 4250ecde6009
comparison
equal deleted inserted replaced
7550:a38a2da9e741 7551:f624d7671e0c
5337 } 5337 }
5338 bdp->textcol = (colnr_T) (pstart - line); 5338 bdp->textcol = (colnr_T) (pstart - line);
5339 bdp->textstart = pstart; 5339 bdp->textstart = pstart;
5340 } 5340 }
5341 5341
5342 #ifdef FEAT_RIGHTLEFT
5343 static void reverse_line __ARGS((char_u *s));
5344
5345 static void
5346 reverse_line(s)
5347 char_u *s;
5348 {
5349 int i, j;
5350 char_u c;
5351
5352 if ((i = (int)STRLEN(s) - 1) <= 0)
5353 return;
5354
5355 curwin->w_cursor.col = i - curwin->w_cursor.col;
5356 for (j = 0; j < i; j++, i--)
5357 {
5358 c = s[i]; s[i] = s[j]; s[j] = c;
5359 }
5360 }
5361
5362 # define RLADDSUBFIX(ptr) if (curwin->w_p_rl) reverse_line(ptr);
5363 #else
5364 # define RLADDSUBFIX(ptr)
5365 #endif
5366
5367 /* 5342 /*
5368 * add or subtract 'Prenum1' from a number in a line 5343 * add or subtract 'Prenum1' from a number in a line
5369 * 'command' is CTRL-A for add, CTRL-X for subtract 5344 * 'command' is CTRL-A for add, CTRL-X for subtract
5370 * 5345 *
5371 * return FAIL for failure, OK otherwise 5346 * return FAIL for failure, OK otherwise
5424 curwin->w_cursor = VIsual; 5399 curwin->w_cursor = VIsual;
5425 VIsual = t; 5400 VIsual = t;
5426 } 5401 }
5427 5402
5428 ptr = ml_get(VIsual.lnum); 5403 ptr = ml_get(VIsual.lnum);
5429 RLADDSUBFIX(ptr);
5430 if (VIsual_mode == 'V') 5404 if (VIsual_mode == 'V')
5431 { 5405 {
5432 VIsual.col = 0; 5406 VIsual.col = 0;
5433 curwin->w_cursor.col = (colnr_T)STRLEN(ptr); 5407 curwin->w_cursor.col = (colnr_T)STRLEN(ptr);
5434 } 5408 }
5455 lnume = curwin->w_cursor.lnum; 5429 lnume = curwin->w_cursor.lnum;
5456 } 5430 }
5457 else 5431 else
5458 { 5432 {
5459 ptr = ml_get_curline(); 5433 ptr = ml_get_curline();
5460 RLADDSUBFIX(ptr);
5461 5434
5462 if (dobin) 5435 if (dobin)
5463 while (col > 0 && vim_isbdigit(ptr[col])) 5436 while (col > 0 && vim_isbdigit(ptr[col]))
5464 --col; 5437 --col;
5465 5438
5524 colnr_T stop = 0; 5497 colnr_T stop = 0;
5525 5498
5526 t = curwin->w_cursor; 5499 t = curwin->w_cursor;
5527 curwin->w_cursor.lnum = i; 5500 curwin->w_cursor.lnum = i;
5528 ptr = ml_get_curline(); 5501 ptr = ml_get_curline();
5529 RLADDSUBFIX(ptr);
5530 if ((int)STRLEN(ptr) <= col) 5502 if ((int)STRLEN(ptr) <= col)
5531 /* try again on next line */ 5503 /* try again on next line */
5532 continue; 5504 continue;
5533 if (visual) 5505 if (visual)
5534 { 5506 {
5810 col = startcol; 5782 col = startcol;
5811 else 5783 else
5812 col = 0; 5784 col = 0;
5813 Prenum1 += offset; 5785 Prenum1 += offset;
5814 curwin->w_set_curswant = TRUE; 5786 curwin->w_set_curswant = TRUE;
5815 #ifdef FEAT_RIGHTLEFT
5816 ptr = ml_get_buf(curbuf, curwin->w_cursor.lnum, TRUE);
5817 RLADDSUBFIX(ptr);
5818 #endif
5819 } 5787 }
5820 if (visual) 5788 if (visual)
5821 /* cursor at the top of the selection */ 5789 /* cursor at the top of the selection */
5822 curwin->w_cursor = VIsual; 5790 curwin->w_cursor = VIsual;
5823 return OK; 5791 return OK;