Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
76a960d7
Commit
76a960d7
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
screen: continue to function also in a terminal with very few lines
This fixes
https://savannah.gnu.org/bugs/?48787
.
parent
97eb0e51
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nano.c
+21
-12
src/nano.c
src/winio.c
+10
-2
src/winio.c
with
31 additions
and
14 deletions
+31
-14
src/nano.c
View file @
76a960d7
...
...
@@ -686,28 +686,37 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
free
(
targetname
);
}
#define TOP_ROWS (ISSET(MORE_SPACE) ? 1 : 2)
#define BOTTOM_ROWS (ISSET(NO_HELP) ? 1 : 3)
/* Initialize the three window portions nano uses. */
void
window_init
(
void
)
{
/* First delete existing windows, in case of resizing. */
delwin
(
topwin
);
topwin
=
NULL
;
delwin
(
edit
);
delwin
(
bottomwin
);
/* Compute how many lines the edit subwindow will have. */
editwinrows
=
LINES
-
TOP_ROWS
-
BOTTOM_ROWS
;
/* If the terminal is very flat, don't set up a titlebar. */
if
(
LINES
<
3
)
{
editwinrows
=
1
;
/* Set up two subwindows. If the terminal is just one line,
* edit window and statusbar window will cover each other. */
edit
=
newwin
(
1
,
COLS
,
0
,
0
);
bottomwin
=
newwin
(
1
,
COLS
,
LINES
-
1
,
0
);
}
else
{
int
toprows
=
(
ISSET
(
MORE_SPACE
)
?
1
:
(
LINES
<
6
)
?
1
:
2
);
int
bottomrows
=
(
ISSET
(
NO_HELP
)
?
1
:
(
LINES
<
5
)
?
1
:
3
);
editwinrows
=
LINES
-
toprows
-
bottomrows
;
/* If there is no room to show anything, give up. */
if
(
editwinrows
<=
0
)
die
(
_
(
"Window size is too small for nano...
\n
"
));
/* Set up the normal three subwindows. */
topwin
=
newwin
(
toprows
,
COLS
,
0
,
0
);
edit
=
newwin
(
editwinrows
,
COLS
,
toprows
,
0
);
bottomwin
=
newwin
(
bottomrows
,
COLS
,
toprows
+
editwinrows
,
0
);
}
/* Set up the windows. */
topwin
=
newwin
(
TOP_ROWS
,
COLS
,
0
,
0
);
edit
=
newwin
(
editwinrows
,
COLS
,
TOP_ROWS
,
0
);
bottomwin
=
newwin
(
BOTTOM_ROWS
,
COLS
,
TOP_ROWS
+
editwinrows
,
0
);
/* In case the terminal shrunk, make sure the status line is clear. */
blank_statusbar
();
wnoutrefresh
(
bottomwin
);
/* Turn the keypad on for the windows, if necessary. */
if
(
!
ISSET
(
REBIND_KEYPAD
))
{
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
76a960d7
...
...
@@ -1639,7 +1639,7 @@ void blank_statusbar(void)
* portion of the window. */
void
blank_bottombars
(
void
)
{
if
(
!
ISSET
(
NO_HELP
))
{
if
(
!
ISSET
(
NO_HELP
)
&&
LINES
>
4
)
{
blank_line
(
bottomwin
,
1
,
0
,
COLS
);
blank_line
(
bottomwin
,
2
,
0
,
COLS
);
}
...
...
@@ -1665,6 +1665,10 @@ void check_statusblank(void)
reset_cursor
();
wnoutrefresh
(
edit
);
}
/* If the subwindows overlap, make sure to show the edit window now. */
if
(
LINES
==
1
)
edit_refresh
();
}
/* Convert buf into a string that can be displayed on screen. The
...
...
@@ -1840,6 +1844,10 @@ void titlebar(const char *path)
char
*
fragment
;
/* The tail part of the pathname when dottified. */
/* If the screen is too small, there is no titlebar. */
if
(
topwin
==
NULL
)
return
;
assert
(
path
!=
NULL
||
openfile
->
filename
!=
NULL
);
wattron
(
topwin
,
interface_color_pair
[
TITLE_BAR
]);
...
...
@@ -2033,7 +2041,7 @@ void bottombars(int menu)
/* Set the global variable to the given menu. */
currmenu
=
menu
;
if
(
ISSET
(
NO_HELP
))
if
(
ISSET
(
NO_HELP
)
||
LINES
<
5
)
return
;
if
(
menu
==
MMAIN
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help