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
90a90365
Commit
90a90365
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename three constants, for clarity, and hardcode two others
parent
9cd30d49
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/chars.c
+1
-1
src/chars.c
src/global.c
+1
-1
src/global.c
src/nano.h
+4
-6
src/nano.h
src/prompt.c
+1
-1
src/prompt.c
src/winio.c
+9
-9
src/winio.c
with
16 additions
and
18 deletions
+16
-18
src/chars.c
View file @
90a90365
...
...
@@ -219,7 +219,7 @@ char control_rep(const signed char c)
/* An embedded newline is an encoded null. */
if
(
c
==
'\n'
)
return
'@'
;
else
if
(
c
==
NANO_CONTROL_8
)
else
if
(
c
==
DEL_CODE
)
return
'?'
;
else
if
(
c
==
-
97
)
return
'='
;
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
90a90365
...
...
@@ -433,7 +433,7 @@ void assign_keyinfo(sc *s, const char *keystring)
* but the exact integer values of ^I and ^M. Rebinding the
* latter therefore also rebinds Tab and Enter. */
else
if
(
!
strcasecmp
(
keystring
,
"Tab"
))
s
->
keycode
=
NANO_CONTROL_I
;
s
->
keycode
=
TAB_CODE
;
else
if
(
!
strcasecmp
(
keystring
,
"Enter"
))
s
->
keycode
=
KEY_ENTER
;
else
if
(
!
strcasecmp
(
keystring
,
"PgUp"
))
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
90a90365
...
...
@@ -550,12 +550,10 @@ enum
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
/* Control key sequences. Changing these would be very, very bad. */
#define NANO_CONTROL_SPACE 0
#define NANO_CONTROL_I 9
#define NANO_CONTROL_3 27
#define NANO_CONTROL_7 31
#define NANO_CONTROL_8 127
/* Basic control codes. */
#define TAB_CODE 0x09
#define ESC_CODE 0x1B
#define DEL_CODE 0x7F
/* Codes for "modified" Arrow keys, beyond KEY_MAX of ncurses. */
#define CONTROL_LEFT 0x401
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
90a90365
...
...
@@ -586,7 +586,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
if
(
func
==
do_tab
)
{
#ifndef DISABLE_HISTORIES
if
(
history_list
!=
NULL
)
{
if
(
last_kbinput
!=
sc_seq_or
(
do_tab
,
NANO_CONTROL_I
))
if
(
last_kbinput
!=
sc_seq_or
(
do_tab
,
TAB_CODE
))
complete_len
=
strlen
(
answer
);
if
(
complete_len
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
90a90365
...
...
@@ -73,8 +73,8 @@ bool the_window_resized(void)
* - Ctrl-M is Enter under ASCII, ANSI, VT100, VT220, and VT320.
* - Ctrl-Q is XON under ASCII, ANSI, VT100, VT220, and VT320.
* - Ctrl-S is XOFF under ASCII, ANSI, VT100, VT220, and VT320.
* - Ctrl-8 (Ctrl-?
, NANO_CONTROL_8
) is Delete under ASCII, ANSI,
*
VT100, and VT220,
but is Backspace under VT320.
* - Ctrl-8 (Ctrl-?) is Delete under ASCII, ANSI,
VT100, and VT220,
* but is Backspace under VT320.
*
* Note: VT220 and VT320 also generate Esc [ 3 ~ for Delete. By
* default, xterm assumes it's running on a VT320 and generates Ctrl-8
...
...
@@ -255,7 +255,7 @@ void unget_kbinput(int kbinput, bool metakey)
unget_input
(
&
kbinput
,
1
);
if
(
metakey
)
{
kbinput
=
NANO_CONTROL_3
;
kbinput
=
ESC_CODE
;
unget_input
(
&
kbinput
,
1
);
}
}
...
...
@@ -361,7 +361,7 @@ int parse_kbinput(WINDOW *win)
if
(
keycode
==
ERR
)
return
ERR
;
if
(
keycode
==
NANO_CONTROL_3
)
{
if
(
keycode
==
ESC_CODE
)
{
/* Increment the escape counter. */
escapes
++
;
/* If there are four consecutive escapes, discard three of them. */
...
...
@@ -380,7 +380,7 @@ int parse_kbinput(WINDOW *win)
/* Reset the escape counter. */
escapes
=
0
;
if
((
keycode
!=
'O'
&&
keycode
!=
'o'
&&
keycode
!=
'['
)
||
key_buffer_len
==
0
||
*
key_buffer
==
0x1B
)
{
key_buffer_len
==
0
||
*
key_buffer
==
ESC_CODE
)
{
/* One escape followed by a single non-escape:
* meta key sequence mode. */
if
(
!
solitary
||
(
keycode
>=
0x20
&&
keycode
<
0x7F
))
...
...
@@ -573,7 +573,7 @@ int parse_kbinput(WINDOW *win)
/* Slang doesn't support KEY_SDC. */
case
KEY_SDC
:
#endif
case
NANO_CONTROL_8
:
case
DEL_CODE
:
if
(
ISSET
(
REBIND_DELETE
))
return
sc_seq_or
(
do_delete
,
keycode
);
else
...
...
@@ -1266,16 +1266,16 @@ int get_control_kbinput(int kbinput)
/* Ctrl-Space (Ctrl-2, Ctrl-@, Ctrl-`) */
if
(
kbinput
==
' '
||
kbinput
==
'2'
)
retval
=
NANO_CONTROL_SPACE
;
retval
=
0
;
/* Ctrl-/ (Ctrl-7, Ctrl-_) */
else
if
(
kbinput
==
'/'
)
retval
=
NANO_CONTROL_7
;
retval
=
31
;
/* Ctrl-3 (Ctrl-[, Esc) to Ctrl-7 (Ctrl-/, Ctrl-_) */
else
if
(
'3'
<=
kbinput
&&
kbinput
<=
'7'
)
retval
=
kbinput
-
24
;
/* Ctrl-8 (Ctrl-?) */
else
if
(
kbinput
==
'8'
||
kbinput
==
'?'
)
retval
=
NANO_CONTROL_8
;
retval
=
DEL_CODE
;
/* Ctrl-@ (Ctrl-Space, Ctrl-2, Ctrl-`) to Ctrl-_ (Ctrl-/, Ctrl-7) */
else
if
(
'@'
<=
kbinput
&&
kbinput
<=
'_'
)
retval
=
kbinput
-
'@'
;
...
...
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