From 80b3a3011b227709d20027cbc58b6f3b785c22df Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 31 Jan 2017 15:31:38 -0600
Subject: [PATCH] weeding: remove ensure_line_is_visible()

Since all lines can be partially scrolled off the screen now
(except for the top line of the edit window, which is forthcoming),
ensure_line_is_visible() is no longer needed.
---
 src/files.c |  2 --
 src/move.c  | 14 --------------
 src/nano.c  |  2 --
 src/proto.h |  1 -
 src/text.c  |  2 --
 5 files changed, 21 deletions(-)

diff --git a/src/files.c b/src/files.c
index 2498ca66..cfe43ab3 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1196,8 +1196,6 @@ void do_insertfile(void)
 		/* Update the cursor position to account for inserted lines. */
 		reset_cursor();
 
-		ensure_line_is_visible();
-
 		refresh_needed = TRUE;
 	    }
 
diff --git a/src/move.c b/src/move.c
index 178cd1b0..031bfe14 100644
--- a/src/move.c
+++ b/src/move.c
@@ -44,7 +44,6 @@ void do_last_line(void)
 
     /* Set the last line of the screen as the target for the cursor. */
     openfile->current_y = editwinrows - 1;
-    ensure_line_is_visible();
 
     refresh_needed = TRUE;
     focusing = FALSE;
@@ -341,19 +340,6 @@ void do_next_word_void(void)
     do_next_word(ISSET(WORD_BOUNDS), TRUE);
 }
 
-/* Make sure that the current line, when it is partially scrolled off the
- * screen in softwrap mode, is scrolled fully into view. */
-void ensure_line_is_visible(void)
-{
-#ifndef NANO_TINY
-    if (ISSET(SOFTWRAP) && strlenpt(openfile->current->data) / editwincols +
-				openfile->current_y >= editwinrows) {
-	adjust_viewport(ISSET(SMOOTH_SCROLL) ? FLOWING : CENTERING);
-	refresh_needed = TRUE;
-    }
-#endif
-}
-
 /* Move to the beginning of the current line (or softwrapped chunk).
  * If be_clever is TRUE, do a smart home when wanted and possible,
  * and do a dynamic home when in softwrap mode and it'spossible.
diff --git a/src/nano.c b/src/nano.c
index 4b8e7c45..2155d8ea 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1877,8 +1877,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
     }
 
 #ifndef NANO_TINY
-    ensure_line_is_visible();
-
     /* If the number of screen rows that a softwrapped line occupies
      * has changed, we need a full refresh. */
     if (ISSET(SOFTWRAP) && refresh_needed == FALSE)
diff --git a/src/proto.h b/src/proto.h
index 707e3d56..fb941491 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -383,7 +383,6 @@ void do_prev_word(bool allow_punct, bool allow_update);
 void do_prev_word_void(void);
 bool do_next_word(bool allow_punct, bool allow_update);
 void do_next_word_void(void);
-void ensure_line_is_visible(void);
 void do_home(bool be_clever);
 void do_home_void(void);
 void do_end(bool be_clever);
diff --git a/src/text.c b/src/text.c
index e4ac6916..8fde8815 100644
--- a/src/text.c
+++ b/src/text.c
@@ -179,8 +179,6 @@ void do_deletion(undo_type action)
 	return;
 
 #ifndef NANO_TINY
-    ensure_line_is_visible();
-
     /* If the number of screen rows that a softwrapped line occupies
      * has changed, we need a full refresh. */
     if (ISSET(SOFTWRAP) && refresh_needed == FALSE)
-- 
GitLab