Mercurial > vim
comparison src/move.c @ 16042:7952be788a49 v8.1.1026
patch 8.1.1026: unused condition
commit https://github.com/vim/vim/commit/d00e024d9f2b631226c1dba83cb203739b0d02a3
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 20 21:42:20 2019 +0100
patch 8.1.1026: unused condition
Problem: Unused condition. (Coverity)
Solution: Remove the condition. Also remove unused #define.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 20 Mar 2019 21:45:04 +0100 |
parents | ad8b2c109b22 |
children | cd5c83115ec6 |
comparison
equal
deleted
inserted
replaced
16041:d9834cd3a8b8 | 16042:7952be788a49 |
---|---|
2572 else | 2572 else |
2573 *lp = loff2; /* 2 lines overlap */ | 2573 *lp = loff2; /* 2 lines overlap */ |
2574 return; | 2574 return; |
2575 } | 2575 } |
2576 | 2576 |
2577 /* #define KEEP_SCREEN_LINE */ | |
2578 /* | 2577 /* |
2579 * Scroll 'scroll' lines up or down. | 2578 * Scroll 'scroll' lines up or down. |
2580 */ | 2579 */ |
2581 void | 2580 void |
2582 halfpage(int flag, linenr_T Prenum) | 2581 halfpage(int flag, linenr_T Prenum) |
2626 ++curwin->w_topline; | 2625 ++curwin->w_topline; |
2627 #ifdef FEAT_DIFF | 2626 #ifdef FEAT_DIFF |
2628 curwin->w_topfill = diff_check_fill(curwin, curwin->w_topline); | 2627 curwin->w_topfill = diff_check_fill(curwin, curwin->w_topline); |
2629 #endif | 2628 #endif |
2630 | 2629 |
2631 #ifndef KEEP_SCREEN_LINE | |
2632 if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) | 2630 if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) |
2633 { | 2631 { |
2634 ++curwin->w_cursor.lnum; | 2632 ++curwin->w_cursor.lnum; |
2635 curwin->w_valid &= | 2633 curwin->w_valid &= |
2636 ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); | 2634 ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); |
2637 } | 2635 } |
2638 #endif | |
2639 } | 2636 } |
2640 curwin->w_valid &= ~(VALID_CROW|VALID_WROW); | 2637 curwin->w_valid &= ~(VALID_CROW|VALID_WROW); |
2641 scrolled += i; | 2638 scrolled += i; |
2642 | 2639 |
2643 /* | 2640 /* |
2664 room -= i; | 2661 room -= i; |
2665 } while (curwin->w_botline <= curbuf->b_ml.ml_line_count); | 2662 } while (curwin->w_botline <= curbuf->b_ml.ml_line_count); |
2666 } | 2663 } |
2667 } | 2664 } |
2668 | 2665 |
2669 #ifndef KEEP_SCREEN_LINE | |
2670 /* | 2666 /* |
2671 * When hit bottom of the file: move cursor down. | 2667 * When hit bottom of the file: move cursor down. |
2672 */ | 2668 */ |
2673 if (n > 0) | 2669 if (n > 0) |
2674 { | 2670 { |
2686 else | 2682 else |
2687 # endif | 2683 # endif |
2688 curwin->w_cursor.lnum += n; | 2684 curwin->w_cursor.lnum += n; |
2689 check_cursor_lnum(); | 2685 check_cursor_lnum(); |
2690 } | 2686 } |
2691 #else | |
2692 /* try to put the cursor in the same screen line */ | |
2693 while ((curwin->w_cursor.lnum < curwin->w_topline || scrolled > 0) | |
2694 && curwin->w_cursor.lnum < curwin->w_botline - 1) | |
2695 { | |
2696 scrolled -= plines(curwin->w_cursor.lnum); | |
2697 if (scrolled < 0 && curwin->w_cursor.lnum >= curwin->w_topline) | |
2698 break; | |
2699 # ifdef FEAT_FOLDING | |
2700 (void)hasFolding(curwin->w_cursor.lnum, NULL, | |
2701 &curwin->w_cursor.lnum); | |
2702 # endif | |
2703 ++curwin->w_cursor.lnum; | |
2704 } | |
2705 #endif | |
2706 } | 2687 } |
2707 else | 2688 else |
2708 { | 2689 { |
2709 /* | 2690 /* |
2710 * scroll the text down | 2691 * scroll the text down |
2713 { | 2694 { |
2714 #ifdef FEAT_DIFF | 2695 #ifdef FEAT_DIFF |
2715 if (curwin->w_topfill < diff_check_fill(curwin, curwin->w_topline)) | 2696 if (curwin->w_topfill < diff_check_fill(curwin, curwin->w_topline)) |
2716 { | 2697 { |
2717 i = 1; | 2698 i = 1; |
2718 if (--n < 0 && scrolled > 0) | 2699 --n; |
2719 break; | |
2720 ++curwin->w_topfill; | 2700 ++curwin->w_topfill; |
2721 } | 2701 } |
2722 else | 2702 else |
2723 #endif | 2703 #endif |
2724 { | 2704 { |
2735 #endif | 2715 #endif |
2736 } | 2716 } |
2737 curwin->w_valid &= ~(VALID_CROW|VALID_WROW| | 2717 curwin->w_valid &= ~(VALID_CROW|VALID_WROW| |
2738 VALID_BOTLINE|VALID_BOTLINE_AP); | 2718 VALID_BOTLINE|VALID_BOTLINE_AP); |
2739 scrolled += i; | 2719 scrolled += i; |
2740 #ifndef KEEP_SCREEN_LINE | |
2741 if (curwin->w_cursor.lnum > 1) | 2720 if (curwin->w_cursor.lnum > 1) |
2742 { | 2721 { |
2743 --curwin->w_cursor.lnum; | 2722 --curwin->w_cursor.lnum; |
2744 curwin->w_valid &= ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); | 2723 curwin->w_valid &= ~(VALID_VIRTCOL|VALID_CHEIGHT|VALID_WCOL); |
2745 } | 2724 } |
2746 #endif | 2725 } |
2747 } | 2726 |
2748 #ifndef KEEP_SCREEN_LINE | |
2749 /* | 2727 /* |
2750 * When hit top of the file: move cursor up. | 2728 * When hit top of the file: move cursor up. |
2751 */ | 2729 */ |
2752 if (n > 0) | 2730 if (n > 0) |
2753 { | 2731 { |
2766 } | 2744 } |
2767 else | 2745 else |
2768 # endif | 2746 # endif |
2769 curwin->w_cursor.lnum -= n; | 2747 curwin->w_cursor.lnum -= n; |
2770 } | 2748 } |
2771 #else | |
2772 /* try to put the cursor in the same screen line */ | |
2773 scrolled += n; /* move cursor when topline is 1 */ | |
2774 while (curwin->w_cursor.lnum > curwin->w_topline | |
2775 && (scrolled > 0 || curwin->w_cursor.lnum >= curwin->w_botline)) | |
2776 { | |
2777 scrolled -= plines(curwin->w_cursor.lnum - 1); | |
2778 if (scrolled < 0 && curwin->w_cursor.lnum < curwin->w_botline) | |
2779 break; | |
2780 --curwin->w_cursor.lnum; | |
2781 # ifdef FEAT_FOLDING | |
2782 foldAdjustCursor(); | |
2783 # endif | |
2784 } | |
2785 #endif | |
2786 } | 2749 } |
2787 # ifdef FEAT_FOLDING | 2750 # ifdef FEAT_FOLDING |
2788 /* Move cursor to first line of closed fold. */ | 2751 /* Move cursor to first line of closed fold. */ |
2789 foldAdjustCursor(); | 2752 foldAdjustCursor(); |
2790 # endif | 2753 # endif |