diff src/move.c @ 25312:7a254d0705e2 v8.2.3193

patch 8.2.3193: screenpos() is wrong when 'display' is "lastline" Commit: https://github.com/vim/vim/commit/189663bdac1156237c49925f77bd197c1bdea12c Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 21 18:04:56 2021 +0200 patch 8.2.3193: screenpos() is wrong when 'display' is "lastline" Problem: screenpos() is wrong when the last line is partially visible and 'display' is "lastline". Solution: Also compute the position for a partially visible line. (closes #8599)
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Jul 2021 18:15:05 +0200
parents 406ab8d0bc0f
children e8e2c4d33b9b
line wrap: on
line diff
--- a/src/move.c
+++ b/src/move.c
@@ -1229,7 +1229,7 @@ textpos2screenpos(
     int		rowoff = 0;
     colnr_T	coloff = 0;
 
-    if (pos->lnum >= wp->w_topline && pos->lnum < wp->w_botline)
+    if (pos->lnum >= wp->w_topline && pos->lnum <= wp->w_botline)
     {
 	colnr_T off;
 	colnr_T col;
@@ -1256,11 +1256,11 @@ textpos2screenpos(
 	col -= wp->w_leftcol;
 	if (col >= wp->w_width)
 	    col = -1;
-	if (col >= 0)
+	if (col >= 0 && row + rowoff <= wp->w_height)
 	    coloff = col - scol + wp->w_wincol + 1;
 	else
-	    // character is left or right of the window
-	    row = scol = ccol = ecol = 0;
+	    // character is left, right or below of the window
+	    row = rowoff = scol = ccol = ecol = 0;
     }
     *rowp = W_WINROW(wp) + row + rowoff;
     *scolp = scol + coloff;