nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/5] softwrap: renumber the chunks whenever the screen width may


From: Benno Schulenberg
Subject: [PATCH 5/5] softwrap: renumber the chunks whenever the screen width may have changed
Date: Sun, 31 May 2020 15:08:33 +0200

Showing the position indicator in softwrap mode depends on an accurate
numbering of the first chunk in each line, and these numbers can change
whenever the screen width changes or when lines increase or decrease in
size (like when indenting/unindenting or commenting/uncommenting).

Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
---
 src/files.c | 3 ---
 src/winio.c | 5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/files.c b/src/files.c
index 4e6c42db..b1674e95 100644
--- a/src/files.c
+++ b/src/files.c
@@ -527,9 +527,6 @@ void redecorate_after_switch(void)
         * or softwrap mode may have been toggled, so make sure that the
         * starting column for the first row gets an appropriate value. */
        ensure_firstcolumn_is_aligned();
-
-       if (ISSET(SOFTWRAP))
-               renumber_from(openfile->filetop);
 #endif
 
        /* Update title bar and multiline info to match the current buffer. */
diff --git a/src/winio.c b/src/winio.c
index 236166b1..30c0e493 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3156,10 +3156,11 @@ size_t leftedge_for(size_t column, linestruct *line)
  * has changed, because then the width of softwrapped chunks has changed. */
 void ensure_firstcolumn_is_aligned(void)
 {
-       if (ISSET(SOFTWRAP))
+       if (ISSET(SOFTWRAP)) {
                openfile->firstcolumn = leftedge_for(openfile->firstcolumn,
                                                                                
                                openfile->edittop);
-       else
+               renumber_from(openfile->filetop);
+       } else
                openfile->firstcolumn = 0;
 
        /* If smooth scrolling is on, make sure the viewport doesn't center. */
-- 
2.25.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]