Mercurial > vim
comparison src/screen.c @ 1843:823e9ddf23f7 v7.2.141
updated for version 7.2-141
author | vimboss |
---|---|
date | Wed, 11 Mar 2009 16:58:40 +0000 |
parents | c1709e3f8536 |
children | 11a74d2cab9d |
comparison
equal
deleted
inserted
replaced
1842:c1709e3f8536 | 1843:823e9ddf23f7 |
---|---|
5130 if (char_cells == 2) | 5130 if (char_cells == 2) |
5131 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; | 5131 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; |
5132 #endif | 5132 #endif |
5133 | 5133 |
5134 #if defined(FEAT_GUI) || defined(UNIX) | 5134 #if defined(FEAT_GUI) || defined(UNIX) |
5135 /* The bold trick makes a single row of pixels appear in the next | 5135 /* The bold trick makes a single column of pixels appear in the |
5136 * character. When a bold character is removed, the next | 5136 * next character. When a bold character is removed, the next |
5137 * character should be redrawn too. This happens for our own GUI | 5137 * character should be redrawn too. This happens for our own GUI |
5138 * and for some xterms. */ | 5138 * and for some xterms. */ |
5139 if ( | 5139 if ( |
5140 # ifdef FEAT_GUI | 5140 # ifdef FEAT_GUI |
5141 gui.in_use | 5141 gui.in_use |
6274 int prev_c = 0; /* previous Arabic character */ | 6274 int prev_c = 0; /* previous Arabic character */ |
6275 int pc, nc, nc1; | 6275 int pc, nc, nc1; |
6276 int pcc[MAX_MCO]; | 6276 int pcc[MAX_MCO]; |
6277 # endif | 6277 # endif |
6278 #endif | 6278 #endif |
6279 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) | |
6280 int force_redraw_this; | |
6281 int force_redraw_next = FALSE; | |
6282 #endif | |
6283 int need_redraw; | |
6279 | 6284 |
6280 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ | 6285 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ |
6281 return; | 6286 return; |
6287 off = LineOffset[row] + col; | |
6282 | 6288 |
6283 #ifdef FEAT_MBYTE | 6289 #ifdef FEAT_MBYTE |
6284 /* When drawing over the right halve of a double-wide char clear out the | 6290 /* When drawing over the right halve of a double-wide char clear out the |
6285 * left halve. Only needed in a terminal. */ | 6291 * left halve. Only needed in a terminal. */ |
6286 if (has_mbyte && col > 0 && col < screen_Columns | 6292 if (has_mbyte && col > 0 && col < screen_Columns |
6287 # ifdef FEAT_GUI | 6293 # ifdef FEAT_GUI |
6288 && !gui.in_use | 6294 && !gui.in_use |
6289 # endif | 6295 # endif |
6290 && mb_fix_col(col, row) != col) | 6296 && mb_fix_col(col, row) != col) |
6291 screen_puts_len((char_u *)" ", 1, row, col - 1, 0); | 6297 { |
6292 #endif | 6298 ScreenLines[off - 1] = ' '; |
6293 | 6299 ScreenAttrs[off - 1] = 0; |
6294 off = LineOffset[row] + col; | 6300 if (enc_utf8) |
6301 { | |
6302 ScreenLinesUC[off - 1] = 0; | |
6303 ScreenLinesC[0][off - 1] = 0; | |
6304 } | |
6305 /* redraw the previous cell, make it empty */ | |
6306 screen_char(off - 1, row, col - 1); | |
6307 /* force the cell at "col" to be redrawn */ | |
6308 force_redraw_next = TRUE; | |
6309 } | |
6310 #endif | |
6311 | |
6295 #ifdef FEAT_MBYTE | 6312 #ifdef FEAT_MBYTE |
6296 max_off = LineOffset[row] + screen_Columns; | 6313 max_off = LineOffset[row] + screen_Columns; |
6297 #endif | 6314 #endif |
6298 while (col < screen_Columns | 6315 while (col < screen_Columns |
6299 && (len < 0 || (int)(ptr - text) < len) | 6316 && (len < 0 || (int)(ptr - text) < len) |
6353 # endif | 6370 # endif |
6354 } | 6371 } |
6355 } | 6372 } |
6356 #endif | 6373 #endif |
6357 | 6374 |
6358 if (ScreenLines[off] != c | 6375 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) |
6376 force_redraw_this = force_redraw_next; | |
6377 force_redraw_next = FALSE; | |
6378 #endif | |
6379 | |
6380 need_redraw = ScreenLines[off] != c | |
6359 #ifdef FEAT_MBYTE | 6381 #ifdef FEAT_MBYTE |
6360 || (mbyte_cells == 2 | 6382 || (mbyte_cells == 2 |
6361 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) | 6383 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) |
6362 || (enc_dbcs == DBCS_JPNU | 6384 || (enc_dbcs == DBCS_JPNU |
6363 && c == 0x8e | 6385 && c == 0x8e |
6365 || (enc_utf8 | 6387 || (enc_utf8 |
6366 && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0) | 6388 && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0) |
6367 || screen_comp_differs(off, u8cc))) | 6389 || screen_comp_differs(off, u8cc))) |
6368 #endif | 6390 #endif |
6369 || ScreenAttrs[off] != attr | 6391 || ScreenAttrs[off] != attr |
6370 || exmode_active | 6392 || exmode_active; |
6393 | |
6394 if (need_redraw | |
6395 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) | |
6396 || force_redraw_this | |
6397 #endif | |
6371 ) | 6398 ) |
6372 { | 6399 { |
6373 #if defined(FEAT_GUI) || defined(UNIX) | 6400 #if defined(FEAT_GUI) || defined(UNIX) |
6374 /* The bold trick makes a single row of pixels appear in the next | 6401 /* The bold trick makes a single row of pixels appear in the next |
6375 * character. When a bold character is removed, the next | 6402 * character. When a bold character is removed, the next |
6376 * character should be redrawn too. This happens for our own GUI | 6403 * character should be redrawn too. This happens for our own GUI |
6377 * and for some xterms. | 6404 * and for some xterms. */ |
6378 * Force the redraw by setting the attribute to a different value | 6405 if (need_redraw && ScreenLines[off] != ' ' && ( |
6379 * than "attr", the contents of ScreenLines[] may be needed by | |
6380 * mb_off2cells() further on. | |
6381 * Don't do this for the last drawn character, because the next | |
6382 * character may not be redrawn. */ | |
6383 if ( | |
6384 # ifdef FEAT_GUI | 6406 # ifdef FEAT_GUI |
6385 gui.in_use | 6407 gui.in_use |
6386 # endif | 6408 # endif |
6387 # if defined(FEAT_GUI) && defined(UNIX) | 6409 # if defined(FEAT_GUI) && defined(UNIX) |
6388 || | 6410 || |
6389 # endif | 6411 # endif |
6390 # ifdef UNIX | 6412 # ifdef UNIX |
6391 term_is_xterm | 6413 term_is_xterm |
6392 # endif | 6414 # endif |
6393 ) | 6415 )) |
6394 { | 6416 { |
6395 int n; | 6417 int n = ScreenAttrs[off]; |
6396 | 6418 |
6397 n = ScreenAttrs[off]; | 6419 if (n > HL_ALL) |
6398 # ifdef FEAT_MBYTE | 6420 n = syn_attr2attr(n); |
6399 if (col + mbyte_cells < screen_Columns | 6421 if (n & HL_BOLD) |
6400 && (n > HL_ALL || (n & HL_BOLD)) | 6422 force_redraw_next = TRUE; |
6401 && (len < 0 ? ptr[mbyte_blen] != NUL | |
6402 : ptr + mbyte_blen < text + len)) | |
6403 ScreenAttrs[off + mbyte_cells] = attr + 1; | |
6404 # else | |
6405 if (col + 1 < screen_Columns | |
6406 && (n > HL_ALL || (n & HL_BOLD)) | |
6407 && (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len)) | |
6408 ScreenLines[off + 1] = 0; | |
6409 # endif | |
6410 } | 6423 } |
6411 #endif | 6424 #endif |
6412 #ifdef FEAT_MBYTE | 6425 #ifdef FEAT_MBYTE |
6413 /* When at the end of the text and overwriting a two-cell | 6426 /* When at the end of the text and overwriting a two-cell |
6414 * character with a one-cell character, need to clear the next | 6427 * character with a one-cell character, need to clear the next |
6491 ++off; | 6504 ++off; |
6492 ++col; | 6505 ++col; |
6493 ++ptr; | 6506 ++ptr; |
6494 } | 6507 } |
6495 } | 6508 } |
6509 | |
6510 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) | |
6511 /* If we detected the next character needs to be redrawn, but the text | |
6512 * doesn't extend up to there, update the character here. */ | |
6513 if (force_redraw_next && col < screen_Columns) | |
6514 { | |
6515 # ifdef FEAT_MBYTE | |
6516 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) | |
6517 screen_char_2(off, row, col); | |
6518 else | |
6519 # endif | |
6520 screen_char(off, row, col); | |
6521 } | |
6522 #endif | |
6496 } | 6523 } |
6497 | 6524 |
6498 #ifdef FEAT_SEARCH_EXTRA | 6525 #ifdef FEAT_SEARCH_EXTRA |
6499 /* | 6526 /* |
6500 * Prepare for 'hlsearch' highlighting. | 6527 * Prepare for 'hlsearch' highlighting. |