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
c74d2632
Commit
c74d2632
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: make the switching on and off of the cursor a bit more compact
parent
ae34825f
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
src/browser.c
+1
-4
src/browser.c
src/global.c
+0
-2
src/global.c
src/help.c
+4
-6
src/help.c
src/nano.c
+3
-7
src/nano.c
src/nano.h
+3
-0
src/nano.h
src/prompt.c
+5
-12
src/prompt.c
src/proto.h
+1
-2
src/proto.h
src/text.c
+2
-4
src/text.c
src/winio.c
+7
-1
src/winio.c
with
26 additions
and
38 deletions
+26
-38
src/browser.c
View file @
c74d2632
...
...
@@ -55,9 +55,6 @@ char *do_browser(char *path)
DIR
*
dir
;
/* The directory whose contents we are showing. */
/* Show a cursor in the file list only when requested. */
reveal_cursor
=
ISSET
(
SHOW_CURSOR
);
read_directory_contents:
/* We come here when we refresh or select a new directory. */
...
...
@@ -117,7 +114,7 @@ char *do_browser(char *path)
old_selected
=
selected
;
kbinput
=
get_kbinput
(
edit
);
kbinput
=
get_kbinput
(
edit
,
ISSET
(
SHOW_CURSOR
)
);
#ifdef ENABLE_MOUSE
if
(
kbinput
==
KEY_MOUSE
)
{
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
c74d2632
...
...
@@ -56,8 +56,6 @@ bool have_palette = FALSE;
/* Whether the colors for the current syntax have been initialized. */
#endif
bool
reveal_cursor
=
FALSE
;
/* Whether the cursor should be shown when waiting for input. */
bool
suppress_cursorpos
=
FALSE
;
/* Should we skip constant position display for current keystroke? */
...
...
This diff is collapsed.
Click to expand it.
src/help.c
View file @
c74d2632
...
...
@@ -158,10 +158,10 @@ void do_help(void)
help_init
();
inhelp
=
TRUE
;
location
=
0
;
didfind
=
0
;
bottombars
(
MHELP
);
wnoutrefresh
(
bottomwin
);
reveal_cursor
=
FALSE
;
/* Extract the title from the head of the help text. */
length
=
break_line
(
help_text
,
MAX_BUF_SIZE
,
TRUE
);
...
...
@@ -182,9 +182,10 @@ void do_help(void)
while
(
TRUE
)
{
lastmessage
=
HUSH
;
focusing
=
TRUE
;
didfind
=
0
;
kbinput
=
get_kbinput
(
edit
);
/* Show the cursor when we searched and found something. */
kbinput
=
get_kbinput
(
edit
,
didfind
==
1
);
didfind
=
0
;
func
=
parse_help_input
(
&
kbinput
);
...
...
@@ -230,9 +231,6 @@ void do_help(void)
}
else
unbound_key
(
kbinput
);
/* If we searched and found something, let the cursor show it. */
reveal_cursor
=
(
didfind
==
1
);
currmenu
=
MHELP
;
edit_refresh
();
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
c74d2632
...
...
@@ -1579,12 +1579,8 @@ int do_input(bool allow_funcs)
const
sc
*
s
;
bool
have_shortcut
;
reveal_cursor
=
TRUE
;
/* Read in a keystroke. */
input
=
get_kbinput
(
edit
);
reveal_cursor
=
FALSE
;
/* Read in a keystroke, and show the cursor while waiting. */
input
=
get_kbinput
(
edit
,
VISIBLE
);
#ifndef NANO_TINY
if
(
input
==
KEY_WINCH
)
...
...
@@ -1597,7 +1593,7 @@ int do_input(bool allow_funcs)
if
(
do_mouse
()
==
1
)
/* The click was on a shortcut -- read in the character
* that it was converted into. */
input
=
get_kbinput
(
edit
);
input
=
get_kbinput
(
edit
,
BLIND
);
else
/* The click was invalid or has been handled -- get out. */
return
ERR
;
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
c74d2632
...
...
@@ -135,6 +135,9 @@
#define BACKWARD FALSE
#define FORWARD TRUE
#define BLIND FALSE
#define VISIBLE TRUE
/* Enumeration types. */
typedef
enum
{
NIX_FILE
,
DOS_FILE
,
MAC_FILE
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
c74d2632
...
...
@@ -48,7 +48,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
*
finished
=
FALSE
;
/* Read in a character. */
input
=
get_kbinput
(
bottomwin
);
input
=
get_kbinput
(
bottomwin
,
VISIBLE
);
#ifndef NANO_TINY
if
(
input
==
KEY_WINCH
)
...
...
@@ -60,7 +60,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
* shortcut character. */
if
(
input
==
KEY_MOUSE
)
{
if
(
do_statusbar_mouse
()
==
1
)
input
=
get_kbinput
(
bottomwin
);
input
=
get_kbinput
(
bottomwin
,
BLIND
);
else
return
ERR
;
}
...
...
@@ -477,9 +477,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
update_the_statusbar
();
while
(
TRUE
)
{
/* Ensure the cursor is shown when waiting for input. */
reveal_cursor
=
TRUE
;
kbinput
=
do_statusbar_input
(
&
ran_func
,
&
finished
);
#ifndef NANO_TINY
...
...
@@ -597,8 +594,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
}
#endif
reveal_cursor
=
FALSE
;
*
actual
=
kbinput
;
return
func
;
...
...
@@ -746,12 +741,10 @@ int do_yesno_prompt(bool all, const char *msg)
wattroff
(
bottomwin
,
interface_color_pair
[
TITLE_BAR
]);
wnoutrefresh
(
bottomwin
);
/* When not replacing, show the cursor. */
reveal_cursor
=
!
all
;
currmenu
=
MYESNO
;
kbinput
=
get_kbinput
(
bottomwin
);
/* When not replacing, show the cursor while waiting for a key. */
kbinput
=
get_kbinput
(
bottomwin
,
!
all
);
func
=
func_from_key
(
&
kbinput
);
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
c74d2632
...
...
@@ -47,7 +47,6 @@ extern int editwincols;
extern
bool
have_palette
;
#endif
extern
bool
reveal_cursor
;
extern
bool
suppress_cursorpos
;
extern
message_type
lastmessage
;
...
...
@@ -631,7 +630,7 @@ void dump_filestruct_reverse(void);
void
get_key_buffer
(
WINDOW
*
win
);
size_t
get_key_buffer_len
(
void
);
void
unget_kbinput
(
int
kbinput
,
bool
metakey
);
int
get_kbinput
(
WINDOW
*
win
);
int
get_kbinput
(
WINDOW
*
win
,
bool
showcursor
);
int
parse_kbinput
(
WINDOW
*
win
);
int
arrow_from_abcd
(
int
kbinput
);
int
parse_escape_sequence
(
WINDOW
*
win
,
int
kbinput
);
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
c74d2632
...
...
@@ -3334,12 +3334,11 @@ void do_linter(void)
bottombars
(
MLINTER
);
}
/* Place
and show
the cursor to indicate the affected line. */
/* Place the cursor to indicate the affected line. */
place_the_cursor
();
reveal_cursor
=
TRUE
;
wnoutrefresh
(
edit
);
kbinput
=
get_kbinput
(
bottomwin
);
kbinput
=
get_kbinput
(
bottomwin
,
VISIBLE
);
#ifndef NANO_TINY
if
(
kbinput
==
KEY_WINCH
)
...
...
@@ -3584,7 +3583,6 @@ void do_verbatim_input(void)
* inserted verbatim. */
statusbar
(
_
(
"Verbatim Input"
));
place_the_cursor
();
reveal_cursor
=
TRUE
;
/* Read in all the verbatim characters. */
kbinput
=
get_verbatim_kbinput
(
edit
,
&
kbinput_len
);
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
c74d2632
...
...
@@ -49,6 +49,8 @@ static int statusblank = 0;
static
bool
seen_wide
=
FALSE
;
/* Whether we've seen a multicolumn character in the current line. */
#endif
static
bool
reveal_cursor
=
FALSE
;
/* Whether the cursor should be shown when waiting for input. */
/* Control character compatibility:
*
...
...
@@ -290,10 +292,12 @@ int *get_input(WINDOW *win, size_t input_len)
}
/* Read in a single keystroke, ignoring any that are invalid. */
int
get_kbinput
(
WINDOW
*
win
)
int
get_kbinput
(
WINDOW
*
win
,
bool
showcursor
)
{
int
kbinput
=
ERR
;
reveal_cursor
=
showcursor
;
/* Extract one keystroke from the input stream. */
while
(
kbinput
==
ERR
)
kbinput
=
parse_kbinput
(
win
);
...
...
@@ -1529,6 +1533,8 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
{
int
*
kbinput
;
reveal_cursor
=
TRUE
;
/* Read in the first code. */
while
((
kbinput
=
get_input
(
win
,
1
))
==
NULL
)
;
...
...
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