vim-patch:8.1.1026: unused condition

Problem:    Unused condition. (Coverity)
Solution:   Remove the condition.  Also remove unused #define.
d00e024d9f
This commit is contained in:
Jan Edmund Lazo 2019-03-21 07:47:55 -04:00
parent 5c97bfb1e2
commit ea538f8799

View File

@ -2001,10 +2001,7 @@ static void get_scroll_overlap(lineoff_T *lp, int dir)
return; return;
} }
/* #define KEEP_SCREEN_LINE */ // Scroll 'scroll' lines up or down.
/*
* Scroll 'scroll' lines up or down.
*/
void halfpage(bool flag, linenr_T Prenum) void halfpage(bool flag, linenr_T Prenum)
{ {
long scrolled = 0; long scrolled = 0;
@ -2039,13 +2036,11 @@ void halfpage(bool flag, linenr_T Prenum)
++curwin->w_topline; ++curwin->w_topline;
curwin->w_topfill = diff_check_fill(curwin, curwin->w_topline); curwin->w_topfill = diff_check_fill(curwin, curwin->w_topline);
#ifndef KEEP_SCREEN_LINE
if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) {
++curwin->w_cursor.lnum; ++curwin->w_cursor.lnum;
curwin->w_valid &= curwin->w_valid &=
~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL);
} }
#endif
} }
curwin->w_valid &= ~(VALID_CROW|VALID_WROW); curwin->w_valid &= ~(VALID_CROW|VALID_WROW);
scrolled += i; scrolled += i;
@ -2070,10 +2065,7 @@ void halfpage(bool flag, linenr_T Prenum)
} }
} }
#ifndef KEEP_SCREEN_LINE // When hit bottom of the file: move cursor down.
/*
* When hit bottom of the file: move cursor down.
*/
if (n > 0) { if (n > 0) {
if (hasAnyFolding(curwin)) { if (hasAnyFolding(curwin)) {
while (--n >= 0 while (--n >= 0
@ -2086,18 +2078,6 @@ void halfpage(bool flag, linenr_T Prenum)
curwin->w_cursor.lnum += n; curwin->w_cursor.lnum += n;
check_cursor_lnum(); check_cursor_lnum();
} }
#else
/* try to put the cursor in the same screen line */
while ((curwin->w_cursor.lnum < curwin->w_topline || scrolled > 0)
&& curwin->w_cursor.lnum < curwin->w_botline - 1) {
scrolled -= plines(curwin->w_cursor.lnum);
if (scrolled < 0 && curwin->w_cursor.lnum >= curwin->w_topline)
break;
(void)hasFolding(curwin->w_cursor.lnum, NULL,
&curwin->w_cursor.lnum);
++curwin->w_cursor.lnum;
}
#endif
} else { } else {
/* /*
* scroll the text down * scroll the text down
@ -2119,17 +2099,13 @@ void halfpage(bool flag, linenr_T Prenum)
curwin->w_valid &= ~(VALID_CROW|VALID_WROW| curwin->w_valid &= ~(VALID_CROW|VALID_WROW|
VALID_BOTLINE|VALID_BOTLINE_AP); VALID_BOTLINE|VALID_BOTLINE_AP);
scrolled += i; scrolled += i;
#ifndef KEEP_SCREEN_LINE
if (curwin->w_cursor.lnum > 1) { if (curwin->w_cursor.lnum > 1) {
--curwin->w_cursor.lnum; --curwin->w_cursor.lnum;
curwin->w_valid &= ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); curwin->w_valid &= ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL);
} }
#endif
} }
#ifndef KEEP_SCREEN_LINE
/* // When hit top of the file: move cursor up.
* When hit top of the file: move cursor up.
*/
if (n > 0) { if (n > 0) {
if (curwin->w_cursor.lnum <= (linenr_T)n) if (curwin->w_cursor.lnum <= (linenr_T)n)
curwin->w_cursor.lnum = 1; curwin->w_cursor.lnum = 1;
@ -2142,18 +2118,6 @@ void halfpage(bool flag, linenr_T Prenum)
} else } else
curwin->w_cursor.lnum -= n; curwin->w_cursor.lnum -= n;
} }
#else
/* try to put the cursor in the same screen line */
scrolled += n; /* move cursor when topline is 1 */
while (curwin->w_cursor.lnum > curwin->w_topline
&& (scrolled > 0 || curwin->w_cursor.lnum >= curwin->w_botline)) {
scrolled -= plines(curwin->w_cursor.lnum - 1);
if (scrolled < 0 && curwin->w_cursor.lnum < curwin->w_botline)
break;
--curwin->w_cursor.lnum;
foldAdjustCursor();
}
#endif
} }
/* Move cursor to first line of closed fold. */ /* Move cursor to first line of closed fold. */
foldAdjustCursor(); foldAdjustCursor();