comparison src/workshop.c @ 14175:2ad722003b36 v8.1.0105

patch 8.1.0105: all tab stops are the same commit https://github.com/vim/vim/commit/04958cbaf25eea27eceedaa987adfb354ad5f7fd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 23 19:23:02 2018 +0200 patch 8.1.0105: all tab stops are the same Problem: All tab stops are the same. Solution: Add the variable tabstop feature. (Christian Brabandt, closes #2711)
author Christian Brabandt <cb@256bit.org>
date Sat, 23 Jun 2018 19:30:07 +0200
parents 1a450ce6980c
children 3e9b24eac417
comparison
equal deleted inserted replaced
14174:d36eedd19166 14175:2ad722003b36
47 static void load_buffer_by_name(char *, int); 47 static void load_buffer_by_name(char *, int);
48 static void load_window(char *, int lnum); 48 static void load_window(char *, int lnum);
49 static void warp_to_pc(int); 49 static void warp_to_pc(int);
50 #ifdef FEAT_BEVAL_GUI 50 #ifdef FEAT_BEVAL_GUI
51 void workshop_beval_cb(BalloonEval *, int); 51 void workshop_beval_cb(BalloonEval *, int);
52 # ifdef FEAT_VARTABS
53 static int computeIndex(int, char_u *, int, int *);
54 # else
52 static int computeIndex(int, char_u *, int); 55 static int computeIndex(int, char_u *, int);
56 # endif
53 #endif 57 #endif
54 static char *fixAccelText(char *); 58 static char *fixAccelText(char *);
55 static void addMenu(char *, char *, char *); 59 static void addMenu(char *, char *, char *);
56 static char *lookupVerb(char *, int); 60 static char *lookupVerb(char *, int);
57 static void coloncmd(char *, Boolean); 61 static void coloncmd(char *, Boolean);
1532 /* 1536 /*
1533 * WorkShop expects the col to be a character index, not 1537 * WorkShop expects the col to be a character index, not
1534 * a column number. Compute the index from col. Also set 1538 * a column number. Compute the index from col. Also set
1535 * line to 0 because thats what dbx expects. 1539 * line to 0 because thats what dbx expects.
1536 */ 1540 */
1541 #ifdef FEAT_VARTABS
1542 idx = computeIndex(col, text, beval->ts, beval->vts);
1543 #else
1537 idx = computeIndex(col, text, beval->ts); 1544 idx = computeIndex(col, text, beval->ts);
1545 #endif
1538 if (idx > 0) 1546 if (idx > 0)
1539 { 1547 {
1540 lnum = 0; 1548 lnum = 0;
1541 1549
1542 /* 1550 /*
1567 1575
1568 static int 1576 static int
1569 computeIndex( 1577 computeIndex(
1570 int wantedCol, 1578 int wantedCol,
1571 char_u *line, 1579 char_u *line,
1572 int ts) 1580 int ts
1581 #ifdef FEAT_VARTABS
1582 int *vts
1583 #else
1584 )
1573 { 1585 {
1574 int col = 0; 1586 int col = 0;
1575 int idx = 0; 1587 int idx = 0;
1576 1588
1577 while (line[idx]) 1589 while (line[idx])
1578 { 1590 {
1579 if (line[idx] == '\t') 1591 if (line[idx] == '\t')
1592 #ifdef FEAT_VARTABS
1593 col += tabstop_padding(col, ts, vts);
1594 #else
1580 col += ts - (col % ts); 1595 col += ts - (col % ts);
1596 #endif
1581 else 1597 else
1582 col++; 1598 col++;
1583 idx++; 1599 idx++;
1584 if (col >= wantedCol) 1600 if (col >= wantedCol)
1585 return idx; 1601 return idx;