Skip to content
GitLab
Menu
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
c6615066
Commit
c6615066
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: use a separate function to ask ncurses for keycodes
parent
0dd2a552
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/global.c
+1
-4
src/global.c
src/nano.c
+17
-13
src/nano.c
with
18 additions
and
17 deletions
+18
-17
src/global.c
View file @
c6615066
...
...
@@ -47,10 +47,7 @@ message_type lastmessage = HUSH;
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
#ifndef NANO_TINY
int
controlleft
=
CONTROL_LEFT
;
int
controlright
=
CONTROL_RIGHT
;
int
controlup
=
CONTROL_UP
;
int
controldown
=
CONTROL_DOWN
;
int
controlleft
,
controlright
,
controlup
,
controldown
;
#endif
#ifndef DISABLE_WRAPJUSTIFY
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
c6615066
...
...
@@ -1535,6 +1535,19 @@ void terminal_init(void)
#endif
}
#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED)
/* Ask ncurses for a keycode, or assign a default one. */
int
get_keycode
(
const
char
*
keyname
,
const
int
standard
)
{
const
char
*
keyvalue
=
tigetstr
(
keyname
);
if
(
keyvalue
==
0
||
keyvalue
==
(
char
*
)
-
1
)
return
standard
;
else
return
key_defined
(
keyvalue
);
}
#endif
/* Say that an unbound key was struck, and if possible which one. */
void
unbound_key
(
int
code
)
{
...
...
@@ -2514,20 +2527,11 @@ int main(int argc, char **argv)
#endif
#if !defined(NANO_TINY) && defined(HAVE_KEY_DEFINED)
const
char
*
keyvalue
;
/* Ask ncurses for the key codes for Control+Left/Right/Up/Down. */
keyvalue
=
tigetstr
(
"kLFT5"
);
if
(
keyvalue
!=
0
&&
keyvalue
!=
(
char
*
)
-
1
)
controlleft
=
key_defined
(
keyvalue
);
keyvalue
=
tigetstr
(
"kRIT5"
);
if
(
keyvalue
!=
0
&&
keyvalue
!=
(
char
*
)
-
1
)
controlright
=
key_defined
(
keyvalue
);
keyvalue
=
tigetstr
(
"kUP5"
);
if
(
keyvalue
!=
0
&&
keyvalue
!=
(
char
*
)
-
1
)
controlup
=
key_defined
(
keyvalue
);
keyvalue
=
tigetstr
(
"kDN5"
);
if
(
keyvalue
!=
0
&&
keyvalue
!=
(
char
*
)
-
1
)
controldown
=
key_defined
(
keyvalue
);
controlleft
=
get_keycode
(
"kLFT5"
,
CONTROL_LEFT
);
controlright
=
get_keycode
(
"kRIT5"
,
CONTROL_RIGHT
);
controlup
=
get_keycode
(
"kUP5"
,
CONTROL_UP
);
controldown
=
get_keycode
(
"kDN5"
,
CONTROL_DOWN
);
#endif
#ifndef USE_SLANG
...
...
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