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
df7353b3
Commit
df7353b3
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: compute the sizes of the subwindows in a more direct manner
parent
f311c0af
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
+7
-20
src/nano.c
src/proto.h
+0
-2
src/proto.h
with
7 additions
and
22 deletions
+7
-22
src/nano.c
View file @
df7353b3
...
...
@@ -689,11 +689,14 @@ void die_save_file(const char *die_filename
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
)
{
/* If the screen height is too small, get out. */
editwinrows
=
LINES
-
5
+
more_space
()
+
no_help
()
;
editwinrows
=
LINES
-
TOP_ROWS
-
BOTTOM_ROWS
;
if
(
COLS
<
MIN_EDITOR_COLS
||
editwinrows
<
MIN_EDITOR_ROWS
)
die
(
_
(
"Window size is too small for nano...
\n
"
));
...
...
@@ -714,10 +717,9 @@ void window_init(void)
delwin
(
bottomwin
);
/* Set up the windows. */
topwin
=
newwin
(
2
-
more_space
(),
COLS
,
0
,
0
);
edit
=
newwin
(
editwinrows
,
COLS
,
2
-
more_space
(),
0
);
bottomwin
=
newwin
(
3
-
no_help
(),
COLS
,
editwinrows
+
(
2
-
more_space
()),
0
);
topwin
=
newwin
(
TOP_ROWS
,
COLS
,
0
,
0
);
edit
=
newwin
(
editwinrows
,
COLS
,
TOP_ROWS
,
0
);
bottomwin
=
newwin
(
BOTTOM_ROWS
,
COLS
,
TOP_ROWS
+
editwinrows
,
0
);
/* Turn the keypad on for the windows, if necessary. */
if
(
!
ISSET
(
REBIND_KEYPAD
))
{
...
...
@@ -1043,21 +1045,6 @@ void version(void)
printf
(
"
\n
"
);
}
/* Return 1 if the MORE_SPACE flag is set, and 0 otherwise. This is
* used to calculate the sizes and Y coordinates of the subwindows. */
int
more_space
(
void
)
{
return
ISSET
(
MORE_SPACE
)
?
1
:
0
;
}
/* Return 2 if the NO_HELP flag is set, and 0 otherwise. This is used
* to calculate the sizes and Y coordinates of the subwindows, because
* having NO_HELP adds two lines to the edit window. */
int
no_help
(
void
)
{
return
ISSET
(
NO_HELP
)
?
2
:
0
;
}
/* Indicate that the current file has no name, in a way that gets the
* user's attention. This is used when trying to save a file with no
* name with the TEMP_FILE flag set, just before the filename prompt. */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
df7353b3
...
...
@@ -476,8 +476,6 @@ void print_opt_full(const char *shortflag
,
const
char
*
desc
);
void
usage
(
void
);
void
version
(
void
);
int
more_space
(
void
);
int
no_help
(
void
);
void
no_current_file_name_warning
(
void
);
void
do_exit
(
void
);
void
close_and_go
(
void
);
...
...
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