• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisãoa4365075d05c40606c2ace3340e9484a6b045f32 (tree)
Hora2007-08-30 20:53:22
Autorvimboss
Commitervimboss

Mensagem de Log

updated for version 7.1-093

Mudança Sumário

Diff

diff -r e2f5c1597829 -r a4365075d05c src/globals.h
--- a/src/globals.h Thu Aug 30 10:51:14 2007 +0000
+++ b/src/globals.h Thu Aug 30 11:53:22 2007 +0000
@@ -801,7 +801,7 @@
801801 EXTERN int (*mb_char2bytes) __ARGS((int c, char_u *buf)) INIT(= latin_char2bytes);
802802 EXTERN int (*mb_ptr2cells) __ARGS((char_u *p)) INIT(= latin_ptr2cells);
803803 EXTERN int (*mb_char2cells) __ARGS((int c)) INIT(= latin_char2cells);
804-EXTERN int (*mb_off2cells) __ARGS((unsigned off)) INIT(= latin_off2cells);
804+EXTERN int (*mb_off2cells) __ARGS((unsigned off, unsigned max_off)) INIT(= latin_off2cells);
805805 EXTERN int (*mb_ptr2char) __ARGS((char_u *p)) INIT(= latin_ptr2char);
806806 EXTERN int (*mb_head_off) __ARGS((char_u *base, char_u *p)) INIT(= latin_head_off);
807807
diff -r e2f5c1597829 -r a4365075d05c src/gui.c
--- a/src/gui.c Thu Aug 30 10:51:14 2007 +0000
+++ b/src/gui.c Thu Aug 30 11:53:22 2007 +0000
@@ -1080,7 +1080,8 @@
10801080 cur_width = gui.char_width;
10811081 }
10821082 #ifdef FEAT_MBYTE
1083- if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col) > 1)
1083+ if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col,
1084+ LineOffset[gui.row] + screen_Columns) > 1)
10841085 {
10851086 /* Double wide character. */
10861087 if (shape_table[idx].shape != SHAPE_VER)
@@ -1159,7 +1160,7 @@
11591160 #endif
11601161
11611162 # if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) \
1162- || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_MAC))
1163+ || defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_MAC))
11631164 if (gui_has_tabline())
11641165 text_area_y += gui.tabline_height;
11651166 #endif
diff -r e2f5c1597829 -r a4365075d05c src/mbyte.c
--- a/src/mbyte.c Thu Aug 30 10:51:14 2007 +0000
+++ b/src/mbyte.c Thu Aug 30 11:53:22 2007 +0000
@@ -1310,20 +1310,26 @@
13101310 /*
13111311 * mb_off2cells() function pointer.
13121312 * Return number of display cells for char at ScreenLines[off].
1313- * Caller must make sure "off" and "off + 1" are valid!
1313+ * We make sure that the offset used is less than "max_off".
13141314 */
13151315 /*ARGSUSED*/
13161316 int
1317-latin_off2cells(off)
1317+latin_off2cells(off, max_off)
13181318 unsigned off;
1319+ unsigned max_off;
13191320 {
13201321 return 1;
13211322 }
13221323
13231324 int
1324-dbcs_off2cells(off)
1325+dbcs_off2cells(off, max_off)
13251326 unsigned off;
1327+ unsigned max_off;
13261328 {
1329+ /* never check beyond end of the line */
1330+ if (off >= max_off)
1331+ return 1;
1332+
13271333 /* Number of cells is equal to number of bytes, except for euc-jp when
13281334 * the first byte is 0x8e. */
13291335 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
@@ -1332,10 +1338,11 @@
13321338 }
13331339
13341340 int
1335-utf_off2cells(off)
1341+utf_off2cells(off, max_off)
13361342 unsigned off;
1343+ unsigned max_off;
13371344 {
1338- return ScreenLines[off + 1] == 0 ? 2 : 1;
1345+ return (off + 1 < max_off && ScreenLines[off + 1] == 0) ? 2 : 1;
13391346 }
13401347
13411348 /*
@@ -2899,12 +2906,8 @@
28992906 if (composing_hangul)
29002907 return TRUE;
29012908 #endif
2902- if (enc_dbcs != 0)
2903- return dbcs_off2cells(LineOffset[row] + col) > 1;
2904- if (enc_utf8)
2905- return (col + 1 < Columns
2906- && ScreenLines[LineOffset[row] + col + 1] == 0);
2907- return FALSE;
2909+ return (*mb_off2cells)(LineOffset[row] + col,
2910+ LineOffset[row] + screen_Columns) > 1;
29082911 }
29092912
29102913 # if defined(FEAT_CLIPBOARD) || defined(FEAT_GUI) || defined(FEAT_RIGHTLEFT) \
diff -r e2f5c1597829 -r a4365075d05c src/proto/mbyte.pro
--- a/src/proto/mbyte.pro Thu Aug 30 10:51:14 2007 +0000
+++ b/src/proto/mbyte.pro Thu Aug 30 11:53:22 2007 +0000
@@ -12,9 +12,9 @@
1212 int utf_ptr2cells __ARGS((char_u *p));
1313 int dbcs_ptr2cells __ARGS((char_u *p));
1414 int latin_char2cells __ARGS((int c));
15-int latin_off2cells __ARGS((unsigned off));
16-int dbcs_off2cells __ARGS((unsigned off));
17-int utf_off2cells __ARGS((unsigned off));
15+int latin_off2cells __ARGS((unsigned off, unsigned max_off));
16+int dbcs_off2cells __ARGS((unsigned off, unsigned max_off));
17+int utf_off2cells __ARGS((unsigned off, unsigned max_off));
1818 int latin_ptr2char __ARGS((char_u *p));
1919 int utf_ptr2char __ARGS((char_u *p));
2020 int mb_ptr2char_adv __ARGS((char_u **pp));
diff -r e2f5c1597829 -r a4365075d05c src/screen.c
--- a/src/screen.c Thu Aug 30 10:51:14 2007 +0000
+++ b/src/screen.c Thu Aug 30 11:53:22 2007 +0000
@@ -1024,7 +1024,7 @@
10241024 type = VALID;
10251025 }
10261026
1027- /* Trick: we want to avoid clearning the screen twice. screenclear() will
1027+ /* Trick: we want to avoid clearing the screen twice. screenclear() will
10281028 * set "screen_cleared" to TRUE. The special value MAYBE (which is still
10291029 * non-zero and thus not FALSE) will indicate that screenclear() was not
10301030 * called. */
@@ -4632,7 +4632,7 @@
46324632
46334633 /*
46344634 * At end of screen line and there is more to come: Display the line
4635- * so far. If there is no more to display it is catched above.
4635+ * so far. If there is no more to display it is caught above.
46364636 */
46374637 if ((
46384638 #ifdef FEAT_RIGHTLEFT
@@ -4709,9 +4709,13 @@
47094709 #endif
47104710 #ifdef FEAT_MBYTE
47114711 && !(has_mbyte
4712- && ((*mb_off2cells)(LineOffset[screen_row]) == 2
4712+ && ((*mb_off2cells)(LineOffset[screen_row],
4713+ LineOffset[screen_row] + screen_Columns)
4714+ == 2
47134715 || (*mb_off2cells)(LineOffset[screen_row - 1]
4714- + (int)Columns - 2) == 2))
4716+ + (int)Columns - 2,
4717+ LineOffset[screen_row] + screen_Columns)
4718+ == 2))
47154719 #endif
47164720 )
47174721 {
@@ -4871,6 +4875,10 @@
48714875 {
48724876 unsigned off_from;
48734877 unsigned off_to;
4878+#ifdef FEAT_MBYTE
4879+ unsigned max_off_from;
4880+ unsigned max_off_to;
4881+#endif
48744882 int col = 0;
48754883 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT)
48764884 int hl;
@@ -4897,6 +4905,10 @@
48974905
48984906 off_from = (unsigned)(current_ScreenLine - ScreenLines);
48994907 off_to = LineOffset[row] + coloff;
4908+#ifdef FEAT_MBYTE
4909+ max_off_from = off_from + screen_Columns;
4910+ max_off_to = LineOffset[row] + screen_Columns;
4911+#endif
49004912
49014913 #ifdef FEAT_RIGHTLEFT
49024914 if (rlflag)
@@ -4931,7 +4943,7 @@
49314943 {
49324944 #ifdef FEAT_MBYTE
49334945 if (has_mbyte && (col + 1 < endcol))
4934- char_cells = (*mb_off2cells)(off_from);
4946+ char_cells = (*mb_off2cells)(off_from, max_off_from);
49354947 else
49364948 char_cells = 1;
49374949 #endif
@@ -5008,7 +5020,7 @@
50085020 * ScreenLinesUC[] is sufficient. */
50095021 if (char_cells == 1
50105022 && col + 1 < endcol
5011- && (*mb_off2cells)(off_to) > 1)
5023+ && (*mb_off2cells)(off_to, max_off_to) > 1)
50125024 {
50135025 /* Writing a single-cell character over a double-cell
50145026 * character: need to redraw the next cell. */
@@ -5017,8 +5029,8 @@
50175029 }
50185030 else if (char_cells == 2
50195031 && col + 2 < endcol
5020- && (*mb_off2cells)(off_to) == 1
5021- && (*mb_off2cells)(off_to + 1) > 1)
5032+ && (*mb_off2cells)(off_to, max_off_to) == 1
5033+ && (*mb_off2cells)(off_to + 1, max_off_to) > 1)
50225034 {
50235035 /* Writing the second half of a double-cell character over
50245036 * a double-cell character: need to redraw the second
@@ -5037,10 +5049,10 @@
50375049 * char over the left halve of an existing one. */
50385050 if (has_mbyte && col + char_cells == endcol
50395051 && ((char_cells == 1
5040- && (*mb_off2cells)(off_to) > 1)
5052+ && (*mb_off2cells)(off_to, max_off_to) > 1)
50415053 || (char_cells == 2
5042- && (*mb_off2cells)(off_to) == 1
5043- && (*mb_off2cells)(off_to + 1) > 1)))
5054+ && (*mb_off2cells)(off_to, max_off_to) == 1
5055+ && (*mb_off2cells)(off_to + 1, max_off_to) > 1)))
50445056 clear_next = TRUE;
50455057 #endif
50465058
@@ -5180,10 +5192,11 @@
51805192 /* find previous character by counting from first
51815193 * column and get its width. */
51825194 unsigned off = LineOffset[row];
5195+ unsigned max_off = LineOffset[row] + screen_Columns;
51835196
51845197 while (off < off_to)
51855198 {
5186- prev_cells = (*mb_off2cells)(off);
5199+ prev_cells = (*mb_off2cells)(off, max_off);
51875200 off += prev_cells;
51885201 }
51895202 }
@@ -5369,7 +5382,7 @@
53695382 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s));
53705383
53715384 /*
5372- * Get the lenght of an item as it will be shown in the status line.
5385+ * Get the length of an item as it will be shown in the status line.
53735386 */
53745387 static int
53755388 status_match_len(xp, s)
@@ -5435,7 +5448,7 @@
54355448 int row;
54365449 char_u *buf;
54375450 int len;
5438- int clen; /* lenght in screen cells */
5451+ int clen; /* length in screen cells */
54395452 int fillchar;
54405453 int attr;
54415454 int i;
@@ -6187,6 +6200,7 @@
61876200 char_u *ptr = text;
61886201 int c;
61896202 #ifdef FEAT_MBYTE
6203+ unsigned max_off;
61906204 int mbyte_blen = 1;
61916205 int mbyte_cells = 1;
61926206 int u8c = 0;
@@ -6203,6 +6217,9 @@
62036217 return;
62046218
62056219 off = LineOffset[row] + col;
6220+#ifdef FEAT_MBYTE
6221+ max_off = LineOffset[row] + screen_Columns;
6222+#endif
62066223 while (col < screen_Columns
62076224 && (len < 0 || (int)(ptr - text) < len)
62086225 && *ptr != NUL)
@@ -6326,19 +6343,19 @@
63266343 else if (has_mbyte
63276344 && (len < 0 ? ptr[mbyte_blen] == NUL
63286345 : ptr + mbyte_blen >= text + len)
6329- && ((mbyte_cells == 1 && (*mb_off2cells)(off) > 1)
6346+ && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
63306347 || (mbyte_cells == 2
6331- && (*mb_off2cells)(off) == 1
6332- && (*mb_off2cells)(off + 1) > 1)))
6348+ && (*mb_off2cells)(off, max_off) == 1
6349+ && (*mb_off2cells)(off + 1, max_off) > 1)))
63336350 clear_next_cell = TRUE;
63346351
63356352 /* Make sure we never leave a second byte of a double-byte behind,
63366353 * it confuses mb_off2cells(). */
63376354 if (enc_dbcs
6338- && ((mbyte_cells == 1 && (*mb_off2cells)(off) > 1)
6355+ && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
63396356 || (mbyte_cells == 2
6340- && (*mb_off2cells)(off) == 1
6341- && (*mb_off2cells)(off + 1) > 1)))
6357+ && (*mb_off2cells)(off, max_off) == 1
6358+ && (*mb_off2cells)(off + 1, max_off) > 1)))
63426359 ScreenLines[off + mbyte_blen] = 0;
63436360 #endif
63446361 ScreenLines[off] = c;
@@ -6924,6 +6941,9 @@
69246941 {
69256942 int r, c;
69266943 int off;
6944+#ifdef FEAT_MBYTE
6945+ int max_off;
6946+#endif
69276947
69286948 /* Can't use ScreenLines unless initialized */
69296949 if (ScreenLines == NULL)
@@ -6934,10 +6954,13 @@
69346954 for (r = row; r < row + height; ++r)
69356955 {
69366956 off = LineOffset[r];
6957+#ifdef FEAT_MBYTE
6958+ max_off = off + screen_Columns;
6959+#endif
69376960 for (c = col; c < col + width; ++c)
69386961 {
69396962 #ifdef FEAT_MBYTE
6940- if (enc_dbcs != 0 && dbcs_off2cells(off + c) > 1)
6963+ if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1)
69416964 {
69426965 screen_char_2(off + c, r, c);
69436966 ++c;
@@ -6947,7 +6970,7 @@
69476970 {
69486971 screen_char(off + c, r, c);
69496972 #ifdef FEAT_MBYTE
6950- if (utf_off2cells(off + c) > 1)
6973+ if (utf_off2cells(off + c, max_off) > 1)
69516974 ++c;
69526975 #endif
69536976 }
diff -r e2f5c1597829 -r a4365075d05c src/version.c
--- a/src/version.c Thu Aug 30 10:51:14 2007 +0000
+++ b/src/version.c Thu Aug 30 11:53:22 2007 +0000
@@ -667,6 +667,8 @@
667667 static int included_patches[] =
668668 { /* Add new patch number below this line */
669669 /**/
670+ 93,
671+/**/
670672 92,
671673 /**/
672674 91,
Show on old repository browser