[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 1/2] tweaks: reshuffle some stuff in a more logical
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH 1/2] tweaks: reshuffle some stuff in a more logical order |
Date: |
Mon, 15 Aug 2016 19:49:09 +0200 |
---
src/nano.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/nano.c b/src/nano.c
index 8458a47..b9f00c9 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -692,6 +692,11 @@ void die_save_file(const char *die_filename, struct stat
*die_stat)
/* Initialize the three window portions nano uses. */
void window_init(void)
{
+ /* First delete existing windows, in case of resizing. */
+ delwin(topwin);
+ delwin(edit);
+ delwin(bottomwin);
+
/* Compute how many lines the edit subwindow will have. */
editwinrows = LINES - TOP_ROWS - BOTTOM_ROWS;
@@ -699,22 +704,6 @@ void window_init(void)
if (editwinrows <= 0)
die(_("Window size is too small for nano...\n"));
-#ifndef DISABLE_WRAPJUSTIFY
- /* Set up fill, based on the screen width. */
- fill = wrap_at;
- if (fill <= 0)
- fill += COLS;
- if (fill < 0)
- fill = 0;
-#endif
-
- if (topwin != NULL)
- delwin(topwin);
- if (edit != NULL)
- delwin(edit);
- if (bottomwin != NULL)
- delwin(bottomwin);
-
/* Set up the windows. */
topwin = newwin(TOP_ROWS, COLS, 0, 0);
edit = newwin(editwinrows, COLS, TOP_ROWS, 0);
@@ -726,6 +715,15 @@ void window_init(void)
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
}
+
+#ifndef DISABLE_WRAPJUSTIFY
+ /* Set up the wrapping point, accounting for screen width when negative. */
+ fill = wrap_at;
+ if (fill <= 0)
+ fill += COLS;
+ if (fill < 0)
+ fill = 0;
+#endif
}
#ifndef DISABLE_MOUSE
--
2.9.2
- [Nano-devel] [PATCH 1/2] tweaks: reshuffle some stuff in a more logical order,
Benno Schulenberg <=