comparison src/move.c @ 12477:68d7bc045dbe v8.0.1118

patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs commit https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 16 20:54:51 2017 +0200 patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always enabled and only adds 7% to the binary size of the tiny build. Solution: Graduate FEAT_WINDOWS.
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Sep 2017 21:00:06 +0200
parents 69af108df70e
children 972ea22c946f
comparison
equal deleted inserted replaced
12476:2516383741e6 12477:68d7bc045dbe
980 { 980 {
981 /* No room for text, put cursor in last char of window. */ 981 /* No room for text, put cursor in last char of window. */
982 curwin->w_wcol = W_WIDTH(curwin) - 1; 982 curwin->w_wcol = W_WIDTH(curwin) - 1;
983 curwin->w_wrow = curwin->w_height - 1; 983 curwin->w_wrow = curwin->w_height - 1;
984 } 984 }
985 else if (curwin->w_p_wrap 985 else if (curwin->w_p_wrap && curwin->w_width != 0)
986 #ifdef FEAT_WINDOWS
987 && curwin->w_width != 0
988 #endif
989 )
990 { 986 {
991 width = textwidth + curwin_col_off2(); 987 width = textwidth + curwin_col_off2();
992 988
993 /* long line wrapping, adjust curwin->w_wrow */ 989 /* long line wrapping, adjust curwin->w_wrow */
994 if (curwin->w_wcol >= W_WIDTH(curwin)) 990 if (curwin->w_wcol >= W_WIDTH(curwin))
1087 (curwin, curwin->w_cursor.lnum, FALSE)) 1083 (curwin, curwin->w_cursor.lnum, FALSE))
1088 - 1 >= curwin->w_height)) 1084 - 1 >= curwin->w_height))
1089 && curwin->w_height != 0 1085 && curwin->w_height != 0
1090 && curwin->w_cursor.lnum == curwin->w_topline 1086 && curwin->w_cursor.lnum == curwin->w_topline
1091 && width > 0 1087 && width > 0
1092 #ifdef FEAT_WINDOWS 1088 && curwin->w_width != 0)
1093 && curwin->w_width != 0
1094 #endif
1095 )
1096 { 1089 {
1097 /* Cursor past end of screen. Happens with a single line that does 1090 /* Cursor past end of screen. Happens with a single line that does
1098 * not fit on screen. Find a skipcol to show the text around the 1091 * not fit on screen. Find a skipcol to show the text around the
1099 * cursor. Avoid scrolling all the time. compute value of "extra": 1092 * cursor. Avoid scrolling all the time. compute value of "extra":
1100 * 1: Less than "p_so" lines above 1093 * 1: Less than "p_so" lines above
1249 /* 1242 /*
1250 * Compute the row number of the last row of the cursor line 1243 * Compute the row number of the last row of the cursor line
1251 * and move the cursor onto the displayed part of the window. 1244 * and move the cursor onto the displayed part of the window.
1252 */ 1245 */
1253 wrow = curwin->w_wrow; 1246 wrow = curwin->w_wrow;
1254 if (curwin->w_p_wrap 1247 if (curwin->w_p_wrap && curwin->w_width != 0)
1255 #ifdef FEAT_WINDOWS
1256 && curwin->w_width != 0
1257 #endif
1258 )
1259 { 1248 {
1260 validate_virtcol(); 1249 validate_virtcol();
1261 validate_cheight(); 1250 validate_cheight();
1262 wrow += curwin->w_cline_height - 1 - 1251 wrow += curwin->w_cline_height - 1 -
1263 curwin->w_virtcol / W_WIDTH(curwin); 1252 curwin->w_virtcol / W_WIDTH(curwin);
1458 else 1447 else
1459 end_row += plines_nofill(curwin->w_topline - 1); 1448 end_row += plines_nofill(curwin->w_topline - 1);
1460 #else 1449 #else
1461 end_row += plines(curwin->w_topline - 1); 1450 end_row += plines(curwin->w_topline - 1);
1462 #endif 1451 #endif
1463 if (curwin->w_p_wrap 1452 if (curwin->w_p_wrap && curwin->w_width != 0)
1464 #ifdef FEAT_WINDOWS
1465 && curwin->w_width != 0
1466 #endif
1467 )
1468 { 1453 {
1469 validate_cheight(); 1454 validate_cheight();
1470 validate_virtcol(); 1455 validate_virtcol();
1471 end_row += curwin->w_cline_height - 1 - 1456 end_row += curwin->w_cline_height - 1 -
1472 curwin->w_virtcol / W_WIDTH(curwin); 1457 curwin->w_virtcol / W_WIDTH(curwin);
1522 start_row = curwin->w_wrow - plines_nofill(curwin->w_topline) 1507 start_row = curwin->w_wrow - plines_nofill(curwin->w_topline)
1523 - curwin->w_topfill; 1508 - curwin->w_topfill;
1524 #else 1509 #else
1525 start_row = curwin->w_wrow - plines(curwin->w_topline); 1510 start_row = curwin->w_wrow - plines(curwin->w_topline);
1526 #endif 1511 #endif
1527 if (curwin->w_p_wrap 1512 if (curwin->w_p_wrap && curwin->w_width != 0)
1528 #ifdef FEAT_WINDOWS
1529 && curwin->w_width != 0
1530 #endif
1531 )
1532 { 1513 {
1533 validate_virtcol(); 1514 validate_virtcol();
1534 start_row -= curwin->w_virtcol / W_WIDTH(curwin); 1515 start_row -= curwin->w_virtcol / W_WIDTH(curwin);
1535 } 1516 }
1536 if (start_row >= p_so) 1517 if (start_row >= p_so)
2853 redraw_later(VALID); 2834 redraw_later(VALID);
2854 2835
2855 /* Only scroll when 'scrollbind' hasn't done this. */ 2836 /* Only scroll when 'scrollbind' hasn't done this. */
2856 if (!curwin->w_p_scb) 2837 if (!curwin->w_p_scb)
2857 update_topline(); 2838 update_topline();
2858 # ifdef FEAT_WINDOWS
2859 curwin->w_redr_status = TRUE; 2839 curwin->w_redr_status = TRUE;
2860 # endif
2861 } 2840 }
2862 } 2841 }
2863 2842
2864 /* 2843 /*
2865 * reset current-window 2844 * reset current-window