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
34a20f88
Commit
34a20f88
authored
9 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
prompt: properly save and restore the x position in the statusbar
This fixes
https://savannah.gnu.org/bugs/?47720
.
parent
6f185d30
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/nano.c
+3
-0
src/nano.c
src/prompt.c
+16
-15
src/prompt.c
src/proto.h
+1
-0
src/proto.h
with
20 additions
and
15 deletions
+20
-15
src/nano.c
View file @
34a20f88
...
...
@@ -2641,6 +2641,9 @@ int main(int argc, char **argv)
if
(
ISSET
(
CONST_UPDATE
)
&&
get_key_buffer_len
()
==
0
)
do_cursorpos
(
TRUE
);
/* Forget any earlier statusbar x position. */
reinit_statusbar_x
();
/* Place the cursor in the edit window and make it visible. */
reset_cursor
();
curs_set
(
1
);
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
34a20f88
...
...
@@ -32,10 +32,6 @@ static size_t statusbar_x = (size_t)-1;
/* The cursor position in answer. */
static
size_t
statusbar_pww
=
(
size_t
)
-
1
;
/* The place we want in answer. */
static
size_t
old_statusbar_x
=
(
size_t
)
-
1
;
/* The old cursor position in answer, if any. */
static
size_t
old_pww
=
(
size_t
)
-
1
;
/* The old place we want in answer, if any. */
/* Read in a character, interpret it as a shortcut or toggle if
* necessary, and return it.
...
...
@@ -466,6 +462,13 @@ size_t get_statusbar_page_start(size_t start_col, size_t column)
start_col
-
1
);
}
/* Reinitialize the cursor position in the status bar prompt. */
void
reinit_statusbar_x
(
void
)
{
statusbar_x
=
(
size_t
)
-
1
;
statusbar_pww
=
(
size_t
)
-
1
;
}
/* Put the cursor in the statusbar prompt at statusbar_x. */
void
reset_statusbar_cursor
(
void
)
{
...
...
@@ -703,13 +706,6 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
}
#endif
/* If we're done with this prompt, restore the cursor position
* to what it was at the /previous/ prompt, in case there was. */
if
(
func
==
do_cancel
||
func
==
do_enter
)
{
statusbar_x
=
old_statusbar_x
;
statusbar_pww
=
old_pww
;
}
*
actual
=
kbinput
;
return
func
;
...
...
@@ -742,6 +738,9 @@ int do_prompt(bool allow_tabs,
#ifndef DISABLE_TABCOMP
bool
listed
=
FALSE
;
#endif
/* Save a possible current statusbar x position. */
size_t
was_statusbar_x
=
statusbar_x
;
size_t
was_pww
=
statusbar_pww
;
prompt
=
charalloc
(((
COLS
-
4
)
*
mb_cur_max
())
+
1
);
...
...
@@ -765,10 +764,12 @@ int do_prompt(bool allow_tabs,
free
(
prompt
);
prompt
=
NULL
;
/* We're done with the prompt, so save the statusbar cursor
* position. */
old_statusbar_x
=
statusbar_x
;
old_pww
=
statusbar_pww
;
/* If we're done with this prompt, restore the x position to what
* it was at a possible previous prompt. */
if
(
func
==
do_cancel
||
func
==
do_enter
)
{
statusbar_x
=
was_statusbar_x
;
statusbar_pww
=
was_pww
;
}
/* If we left the prompt via Cancel or Enter, set the return value
* properly. */
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
34a20f88
...
...
@@ -526,6 +526,7 @@ void do_statusbar_next_word(void);
void
do_statusbar_verbatim_input
(
bool
*
got_enter
);
size_t
statusbar_xplustabs
(
void
);
size_t
get_statusbar_page_start
(
size_t
start_col
,
size_t
column
);
void
reinit_statusbar_x
(
void
);
void
reset_statusbar_cursor
(
void
);
void
update_the_statusbar
(
void
);
void
update_bar_if_needed
(
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