aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Kuthe2023-02-02 18:04:41 +0000
committerGitHub2023-02-02 18:04:41 +0000
commit2949bb018c00e21d0465bab6970708407cc29ccd (patch)
tree61fba8d1e1420c2383749a88c422f28fa74d0ec6
parent6ed2348078a331bc2039a313bd7ad9f0bb1a00c2 (diff)
fix position translation at EOF with softwrap (#5786)
-rw-r--r--helix-term/src/ui/document.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs
index 66332410..56377d1e 100644
--- a/helix-term/src/ui/document.rs
+++ b/helix-term/src/ui/document.rs
@@ -207,16 +207,19 @@ pub fn render_text<'t>(
it
} else {
let mut last_pos = formatter.visual_pos();
- last_pos.col -= 1;
- // check if any positions translated on the fly (like cursor) are at the EOF
- translate_positions(
- char_pos + 1,
- first_visible_char_idx,
- translated_positions,
- text_fmt,
- renderer,
- last_pos,
- );
+ if last_pos.row >= row_off {
+ last_pos.col -= 1;
+ last_pos.row -= row_off;
+ // check if any positions translated on the fly (like cursor) are at the EOF
+ translate_positions(
+ char_pos + 1,
+ first_visible_char_idx,
+ translated_positions,
+ text_fmt,
+ renderer,
+ last_pos,
+ );
+ }
break;
};