From ffcfcf8272ba31a25de594aeea61492824202adb Mon Sep 17 00:00:00 2001 From: edyfox Date: Fri, 22 Feb 2008 06:25:53 +0000 Subject: [PATCH] Merged from the latest developing branch. git-svn-id: https://vim.svn.sourceforge.net/svnroot/vim/trunk@913 2a77ed30-b011-0410-a7ad-c7884a0aa172 --- runtime/doc/eval.txt | 7 ++++++- src/charset.c | 3 ++- src/eval.c | 14 ++++++++++++++ src/fileio.c | 7 ++++--- src/screen.c | 6 +++++- src/testdir/test42.ok | Bin 407 -> 408 bytes src/version.c | 8 ++++++++ 7 files changed, 39 insertions(+), 6 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7acf740e..13caa16c 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.1. Last change: 2008 Feb 13 +*eval.txt* For Vim version 7.1. Last change: 2008 Feb 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1638,6 +1638,7 @@ getline( {lnum}) String line {lnum} of current buffer getline( {lnum}, {end}) List lines {lnum} to {end} of current buffer getloclist({nr}) List list of location list items getmatches() List list of current matches +getpid() Number process ID of Vim getpos( {expr}) List position of cursor, mark, etc. getqflist() List list of quickfix items getreg( [{regname} [, 1]]) String contents of register @@ -3833,6 +3834,10 @@ nr2char({expr}) *nr2char()* characters. nr2char(0) is a real NUL and terminates the string, thus results in an empty string. + *getpid()* +getpid() Return a Number which is the process ID of the Vim process. + On Unix this is a unique number. On MS-DOS it's always zero. + *getpos()* getpos({expr}) Get the position for {expr}. For possible values of {expr} see |line()|. diff --git a/src/charset.c b/src/charset.c index 32d75553..a79f0fd0 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1290,7 +1290,8 @@ getvcol(wp, pos, start, cursor, end) /* If a double-cell char doesn't fit at the end of a line * it wraps to the next line, it's like this char is three * cells wide. */ - if (incr == 2 && wp->w_p_wrap && in_win_border(wp, vcol)) + if (incr == 2 && wp->w_p_wrap && MB_BYTE2LEN(*ptr) > 1 + && in_win_border(wp, vcol)) { ++incr; head = 1; diff --git a/src/eval.c b/src/eval.c index 0dd8bd0b..bcf9b79d 100644 --- a/src/eval.c +++ b/src/eval.c @@ -532,6 +532,7 @@ static void f_getftime __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getftype __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getline __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getmatches __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_getpid __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getpos __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getqflist __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getreg __ARGS((typval_T *argvars, typval_T *rettv)); @@ -7132,6 +7133,7 @@ static struct fst {"getline", 1, 2, f_getline}, {"getloclist", 1, 1, f_getqflist}, {"getmatches", 0, 0, f_getmatches}, + {"getpid", 0, 0, f_getpid}, {"getpos", 1, 1, f_getpos}, {"getqflist", 0, 0, f_getqflist}, {"getreg", 0, 2, f_getreg}, @@ -10374,6 +10376,18 @@ f_getmatches(argvars, rettv) } /* + * "getpid()" function + */ +/*ARGSUSED*/ + static void +f_getpid(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + rettv->vval.v_number = mch_get_pid(); +} + +/* * "getpos(string)" function */ static void diff --git a/src/fileio.c b/src/fileio.c index 40905cfe..fbb3ada4 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5514,10 +5514,11 @@ check_for_bom(p, size, lenp, flags) else if (p[0] == 0xfe && p[1] == 0xff && (flags == FIO_ALL || flags == FIO_UCS2 || flags == FIO_UTF16)) { - if (flags == FIO_UTF16) - name = "utf-16"; /* FE FF */ - else + /* Default to utf-16, it works also for ucs-2 text. */ + if (flags == FIO_UCS2) name = "ucs-2"; /* FE FF */ + else + name = "utf-16"; /* FE FF */ } else if (size >= 4 && p[0] == 0 && p[1] == 0 && p[2] == 0xfe && p[3] == 0xff && (flags == FIO_ALL || flags == FIO_UCS4)) diff --git a/src/screen.c b/src/screen.c index 219b6643..a7399272 100644 --- a/src/screen.c +++ b/src/screen.c @@ -8045,9 +8045,13 @@ setcursor() windgoto(W_WINROW(curwin) + curwin->w_wrow, W_WINCOL(curwin) + ( #ifdef FEAT_RIGHTLEFT + /* With 'rightleft' set and the cursor on a double-wide + * character, position it on the leftmost column. */ curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - ( # ifdef FEAT_MBYTE - has_mbyte ? (*mb_ptr2cells)(ml_get_cursor()) : + (has_mbyte + && (*mb_ptr2cells)(ml_get_cursor()) == 2 + && vim_isprintc(gchar_cursor())) ? 2 : # endif 1)) : #endif diff --git a/src/testdir/test42.ok b/src/testdir/test42.ok index 16f41e46e0c9430df4c0672a13c3fb531b1e1ff7..82b7c633cb6c18c914c3b069b800608f5324fe32 100644 GIT binary patch delta 16 XcwU>%JcD^cH)~0nuA$k+ehx+eE<^qJe_$$_rwh>8z*ou0sthO1mFMw diff --git a/src/version.c b/src/version.c index 21701b79..269153ed 100644 --- a/src/version.c +++ b/src/version.c @@ -667,6 +667,14 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 262, +/**/ + 261, +/**/ + 260, +/**/ + 259, +/**/ 258, /**/ 257, -- 2.11.4.GIT