Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c367bff01 | ||
|
|
47a7ac2313 | ||
|
|
fb41a0780d | ||
|
|
1b6ed07543 | ||
|
|
1371fb6326 | ||
|
|
3daeeebf91 | ||
|
|
8b6461fc80 | ||
|
|
506af6fbfb | ||
|
|
f9cf36264c | ||
|
|
e67bf806bd | ||
|
|
ed505f5893 | ||
|
|
deb34f2779 | ||
|
|
c73d07102b | ||
|
|
9eb7fc6762 | ||
|
|
9ba66065da | ||
|
|
33a8b4e9ae | ||
|
|
2cca48380d | ||
|
|
b04248c548 | ||
|
|
8a59f254ea | ||
|
|
cc60c3a767 | ||
|
|
2ea0b8fa03 | ||
|
|
dcd19c955f | ||
|
|
90ee8ee494 | ||
|
|
690e7df997 | ||
|
|
a1941d2a70 |
65
ChangeLog
65
ChangeLog
@@ -1,7 +1,68 @@
|
||||
GNU nano 2.1.2 - 2008.06.24
|
||||
2008-06-24 Chris Allegretta <chrisa@asty.org>
|
||||
* rcfile.c: Added function check_bad_binding() to look for sequences which
|
||||
shouldn't be bound, per Savannah bug 22674.
|
||||
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* prompt.c,search.c,global.c: Tentative fix for bug #23144: using arrow
|
||||
keys in search buffer affects main window (by Mike Frysinger)
|
||||
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* global.c: Fix for Savannah bug #23442: left/right arrow keys
|
||||
do not work with --enable-tiny (by Mike Frysinger)
|
||||
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c,proto.h,text.c: Fix for conflicts with AIX curses
|
||||
variables, from William Jojo <jojowil@hvcc.edu>
|
||||
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* global.c: Fix for compile error when --disable-speller is used
|
||||
(Savannah bug 23227 by Mike Frysinger)
|
||||
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* Fix for seg fault when window size too small, by
|
||||
Andreas Amann <andreas.amann@tyndall.ie>
|
||||
|
||||
GNU nano 2.1.1 - 2008.04.01
|
||||
2008-05-31 Chris Allegretta <chrisa@asty.org>
|
||||
* Added the following contributed files, by owner:
|
||||
Donnie Berkholz <dberkholz@gentoo.org>
|
||||
* Sample awk.nanorc
|
||||
Simon Rupf <simon.rupf@int-ag.ch>
|
||||
* Sample css.nanorc
|
||||
Josef 'Jupp' Schugt <jupp@rubyforge.org>
|
||||
* sample ruby.nanorc
|
||||
|
||||
2008-03-31 Chris Allegretta <chrisa@asty.org>
|
||||
* global.c: Fix for issues compiling with --enable-tiny and
|
||||
--enable-multibuffer, as reported by Mike Frysinger.
|
||||
* files.c: Fix the fact that the insert file prompt text did not
|
||||
properly appears in tiny mode.
|
||||
|
||||
2008-03-19 Benno Schulenberg <bensberg@justemail.net>
|
||||
* help.c, nano.c: Fix toggle help not being translated, fix allocation
|
||||
issue.
|
||||
|
||||
2008-03-19 Chris Allegretta <chrisa@asty.org>
|
||||
* gloabl.c: Fix bracket matching sequence to be M-] not M-[, as reported
|
||||
Nick Warne <nick@ukfsn.org>.
|
||||
* doc/syntax/Makefile.am - Actually include new syntaxes from Mike, etc
|
||||
* debian.nanorc - New debian sources.list config since we're including
|
||||
gentoo, adapted from Milian Wolff <mail@milianw.de>
|
||||
|
||||
2008-03-18 Mike Frysinger <vapier@gentoo.org>
|
||||
* winio.c: Remove unneeded variable in parse_kbinput()
|
||||
* rcfile.c: relocate check_vitals_mapped() function to just above
|
||||
where it actually gets used and declare it "static void" in the process
|
||||
* global.c: only declare nano_justify_msg when justify support is enabled
|
||||
* php.nanorc: Php syntax highlighting config
|
||||
* tcl.nanorc: Tcl syntax highlighting config
|
||||
* gentoo.nanorc: Gentoo syntax highlighting config
|
||||
|
||||
2008-03-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* global.c - Fix incorrect first line jump messsage, fix
|
||||
* global.c: Fix incorrect first line jump messsage, fix
|
||||
more comments to assist translators
|
||||
* winio.c - Fix shortcut labels not being translated.
|
||||
* winio.c: Fix shortcut labels not being translated.
|
||||
|
||||
2008-03-17 Mike Frysinger <vapier@gentoo.org>
|
||||
* */.gitignore: Git ignore files for those running a local git
|
||||
|
||||
20
NEWS
20
NEWS
@@ -1,3 +1,23 @@
|
||||
2008/04/24 - GNU nano 2.1.2 "New York City" is released. This release
|
||||
contains fixes for binding bad keys, some
|
||||
configure-specific compilation failures, and more issues
|
||||
with the new input back end and in particular the status
|
||||
bar. Also fixed are some long standing issues with
|
||||
compiling on AIX, and a segfault when making the terminal
|
||||
window too small. Rest in Peace Tim and George!
|
||||
|
||||
2008/04/01 - GNU nano 2.1.1 wont get fooled again. This release contains
|
||||
fixes for the new user-rebindable keys (in particular
|
||||
bracket match which was mis-bound), and various
|
||||
problems with translations and configure-related
|
||||
compilation problems are now fixed as well.
|
||||
It also contains new syntax highlighting
|
||||
definitions for TCL, PHP, Gentoo and Debian-related
|
||||
files, and some documentation updates as well.
|
||||
Please continue to send reports with the key
|
||||
binding code to the Savannah page
|
||||
(https://savannah.gnu.org/bugs/?group=nano).
|
||||
|
||||
2008/03/18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.1.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.1.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
@@ -12,6 +12,13 @@ pkgdata_DATA = asm.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
sh.nanorc \
|
||||
tex.nanorc
|
||||
tex.nanorc \
|
||||
tcl.nanorc \
|
||||
php.nanorc \
|
||||
gentoo.nanorc \
|
||||
debian.nanorc \
|
||||
awk.nanorc \
|
||||
css.nanorc \
|
||||
xml.nanorc
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
||||
|
||||
38
doc/syntax/awk.nanorc
Normal file
38
doc/syntax/awk.nanorc
Normal file
@@ -0,0 +1,38 @@
|
||||
## Here is an example for awk.
|
||||
##
|
||||
syntax "awk" "\.awk$"
|
||||
## records
|
||||
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
|
||||
## awk-set variables
|
||||
color red "\<(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\>"
|
||||
color red "\<(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\>"
|
||||
color red "\<(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\>"
|
||||
## function declarations and special patterns
|
||||
color brightgreen "\<(function|extension|BEGIN|END)\>"
|
||||
## operators
|
||||
color green "(\{|\}|\(|\)|\;|\]|\[|\\|<|>|!|=|&|\+|-|\*|%|/|\?:|\^|\|)"
|
||||
## flow control
|
||||
color brightyellow "\<(for|if|while|do|else|in|delete|exit)\>"
|
||||
color brightyellow "\<(break|continue|return)\>"
|
||||
## I/O statements
|
||||
color brightgreen "\<(close|getline|next|nextfile|print|printf)\>"
|
||||
color brightgreen "\<(system|fflush)\>"
|
||||
## standard functions
|
||||
color magenta "\<(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\>"
|
||||
color magenta "\<(asort|asorti|gensub|gsub|index|length|match)\>"
|
||||
color magenta "\<(split|sprintf|strtonum|sub|substr|tolower|toupper)\>"
|
||||
color magenta "\<(mktime|strftime|systime)\>"
|
||||
color magenta "\<(and|compl|lshift|or|rshift|xor)\>"
|
||||
color magenta "\<(bindtextdomain|dcgettext|dcngettext)\>"
|
||||
|
||||
##
|
||||
## String highlighting. You will in general want your comments and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
|
||||
## Comment highlighting
|
||||
color brightblue "(^|[[:space:]])#.*$"
|
||||
|
||||
## Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
9
doc/syntax/css.nanorc
Normal file
9
doc/syntax/css.nanorc
Normal file
@@ -0,0 +1,9 @@
|
||||
## Here is an example for css files.
|
||||
##
|
||||
syntax "css" "\.css$"
|
||||
color brightred "."
|
||||
color brightyellow start="\{" end="\}"
|
||||
color brightwhite start=":" end="([;^\{]|$)"
|
||||
color brightblue ":active|:focus|:hover|:link|:visited|:link|:after|:before|$"
|
||||
color brightblue start="\/\*" end="\\*/"
|
||||
color green ";|:|\{|\}"
|
||||
20
doc/syntax/debian.nanorc
Normal file
20
doc/syntax/debian.nanorc
Normal file
@@ -0,0 +1,20 @@
|
||||
## Here is an exmaple for apt's sources.list
|
||||
## Adapted from http://milianw.de/blog/Syntax-Highlighting-in-Nano
|
||||
## (mail@milianw.de).
|
||||
##
|
||||
syntax "apt/sources.list" "sources\.list(\.old|~)?$"
|
||||
# component
|
||||
color brightmagenta "^deb(-src)? ((http|file|ftp):/[^ ]+|cdrom:\[[^\]]+\]/|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+ .+$"
|
||||
# distribution
|
||||
color brightred "^deb(-src)? ((http|file|ftp):/[^ ]+|cdrom:\[[^\]]+\]/|cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/) [^ ]+"
|
||||
# URI
|
||||
color brightgreen "(http|file|ftp):/[^ ]+"
|
||||
# cdroms
|
||||
# [^\]] does not work...
|
||||
color brightgreen "cdrom:\[[-a-zA-Z0-9\._\(\) ]+\]/"
|
||||
# deb / deb-src
|
||||
color yellow "^deb"
|
||||
color yellow "^deb-src"
|
||||
# comments
|
||||
color brightblue "#.*"
|
||||
|
||||
50
doc/syntax/gentoo.nanorc
Normal file
50
doc/syntax/gentoo.nanorc
Normal file
@@ -0,0 +1,50 @@
|
||||
## Here is an example for Gentoo ebuilds/eclasses
|
||||
##
|
||||
syntax "ebuild" "\.e(build|class)$"
|
||||
## All the standard portage functions
|
||||
color brightgreen "^src_(unpack|compile|install|test)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
|
||||
## Highlight bash related syntax
|
||||
color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while|continue|break)\>"
|
||||
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color green "-(e|d|f|r|g|u|w|x|L)\>"
|
||||
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
|
||||
## Highlight variables ... official portage ones in red, all others in bright red
|
||||
color brightred "\$\{?[a-zA-Z_0-9]+\}?"
|
||||
color red "\<(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\>"
|
||||
color red "\<(S|D|T|PV|PF|P|PN|A)\>" "\<C(XX)?FLAGS\>" "\<LDFLAGS\>" "\<C(HOST|TARGET|BUILD)\>"
|
||||
## Highlight portage commands
|
||||
color magenta "\<use(_(with|enable))?\> [!a-zA-Z0-9_+ -]*" "inherit.*"
|
||||
color brightblue "\<e(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\>"
|
||||
color brightblue "\<die\>" "\<use(_(with|enable))?\>" "\<inherit\>" "\<has\>" "\<(has|best)_version\>" "\<unpack\>"
|
||||
color brightblue "\<(do|new)(ins|s?bin|doc|lib(|\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
|
||||
color brightblue "\<do(python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>"
|
||||
color brightblue "prepall(|docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|strip)"
|
||||
color brightblue "\<(|doc|ins|exe)into\>" "\<f(owners|perms)\>" "\<(exe|ins|dir)opts\>"
|
||||
## Highlight common commands used in ebuilds
|
||||
color blue "\<make\>" "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\>"
|
||||
## Highlight comments (doesnt work that well)
|
||||
color yellow "#.*$"
|
||||
## Highlight strings (doesnt work that well)
|
||||
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
## Trailing space is bad!
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
## Here is an example for Portage control files
|
||||
##
|
||||
syntax "/etc/portage" "\.(keywords|mask|unmask|use)$"
|
||||
## Base text:
|
||||
color green "^.+$"
|
||||
## Use flags:
|
||||
color brightred "[[:space:]]+\+?[a-zA-Z0-9_-]+"
|
||||
color brightblue "[[:space:]]+-[a-zA-Z0-9_-]+"
|
||||
## Likely version numbers:
|
||||
color magenta "-[[:digit:]].*([[:space:]]|$)"
|
||||
## Accepted arches:
|
||||
color white "[~-]?\<(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\>"
|
||||
color white "[[:space:]][~-]?\*"
|
||||
## Categories:
|
||||
color cyan "^[[:space:]]*.*/"
|
||||
## Masking regulators:
|
||||
color brightmagenta "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)"
|
||||
## Comments:
|
||||
color yellow "#.*$"
|
||||
30
doc/syntax/php.nanorc
Normal file
30
doc/syntax/php.nanorc
Normal file
@@ -0,0 +1,30 @@
|
||||
## Here is an example for PHP
|
||||
##
|
||||
syntax "php" "\.php[2345s~]?$"
|
||||
|
||||
## php markings
|
||||
color brightgreen "(<\?(php)?|\?>)"
|
||||
|
||||
## functions
|
||||
color white "\<[a-z_]*\("
|
||||
|
||||
## types
|
||||
color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
|
||||
|
||||
## structure
|
||||
color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
|
||||
|
||||
## control flow
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
|
||||
## strings
|
||||
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
|
||||
|
||||
## comments
|
||||
color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
#color blue start="<" end=">"
|
||||
#color red "&[^;[[:space:]]]*;"
|
||||
|
||||
## Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
16
doc/syntax/tcl.nanorc
Normal file
16
doc/syntax/tcl.nanorc
Normal file
@@ -0,0 +1,16 @@
|
||||
syntax "tcl" "\.tcl$"
|
||||
|
||||
## Standard Tcl [info commands]
|
||||
color green "\<(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\>"
|
||||
## Basic Tcl sub commands.
|
||||
color green "\<(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\>"
|
||||
color green "\<(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\>"
|
||||
## Extended TclX [info commands]
|
||||
color green "\<(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\>"
|
||||
## Syntax.
|
||||
color brightblue "proc[[:space:]]" "(\{|\})"
|
||||
color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color ,green "[[:space:]]+$"
|
||||
color ,magenta "^([[:space:]]+|)#.*"
|
||||
9
doc/syntax/xml.nanorc
Normal file
9
doc/syntax/xml.nanorc
Normal file
@@ -0,0 +1,9 @@
|
||||
## Here is an example for xml files.
|
||||
##
|
||||
syntax "xml" "\.([jrs]html?|sgml?|xml|xslt?)$"
|
||||
color green start="<" end=">"
|
||||
color cyan "<[^> ]+"
|
||||
color cyan ">"
|
||||
color yellow start="<!DOCTYPE" end="[/]?>"
|
||||
color yellow start="<!--" end="-->"
|
||||
color red "&[^;]*;"
|
||||
2560
po/nano.pot
2560
po/nano.pot
File diff suppressed because it is too large
Load Diff
1207
po/pt_BR.po
1207
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1152
po/zh_CN.po
1152
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
2073
po/zh_TW.po
2073
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
14
src/files.c
14
src/files.c
@@ -738,7 +738,9 @@ void do_insertfile(
|
||||
#endif
|
||||
MINSERTFILE, ans,
|
||||
&meta_key, &func_key,
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
edit_refresh, msg,
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
operating_dir != NULL && strcmp(operating_dir,
|
||||
@@ -2393,7 +2395,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
} else if (!*lastwastab || num_matches < 2)
|
||||
*lastwastab = TRUE;
|
||||
else {
|
||||
int longest_name = 0, columns, editline = 0;
|
||||
int longest_name = 0, ncols, editline = 0;
|
||||
|
||||
/* Now we show a list of the available choices. */
|
||||
assert(num_matches > 1);
|
||||
@@ -2418,7 +2420,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
/* Each column will be (longest_name + 2) columns wide, i.e.
|
||||
* two spaces between columns, except that there will be
|
||||
* only one space after the last column. */
|
||||
columns = (COLS + 1) / (longest_name + 2);
|
||||
ncols = (COLS + 1) / (longest_name + 2);
|
||||
|
||||
/* Blank the edit window, and print the matches out
|
||||
* there. */
|
||||
@@ -2432,11 +2434,11 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
char *disp;
|
||||
|
||||
wmove(edit, editline, (longest_name + 2) *
|
||||
(match % columns));
|
||||
(match % ncols));
|
||||
|
||||
if (match % columns == 0 &&
|
||||
if (match % ncols == 0 &&
|
||||
editline == editwinrows - 1 &&
|
||||
num_matches - match > columns) {
|
||||
num_matches - match > ncols) {
|
||||
waddstr(edit, _("(more)"));
|
||||
break;
|
||||
}
|
||||
@@ -2446,7 +2448,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||
waddstr(edit, disp);
|
||||
free(disp);
|
||||
|
||||
if ((match + 1) % columns == 0)
|
||||
if ((match + 1) % ncols == 0)
|
||||
editline++;
|
||||
}
|
||||
|
||||
|
||||
34
src/global.c
34
src/global.c
@@ -501,7 +501,9 @@ void shortcut_init(bool unjustify)
|
||||
;
|
||||
const char *nano_writeout_msg =
|
||||
N_("Write the current file to disk");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
#endif
|
||||
const char *nano_insert_msg =
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg =
|
||||
@@ -658,7 +660,11 @@ void shortcut_init(bool unjustify)
|
||||
#endif
|
||||
exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(do_exit, MBROWSER|MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
add_to_funcs(do_exit, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_funcs(do_exit, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW);
|
||||
#endif
|
||||
|
||||
/* TRANSLATORS: Try to keep this at most 10 characters. */
|
||||
add_to_funcs(do_writeout_void, MMAIN, N_("WriteOut"),
|
||||
@@ -824,9 +830,9 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_funcs(switch_to_prev_buffer_void, MMAIN, _("Previous File"),
|
||||
nano_prevfile_msg, FALSE, VIEW);
|
||||
IFSCHELP(nano_prevfile_msg), FALSE, VIEW);
|
||||
add_to_funcs(switch_to_next_buffer_void, MMAIN, N_("Next File"),
|
||||
nano_nextfile_msg, TRUE, VIEW);
|
||||
IFSCHELP(nano_nextfile_msg), TRUE, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_verbatim_input, MMAIN, N_("Verbatim Input"),
|
||||
@@ -1026,7 +1032,7 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MMAIN, "F10", do_uncut_text, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^C", do_cursorpos_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F11", do_cursorpos_void, 0, TRUE);
|
||||
#ifndef NANO_TINY
|
||||
#ifndef DISABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "^T", do_spell, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F12", do_spell, 0, TRUE);
|
||||
#endif
|
||||
@@ -1050,23 +1056,29 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MMAIN, "M-}", do_indent_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-{", do_unindent, 0, TRUE);
|
||||
add_to_sclist(MALL, "^F", do_right, 0, TRUE);
|
||||
add_to_sclist(MALL, "kright", do_right, 0, TRUE);
|
||||
add_to_sclist(MALL, "^B", do_left, 0, TRUE);
|
||||
add_to_sclist(MALL, "kleft", do_left, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^Space", do_next_word_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-Space", do_prev_word_void, 0, TRUE);
|
||||
#endif
|
||||
add_to_sclist(MALL, "kright", do_right, 0, TRUE);
|
||||
add_to_sclist(MALL, "kleft", do_left, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^Q", xon_complaint, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^S", xoff_complaint, 0, TRUE);
|
||||
add_to_sclist(MALL, "^P", do_up_void, 0, TRUE);
|
||||
add_to_sclist(MALL, "kup", do_up_void, 0, TRUE);
|
||||
add_to_sclist(MALL, "^N", do_down_void, 0, TRUE);
|
||||
add_to_sclist(MALL, "kdown", do_down_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^P", do_up_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "kup", do_up_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^N", do_down_void, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "kdown", do_down_void, 0, TRUE);
|
||||
add_to_sclist(MALL, "^A", do_home, 0, TRUE);
|
||||
add_to_sclist(MALL, "khome", do_home, 0, TRUE);
|
||||
add_to_sclist(MALL, "^E", do_end, 0, TRUE);
|
||||
add_to_sclist(MALL, "kend", do_end, 0, TRUE);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^P", (void *) prev_history_msg, 0, FALSE);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kup", (void *) prev_history_msg, 0, FALSE);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "^N", (void *) next_history_msg, 0, FALSE);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2|MWHEREISFILE, "kdown", (void *) next_history_msg, 0, FALSE);
|
||||
#endif
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
||||
"^W", do_para_begin_void, 0, TRUE);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACE2,
|
||||
@@ -1101,7 +1113,7 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", (void *) last_file_msg, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", (void *) last_file_msg, 0, TRUE);
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MMAIN, "M-[", do_find_bracket, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-]", do_find_bracket, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M--", do_scroll_up, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-_", do_scroll_up, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-+", do_scroll_down, 0, TRUE);
|
||||
|
||||
@@ -414,7 +414,7 @@ void help_init(void)
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == (void *) do_toggle)
|
||||
allocsize += strlen(flagtostr(s->toggle)) + endis_len + 9;
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -611,7 +611,7 @@ void die(const char *msg, ...)
|
||||
va_end(ap);
|
||||
|
||||
/* Save the current file buffer if it's been modified. */
|
||||
if (openfile->modified) {
|
||||
if (openfile && openfile->modified) {
|
||||
/* If we've partitioned the filestruct, unpartition it now. */
|
||||
if (filepart != NULL)
|
||||
unpartition_filestruct(&filepart);
|
||||
@@ -1250,7 +1250,7 @@ void do_toggle(int flag)
|
||||
)
|
||||
enabled = !enabled;
|
||||
|
||||
desc = flagtostr(flag);
|
||||
desc = _(flagtostr(flag));
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") :
|
||||
_("disabled"));
|
||||
}
|
||||
|
||||
@@ -1010,7 +1010,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
} else
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == do_up_void) {
|
||||
if (s && s->scfunc == (void *) prev_history_msg) {
|
||||
if (history_list != NULL) {
|
||||
/* If we're scrolling up at the bottom of the
|
||||
* history list and answer isn't blank, save answer
|
||||
@@ -1038,7 +1038,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
* statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
} else if (s && s->scfunc == do_down_void) {
|
||||
} else if (s && s->scfunc == (void *) next_history_msg) {
|
||||
if (history_list != NULL) {
|
||||
/* Get the newer search from the history list and
|
||||
* save it in answer. If there is no newer search,
|
||||
|
||||
@@ -632,7 +632,7 @@ bool do_wrap(filestruct *line);
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal
|
||||
#ifndef DISABLE_HELP
|
||||
, bool newline
|
||||
, bool newln
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
@@ -788,6 +788,8 @@ const char *cancel_msg;
|
||||
#ifndef NANO_TINY
|
||||
const char *case_sens_msg;
|
||||
const char *backwards_msg;
|
||||
const char *prev_history_msg;
|
||||
const char *next_history_msg;
|
||||
#endif
|
||||
const char *replace_msg;
|
||||
const char *no_replace_msg;
|
||||
|
||||
83
src/rcfile.c
83
src/rcfile.c
@@ -347,6 +347,20 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
int check_bad_binding(sc *s)
|
||||
{
|
||||
#define BADLISTLEN 1
|
||||
int badtypes[BADLISTLEN] = {META};
|
||||
int badseqs[BADLISTLEN] = { 91 };
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BADLISTLEN; i++)
|
||||
if (s->type == badtypes[i] && s->seq == badseqs[i])
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void parse_keybinding(char *ptr)
|
||||
{
|
||||
char *keyptr = NULL, *keycopy = NULL, *funcptr = NULL, *menuptr = NULL;
|
||||
@@ -405,6 +419,8 @@ void parse_keybinding(char *ptr)
|
||||
N_("Could not map name \"%s\" to a function\n"), funcptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n",
|
||||
(int) newsc, (int) newsc->scfunc, menu);
|
||||
@@ -420,6 +436,13 @@ void parse_keybinding(char *ptr)
|
||||
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
|
||||
#endif
|
||||
|
||||
if (check_bad_binding(newsc)) {
|
||||
rcfile_error(
|
||||
N_("Sorry, keystr \"%s\" is an illegal binding\n"), newsc->keystr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* now let's have some fun. Try and delete the other entries
|
||||
we found for the same menu, then make this new new
|
||||
beginning */
|
||||
@@ -478,6 +501,10 @@ void parse_include(char *ptr)
|
||||
nanorc = full_option;
|
||||
lineno = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", full_option);
|
||||
#endif
|
||||
|
||||
parse_rcfile(rcstream
|
||||
#ifdef ENABLE_COLOR
|
||||
, TRUE
|
||||
@@ -690,6 +717,32 @@ void parse_colors(char *ptr, bool icase)
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Check whether the user has unmapped every shortcut for a
|
||||
sequence we consider 'vital', like the exit function */
|
||||
static void check_vitals_mapped(void)
|
||||
{
|
||||
subnfunc *f;
|
||||
int v;
|
||||
#define VITALS 5
|
||||
void *vitals[VITALS] = { do_exit, do_exit, (void *) cancel_msg, (void *) cancel_msg, (void *) cancel_msg };
|
||||
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
||||
|
||||
for (v = 0; v < VITALS; v++) {
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
|
||||
const sc *s = first_sc_for(inmenus[v], f->scfunc);
|
||||
if (!s) {
|
||||
rcfile_error(N_("Fatal error: no keys mapped for function \"%s\""),
|
||||
f->desc);
|
||||
fprintf(stderr, N_("Exiting. Please use nano with the -I option if needed to adjust your nanorc settings\n"));
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the rcfile, once it has been opened successfully at rcstream,
|
||||
* and close it afterwards. If syntax_only is TRUE, only allow the file
|
||||
* to contain color syntax commands: syntax, color, and icolor. */
|
||||
@@ -965,6 +1018,10 @@ void do_rcfile(void)
|
||||
_("\"%s\" is a device file"), nanorc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", nanorc);
|
||||
#endif
|
||||
|
||||
/* Try to open the system-wide nanorc. */
|
||||
rcstream = fopen(nanorc, "rb");
|
||||
if (rcstream != NULL)
|
||||
@@ -1022,30 +1079,4 @@ void do_rcfile(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check whether the user has unmapped every shortcut for a
|
||||
sequence we consider 'vital', like the exit function */
|
||||
int check_vitals_mapped(void)
|
||||
{
|
||||
subnfunc *f;
|
||||
int v;
|
||||
#define VITALS 5
|
||||
void *vitals[VITALS] = { do_exit, do_exit, (void *) cancel_msg, (void *) cancel_msg, (void *) cancel_msg };
|
||||
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
||||
|
||||
for (v = 0; v < VITALS; v++) {
|
||||
for (f = allfuncs; f != NULL; f = f->next) {
|
||||
if (f->scfunc == vitals[v] && f->menus & inmenus[v]) {
|
||||
const sc *s = first_sc_for(inmenus[v], f->scfunc);
|
||||
if (!s) {
|
||||
rcfile_error(N_("Fatal error: no keys mapped for function \"%s\""),
|
||||
f->desc);
|
||||
fprintf(stderr, N_("Exiting. Please use nano with the -I option if needed to adjust your nanorc settings\n"));
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
20
src/text.c
20
src/text.c
@@ -761,7 +761,7 @@ bool do_wrap(filestruct *line)
|
||||
* blank, as does a '\n' if newline is TRUE. */
|
||||
ssize_t break_line(const char *line, ssize_t goal
|
||||
#ifndef DISABLE_HELP
|
||||
, bool newline
|
||||
, bool newln
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@@ -781,13 +781,13 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
|
||||
if (is_blank_mbchar(line)
|
||||
#ifndef DISABLE_HELP
|
||||
|| (newline && *line == '\n')
|
||||
|| (newln && *line == '\n')
|
||||
#endif
|
||||
) {
|
||||
blank_loc = cur_loc;
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
if (newline && *line == '\n')
|
||||
if (newln && *line == '\n')
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
@@ -810,7 +810,7 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
|
||||
if (is_blank_mbchar(line)
|
||||
#ifndef DISABLE_HELP
|
||||
|| (newline && *line == '\n')
|
||||
|| (newln && *line == '\n')
|
||||
#endif
|
||||
) {
|
||||
if (!found_blank)
|
||||
@@ -834,11 +834,11 @@ ssize_t break_line(const char *line, ssize_t goal
|
||||
|
||||
while (*line != '\0' && (is_blank_mbchar(line)
|
||||
#ifndef DISABLE_HELP
|
||||
|| (newline && *line == '\n')
|
||||
|| (newln && *line == '\n')
|
||||
#endif
|
||||
)) {
|
||||
#ifndef DISABLE_HELP
|
||||
if (newline && *line == '\n')
|
||||
if (newln && *line == '\n')
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -2365,7 +2365,7 @@ void do_spell(void)
|
||||
void do_wordlinechar_count(void)
|
||||
{
|
||||
size_t words = 0, chars = 0;
|
||||
ssize_t lines = 0;
|
||||
ssize_t nlines = 0;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
filestruct *current_save = openfile->current;
|
||||
@@ -2400,7 +2400,7 @@ void do_wordlinechar_count(void)
|
||||
/* Get the total line and character counts, as "wc -l" and "wc -c"
|
||||
* do, but get the latter in multibyte characters. */
|
||||
if (old_mark_set) {
|
||||
lines = openfile->filebot->lineno -
|
||||
nlines = openfile->filebot->lineno -
|
||||
openfile->fileage->lineno + 1;
|
||||
chars = get_totsize(openfile->fileage, openfile->filebot);
|
||||
|
||||
@@ -2409,7 +2409,7 @@ void do_wordlinechar_count(void)
|
||||
unpartition_filestruct(&filepart);
|
||||
openfile->mark_set = TRUE;
|
||||
} else {
|
||||
lines = openfile->filebot->lineno;
|
||||
nlines = openfile->filebot->lineno;
|
||||
chars = openfile->totsize;
|
||||
}
|
||||
|
||||
@@ -2421,7 +2421,7 @@ void do_wordlinechar_count(void)
|
||||
/* Display the total word, line, and character counts on the
|
||||
* statusbar. */
|
||||
statusbar(_("%sWords: %lu Lines: %ld Chars: %lu"), old_mark_set ?
|
||||
_("In Selection: ") : "", (unsigned long)words, (long)lines,
|
||||
_("In Selection: ") : "", (unsigned long)words, (long)nlines,
|
||||
(unsigned long)chars);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -329,7 +329,6 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
|
||||
*meta_key = FALSE;
|
||||
*func_key = FALSE;
|
||||
const sc *s;
|
||||
|
||||
/* Read in a character. */
|
||||
while ((kbinput = get_input(win, 1)) == NULL);
|
||||
|
||||
Reference in New Issue
Block a user