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
953fbf8e
Commit
953fbf8e
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide a function that is used just once
And in the bargain avoid a duplicate call of strlenpt(prompt).
parent
3dc6ccbe
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/prompt.c
+13
-22
src/prompt.c
with
13 additions
and
22 deletions
+13
-22
src/prompt.c
View file @
953fbf8e
...
...
@@ -383,35 +383,18 @@ void reinit_statusbar_x(void)
statusbar_x
=
HIGHEST_POSITIVE
;
}
/* Put the cursor in the answer at statusbar_x. */
void
reset_statusbar_cursor
(
void
)
{
size_t
start_col
=
strlenpt
(
prompt
)
+
2
;
size_t
xpt
=
statusbar_xplustabs
();
/* Work around a cursor-misplacement bug in VTEs. */
wmove
(
bottomwin
,
0
,
0
);
wnoutrefresh
(
bottomwin
);
doupdate
();
wmove
(
bottomwin
,
0
,
start_col
+
xpt
-
get_statusbar_page_start
(
start_col
,
start_col
+
xpt
));
wnoutrefresh
(
bottomwin
);
}
/* Repaint the statusbar. */
/* Redraw the promptbar and place the cursor at the right spot. */
void
update_the_statusbar
(
void
)
{
size_t
base
,
the_page
,
end_page
;
size_t
base
=
strlenpt
(
prompt
)
+
2
;
size_t
the_page
,
end_page
,
column
;
char
*
expanded
;
base
=
strlenpt
(
prompt
)
+
2
;
the_page
=
get_statusbar_page_start
(
base
,
base
+
strnlenpt
(
answer
,
statusbar_x
));
end_page
=
get_statusbar_page_start
(
base
,
base
+
strlenpt
(
answer
)
-
1
);
/* Color the promptbar over its full width. */
wattron
(
bottomwin
,
interface_color_pair
[
TITLE_BAR
]);
blank_statusbar
();
mvwaddstr
(
bottomwin
,
0
,
0
,
prompt
);
...
...
@@ -426,7 +409,15 @@ void update_the_statusbar(void)
wattroff
(
bottomwin
,
interface_color_pair
[
TITLE_BAR
]);
reset_statusbar_cursor
();
/* Work around a cursor-misplacement bug in VTEs. */
wmove
(
bottomwin
,
0
,
0
);
wnoutrefresh
(
bottomwin
);
doupdate
();
/* Place the cursor at statusbar_x in the answer. */
column
=
base
+
statusbar_xplustabs
();
wmove
(
bottomwin
,
0
,
column
-
get_statusbar_page_start
(
base
,
column
));
wnoutrefresh
(
bottomwin
);
}
/* Get a string of input at the statusbar prompt. */
...
...
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