add the ability to use bold text instead of reverse video text, via the
-D/--boldtext command line option and the "boldtext" rcfile option, and reduce USE_UTF8 to a static bool in chars.c git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3368 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
61a70388fe
Коммит
4d72de73b1
17
ChangeLog
17
ChangeLog
@ -13,6 +13,23 @@ CVS code -
|
|||||||
- Change translator-specific comments in global.c and prompt.c
|
- Change translator-specific comments in global.c and prompt.c
|
||||||
so that they show up in nano.pot, and make them all
|
so that they show up in nano.pot, and make them all
|
||||||
consistent. (Benno Schulenberg)
|
consistent. (Benno Schulenberg)
|
||||||
|
- Reduce USE_UTF8 to a static bool in chars.c, allow nano.c to
|
||||||
|
set it via a function, and allow winio.c to read its value
|
||||||
|
when needed. New functions utf8_init() and using_utf8();
|
||||||
|
changes to is_alnum_mbchar(), is_blank_mbchar(),
|
||||||
|
is_cntrl_mbchar(), is_punct_mbchar(), control_mbrep(),
|
||||||
|
mbrep(), mbwidth(), mb_cur_max(), make_mbchar(),
|
||||||
|
parse_mbchar(), mbstrncasecmp(), mbstrcasestr(),
|
||||||
|
mbrevstrcasestr(), mbstrnlen(), mbstrchr(), mbstrpbrk(),
|
||||||
|
mbrevstrpbrk(), has_blank_mbchars(), is_valid_mbstring(),
|
||||||
|
main(), display_string(), and do_credits(). (DLR)
|
||||||
|
- Add the ability to use bold text instead of reverse video
|
||||||
|
text, via the -D/--boldtext command line option and the
|
||||||
|
"boldtext" rcfile option. Changes to do_help(), usage(),
|
||||||
|
main(), update_statusbar_prompt(), do_yesno_prompt(),
|
||||||
|
titlebar(), statusbar(), onekey(), edit_draw(),
|
||||||
|
do_replace_highlight(), nano.1, nanorc.5, nano.texi, and
|
||||||
|
nanorc.sample. (DLR, suggested by Benno Schulenberg)
|
||||||
- files.c:
|
- files.c:
|
||||||
open_file()
|
open_file()
|
||||||
- Remove redundant wording in the error message when we try to
|
- Remove redundant wording in the error message when we try to
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
.\" warranty.
|
.\" warranty.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.TH NANO 1 "version 1.3.11" "April 5, 2006"
|
.TH NANO 1 "version 1.3.11" "April 12, 2006"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
|
|
||||||
@ -55,6 +55,9 @@ filename suffixed with a ~.
|
|||||||
Set the directory where \fBnano\fP puts unique backup files if file
|
Set the directory where \fBnano\fP puts unique backup files if file
|
||||||
backups are enabled.
|
backups are enabled.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-D (\-\-boldtext)
|
||||||
|
Use bold text instead of reverse video text.
|
||||||
|
.TP
|
||||||
.B \-E (\-\-tabstospaces)
|
.B \-E (\-\-tabstospaces)
|
||||||
Convert typed tabs to spaces.
|
Convert typed tabs to spaces.
|
||||||
.TP
|
.TP
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
.\" warranty.
|
.\" warranty.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id$
|
.\" $Id$
|
||||||
.TH NANORC 5 "version 1.3.11" "April 5, 2006"
|
.TH NANORC 5 "version 1.3.11" "April 12, 2006"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
@ -59,6 +59,9 @@ backups are enabled.
|
|||||||
.B set/unset backwards
|
.B set/unset backwards
|
||||||
Do backwards searches by default.
|
Do backwards searches by default.
|
||||||
.TP
|
.TP
|
||||||
|
.B set/unset boldtext
|
||||||
|
Use bold text instead of reverse video text.
|
||||||
|
.TP
|
||||||
.B set brackets "\fIstring\fP"
|
.B set brackets "\fIstring\fP"
|
||||||
Set the characters treated as closing brackets. They cannot contain
|
Set the characters treated as closing brackets. They cannot contain
|
||||||
blank characters. Only closing punctuation, optionally followed by
|
blank characters. Only closing punctuation, optionally followed by
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
## Do backwards searches by default.
|
## Do backwards searches by default.
|
||||||
# set backwards
|
# set backwards
|
||||||
|
|
||||||
|
## Use bold text instead of reverse video text.
|
||||||
|
# set boldtext
|
||||||
|
|
||||||
## The characters treated as closing brackets. They cannot contain
|
## The characters treated as closing brackets. They cannot contain
|
||||||
## blank characters. Only closing punctuation, optionally followed by
|
## blank characters. Only closing punctuation, optionally followed by
|
||||||
## closing brackets, can end sentences.
|
## closing brackets, can end sentences.
|
||||||
@ -355,7 +358,7 @@
|
|||||||
## highlight possible errors and parameters
|
## highlight possible errors and parameters
|
||||||
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
# icolor brightwhite "^[[:space:]]*(set|unset|syntax|i?color).*$"
|
||||||
## set, unset and syntax
|
## set, unset and syntax
|
||||||
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct|quickblank)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
# icolor cyan "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
||||||
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
|
# icolor green "^[[:space:]]*(set|unset|syntax)\>"
|
||||||
## colors
|
## colors
|
||||||
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
# icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
@smallbook
|
@smallbook
|
||||||
@set EDITION 0.1
|
@set EDITION 0.1
|
||||||
@set VERSION 1.3.10
|
@set VERSION 1.3.10
|
||||||
@set UPDATED 5 Apr 2006
|
@set UPDATED 12 Apr 2006
|
||||||
|
|
||||||
@dircategory Editors
|
@dircategory Editors
|
||||||
@direntry
|
@direntry
|
||||||
@ -129,6 +129,9 @@ filename suffixed with a ~.
|
|||||||
Set the directory where @code{nano} puts unique backup files if file
|
Set the directory where @code{nano} puts unique backup files if file
|
||||||
backups are enabled.
|
backups are enabled.
|
||||||
|
|
||||||
|
@item -D, --boldtext
|
||||||
|
Use bold text instead of reverse video text.
|
||||||
|
|
||||||
@item -E, --tabstospaces
|
@item -E, --tabstospaces
|
||||||
Convert typed tabs to spaces.
|
Convert typed tabs to spaces.
|
||||||
|
|
||||||
|
52
src/chars.c
52
src/chars.c
@ -34,6 +34,8 @@
|
|||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool use_utf8 = FALSE;
|
||||||
|
/* Whether we've enabled UTF-8 support. */
|
||||||
static const wchar_t bad_wchar = 0xFFFD;
|
static const wchar_t bad_wchar = 0xFFFD;
|
||||||
/* If we get an invalid multibyte sequence, we treat it as
|
/* If we get an invalid multibyte sequence, we treat it as
|
||||||
* Unicode FFFD (Replacement Character), unless we're
|
* Unicode FFFD (Replacement Character), unless we're
|
||||||
@ -41,6 +43,18 @@ static const wchar_t bad_wchar = 0xFFFD;
|
|||||||
* match to it. */
|
* match to it. */
|
||||||
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
static const char *bad_mbchar = "\xEF\xBF\xBD";
|
||||||
static const int bad_mbchar_len = 3;
|
static const int bad_mbchar_len = 3;
|
||||||
|
|
||||||
|
/* Enable UTF-8 support. */
|
||||||
|
void utf8_init(void)
|
||||||
|
{
|
||||||
|
use_utf8 = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Is UTF-8 support enabled? */
|
||||||
|
bool using_utf8(void)
|
||||||
|
{
|
||||||
|
return use_utf8;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_ISBLANK
|
#ifndef HAVE_ISBLANK
|
||||||
@ -72,7 +86,7 @@ bool is_alnum_mbchar(const char *c)
|
|||||||
assert(c != NULL);
|
assert(c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
@ -92,7 +106,7 @@ bool is_blank_mbchar(const char *c)
|
|||||||
assert(c != NULL);
|
assert(c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
@ -132,7 +146,7 @@ bool is_cntrl_mbchar(const char *c)
|
|||||||
assert(c != NULL);
|
assert(c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
@ -152,7 +166,7 @@ bool is_punct_mbchar(const char *c)
|
|||||||
assert(c != NULL);
|
assert(c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||||
|
|
||||||
@ -219,7 +233,7 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
|||||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
@ -253,7 +267,7 @@ char *mbrep(const char *c, char *crep, int *crep_len)
|
|||||||
assert(c != NULL && crep != NULL && crep_len != NULL);
|
assert(c != NULL && crep != NULL && crep_len != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
/* Reject invalid Unicode characters. */
|
/* Reject invalid Unicode characters. */
|
||||||
@ -286,7 +300,7 @@ int mbwidth(const char *c)
|
|||||||
assert(c != NULL);
|
assert(c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
@ -313,7 +327,7 @@ int mb_cur_max(void)
|
|||||||
{
|
{
|
||||||
return
|
return
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
ISSET(USE_UTF8) ? MB_CUR_MAX :
|
use_utf8 ? MB_CUR_MAX :
|
||||||
#endif
|
#endif
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
@ -330,7 +344,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
|||||||
assert(chr_mb_len != NULL);
|
assert(chr_mb_len != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
chr_mb = charalloc(MB_CUR_MAX);
|
chr_mb = charalloc(MB_CUR_MAX);
|
||||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||||
|
|
||||||
@ -361,7 +375,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
|||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
/* Get the number of bytes in the multibyte character. */
|
/* Get the number of bytes in the multibyte character. */
|
||||||
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
buf_mb_len = mblen(buf, MB_CUR_MAX);
|
||||||
|
|
||||||
@ -505,7 +519,7 @@ int nstrncasecmp(const char *s1, const char *s2, size_t n)
|
|||||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
char *s1_mb = charalloc(MB_CUR_MAX);
|
char *s1_mb = charalloc(MB_CUR_MAX);
|
||||||
char *s2_mb = charalloc(MB_CUR_MAX);
|
char *s2_mb = charalloc(MB_CUR_MAX);
|
||||||
wchar_t ws1, ws2;
|
wchar_t ws1, ws2;
|
||||||
@ -598,7 +612,7 @@ const char *nstrcasestr(const char *haystack, const char *needle)
|
|||||||
const char *mbstrcasestr(const char *haystack, const char *needle)
|
const char *mbstrcasestr(const char *haystack, const char *needle)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
char *r_mb = charalloc(MB_CUR_MAX);
|
char *r_mb = charalloc(MB_CUR_MAX);
|
||||||
char *q_mb = charalloc(MB_CUR_MAX);
|
char *q_mb = charalloc(MB_CUR_MAX);
|
||||||
wchar_t wr, wq;
|
wchar_t wr, wq;
|
||||||
@ -704,7 +718,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
|||||||
const char *rev_start)
|
const char *rev_start)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
char *r_mb = charalloc(MB_CUR_MAX);
|
char *r_mb = charalloc(MB_CUR_MAX);
|
||||||
char *q_mb = charalloc(MB_CUR_MAX);
|
char *q_mb = charalloc(MB_CUR_MAX);
|
||||||
wchar_t wr, wq;
|
wchar_t wr, wq;
|
||||||
@ -792,7 +806,7 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
|||||||
assert(s != NULL);
|
assert(s != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
int s_mb_len;
|
int s_mb_len;
|
||||||
|
|
||||||
@ -820,7 +834,7 @@ char *mbstrchr(const char *s, const char *c)
|
|||||||
assert(s != NULL && c != NULL);
|
assert(s != NULL && c != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||||
char *s_mb = charalloc(MB_CUR_MAX);
|
char *s_mb = charalloc(MB_CUR_MAX);
|
||||||
const char *q = s;
|
const char *q = s;
|
||||||
@ -868,7 +882,7 @@ char *mbstrpbrk(const char *s, const char *accept)
|
|||||||
assert(s != NULL && accept != NULL);
|
assert(s != NULL && accept != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
while (*s != '\0') {
|
while (*s != '\0') {
|
||||||
if (mbstrchr(accept, s) != NULL)
|
if (mbstrchr(accept, s) != NULL)
|
||||||
return (char *)s;
|
return (char *)s;
|
||||||
@ -909,7 +923,7 @@ char *mbrevstrpbrk(const char *s, const char *accept, const char
|
|||||||
assert(s != NULL && accept != NULL && rev_start != NULL);
|
assert(s != NULL && accept != NULL && rev_start != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
bool begin_line = FALSE;
|
bool begin_line = FALSE;
|
||||||
|
|
||||||
while (!begin_line) {
|
while (!begin_line) {
|
||||||
@ -954,7 +968,7 @@ bool has_blank_mbchars(const char *s)
|
|||||||
assert(s != NULL);
|
assert(s != NULL);
|
||||||
|
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
if (ISSET(USE_UTF8)) {
|
if (use_utf8) {
|
||||||
char *chr_mb = charalloc(MB_CUR_MAX);
|
char *chr_mb = charalloc(MB_CUR_MAX);
|
||||||
bool retval = FALSE;
|
bool retval = FALSE;
|
||||||
|
|
||||||
@ -999,7 +1013,7 @@ bool is_valid_mbstring(const char *s)
|
|||||||
|
|
||||||
return
|
return
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
ISSET(USE_UTF8) ?
|
use_utf8 ?
|
||||||
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
(mbstowcs(NULL, s, 0) != (size_t)-1) :
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -197,6 +197,8 @@ regmatch_t regmatches[10];
|
|||||||
* maximum, used in regular expression searches. */
|
* maximum, used in regular expression searches. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int reverse_attr = A_REVERSE;
|
||||||
|
/* The curses attribute we use for reverse video. */
|
||||||
bool curses_ended = FALSE;
|
bool curses_ended = FALSE;
|
||||||
/* Whether endwin() has ended curses mode and statusbar()
|
/* Whether endwin() has ended curses mode and statusbar()
|
||||||
* should hence write to stderr instead of displaying on the
|
* should hence write to stderr instead of displaying on the
|
||||||
|
@ -54,7 +54,7 @@ void do_help(void (*refresh_func)(void))
|
|||||||
|
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
blank_edit();
|
blank_edit();
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, reverse_attr);
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
|
||||||
/* Set help_text as the string to display. */
|
/* Set help_text as the string to display. */
|
||||||
|
20
src/nano.c
20
src/nano.c
@ -734,6 +734,8 @@ void usage(void)
|
|||||||
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
||||||
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
||||||
N_("Directory for saving unique backup files"));
|
N_("Directory for saving unique backup files"));
|
||||||
|
print1opt("-D", "--boldtext",
|
||||||
|
N_("Use bold instead of reverse video text"));
|
||||||
print1opt("-E", "--tabstospaces",
|
print1opt("-E", "--tabstospaces",
|
||||||
N_("Convert typed tabs to spaces"));
|
N_("Convert typed tabs to spaces"));
|
||||||
#endif
|
#endif
|
||||||
@ -1585,6 +1587,7 @@ int main(int argc, char **argv)
|
|||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
const struct option long_options[] = {
|
const struct option long_options[] = {
|
||||||
{"help", 0, NULL, 'h'},
|
{"help", 0, NULL, 'h'},
|
||||||
|
{"boldtext", 0, NULL, 'D'},
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
{"multibuffer", 0, NULL, 'F'},
|
{"multibuffer", 0, NULL, 'F'},
|
||||||
#endif
|
#endif
|
||||||
@ -1651,10 +1654,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
|
if (locale != NULL && (strcasestr(locale, "UTF8") != NULL ||
|
||||||
strcasestr(locale, "UTF-8") != NULL)) {
|
strcasestr(locale, "UTF-8") != NULL)) {
|
||||||
SET(USE_UTF8);
|
|
||||||
#ifdef USE_SLANG
|
#ifdef USE_SLANG
|
||||||
SLutf8_enable(TRUE);
|
SLutf8_enable(TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
utf8_init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -1676,11 +1679,11 @@ int main(int argc, char **argv)
|
|||||||
while ((optchr =
|
while ((optchr =
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
getopt_long(argc, argv,
|
getopt_long(argc, argv,
|
||||||
"h?ABC:EFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
|
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
|
||||||
long_options, NULL)
|
long_options, NULL)
|
||||||
#else
|
#else
|
||||||
getopt(argc, argv,
|
getopt(argc, argv,
|
||||||
"h?ABC:EFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
||||||
#endif
|
#endif
|
||||||
) != -1) {
|
) != -1) {
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
@ -1702,6 +1705,11 @@ int main(int argc, char **argv)
|
|||||||
case 'C':
|
case 'C':
|
||||||
backup_dir = mallocstrcpy(backup_dir, optarg);
|
backup_dir = mallocstrcpy(backup_dir, optarg);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
case 'D':
|
||||||
|
SET(BOLD_TEXT);
|
||||||
|
break;
|
||||||
|
#ifndef NANO_TINY
|
||||||
case 'E':
|
case 'E':
|
||||||
SET(TABS_TO_SPACES);
|
SET(TABS_TO_SPACES);
|
||||||
break;
|
break;
|
||||||
@ -1930,7 +1938,13 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
|
/* If we're using bold text instead of reverse video text, set it up
|
||||||
|
* now. */
|
||||||
|
if (ISSET(BOLD_TEXT))
|
||||||
|
reverse_attr = A_BOLD;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
/* Set up the search/replace history. */
|
||||||
history_init();
|
history_init();
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||||
|
@ -370,7 +370,7 @@ typedef struct rcoption {
|
|||||||
#define QUICK_BLANK (1<<28)
|
#define QUICK_BLANK (1<<28)
|
||||||
#define WORD_BOUNDS (1<<29)
|
#define WORD_BOUNDS (1<<29)
|
||||||
#define NO_NEWLINES (1<<30)
|
#define NO_NEWLINES (1<<30)
|
||||||
#define USE_UTF8 (1<<31)
|
#define BOLD_TEXT (1<<31)
|
||||||
|
|
||||||
/* Control key sequences. Changing these would be very, very bad. */
|
/* Control key sequences. Changing these would be very, very bad. */
|
||||||
#define NANO_CONTROL_SPACE 0
|
#define NANO_CONTROL_SPACE 0
|
||||||
|
@ -857,7 +857,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
|||||||
index = strnlenpt(curranswer, index);
|
index = strnlenpt(curranswer, index);
|
||||||
page_start = get_statusbar_page_start(start_col, start_col + index);
|
page_start = get_statusbar_page_start(start_col, start_col + index);
|
||||||
|
|
||||||
wattron(bottomwin, A_REVERSE);
|
wattron(bottomwin, reverse_attr);
|
||||||
|
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
|
||||||
@ -872,7 +872,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
|||||||
|
|
||||||
reset_statusbar_cursor();
|
reset_statusbar_cursor();
|
||||||
|
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, reverse_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
/* Put the cursor in the statusbar prompt at statusbar_x. */
|
||||||
@ -1247,12 +1247,12 @@ int do_yesno_prompt(bool all, const char *msg)
|
|||||||
onekey("^C", _("Cancel"), width);
|
onekey("^C", _("Cancel"), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
wattron(bottomwin, A_REVERSE);
|
wattron(bottomwin, reverse_attr);
|
||||||
|
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
mvwaddnstr(bottomwin, 0, 0, msg, actual_x(msg, COLS - 1));
|
||||||
|
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, reverse_attr);
|
||||||
|
|
||||||
/* Refresh the edit window and the statusbar before getting
|
/* Refresh the edit window and the statusbar before getting
|
||||||
* input. */
|
* input. */
|
||||||
|
@ -132,6 +132,7 @@ extern regex_t search_regexp;
|
|||||||
extern regmatch_t regmatches[10];
|
extern regmatch_t regmatches[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern int reverse_attr;
|
||||||
extern bool curses_ended;
|
extern bool curses_ended;
|
||||||
|
|
||||||
extern char *homedir;
|
extern char *homedir;
|
||||||
@ -155,6 +156,10 @@ void striponedir(char *path);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions in chars.c. */
|
/* Public functions in chars.c. */
|
||||||
|
#ifdef ENABLE_UTF8
|
||||||
|
void utf8_init(void);
|
||||||
|
bool using_utf8(void);
|
||||||
|
#endif
|
||||||
#ifndef HAVE_ISBLANK
|
#ifndef HAVE_ISBLANK
|
||||||
bool nisblank(int c);
|
bool nisblank(int c);
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
|
|
||||||
const static rcoption rcopts[] = {
|
const static rcoption rcopts[] = {
|
||||||
|
{"boldtext", BOLD_TEXT},
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
{"brackets", 0},
|
{"brackets", 0},
|
||||||
#endif
|
#endif
|
||||||
|
24
src/winio.c
24
src/winio.c
@ -1857,7 +1857,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
else if (ISSET(USE_UTF8) && mbwidth(buf_mb) > 1) {
|
else if (using_utf8() && mbwidth(buf_mb) > 1) {
|
||||||
converted[index++] = ' ';
|
converted[index++] = ' ';
|
||||||
start_col++;
|
start_col++;
|
||||||
|
|
||||||
@ -1992,7 +1992,7 @@ void titlebar(const char *path)
|
|||||||
|
|
||||||
assert(path != NULL || openfile->filename != NULL);
|
assert(path != NULL || openfile->filename != NULL);
|
||||||
|
|
||||||
wattron(topwin, A_REVERSE);
|
wattron(topwin, reverse_attr);
|
||||||
blank_titlebar();
|
blank_titlebar();
|
||||||
|
|
||||||
/* space has to be at least 4: two spaces before the version message,
|
/* space has to be at least 4: two spaces before the version message,
|
||||||
@ -2117,7 +2117,7 @@ void titlebar(const char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wattroff(topwin, A_REVERSE);
|
wattroff(topwin, reverse_attr);
|
||||||
|
|
||||||
wnoutrefresh(topwin);
|
wnoutrefresh(topwin);
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
@ -2176,12 +2176,12 @@ void statusbar(const char *msg, ...)
|
|||||||
start_x = (COLS - foo_len - 4) / 2;
|
start_x = (COLS - foo_len - 4) / 2;
|
||||||
|
|
||||||
wmove(bottomwin, 0, start_x);
|
wmove(bottomwin, 0, start_x);
|
||||||
wattron(bottomwin, A_REVERSE);
|
wattron(bottomwin, reverse_attr);
|
||||||
waddstr(bottomwin, "[ ");
|
waddstr(bottomwin, "[ ");
|
||||||
waddstr(bottomwin, foo);
|
waddstr(bottomwin, foo);
|
||||||
free(foo);
|
free(foo);
|
||||||
waddstr(bottomwin, " ]");
|
waddstr(bottomwin, " ]");
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, reverse_attr);
|
||||||
wnoutrefresh(bottomwin);
|
wnoutrefresh(bottomwin);
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
wnoutrefresh(edit);
|
wnoutrefresh(edit);
|
||||||
@ -2266,9 +2266,9 @@ void onekey(const char *keystroke, const char *desc, size_t len)
|
|||||||
|
|
||||||
assert(keystroke != NULL && desc != NULL);
|
assert(keystroke != NULL && desc != NULL);
|
||||||
|
|
||||||
wattron(bottomwin, A_REVERSE);
|
wattron(bottomwin, reverse_attr);
|
||||||
waddnstr(bottomwin, keystroke, actual_x(keystroke, len));
|
waddnstr(bottomwin, keystroke, actual_x(keystroke, len));
|
||||||
wattroff(bottomwin, A_REVERSE);
|
wattroff(bottomwin, reverse_attr);
|
||||||
|
|
||||||
if (len > keystroke_len)
|
if (len > keystroke_len)
|
||||||
len -= keystroke_len;
|
len -= keystroke_len;
|
||||||
@ -2626,10 +2626,10 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
|
|||||||
if (paintlen > 0)
|
if (paintlen > 0)
|
||||||
paintlen = actual_x(converted + index, paintlen);
|
paintlen = actual_x(converted + index, paintlen);
|
||||||
|
|
||||||
wattron(edit, A_REVERSE);
|
wattron(edit, reverse_attr);
|
||||||
mvwaddnstr(edit, line, x_start, converted + index,
|
mvwaddnstr(edit, line, x_start, converted + index,
|
||||||
paintlen);
|
paintlen);
|
||||||
wattroff(edit, A_REVERSE);
|
wattroff(edit, reverse_attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
@ -3052,7 +3052,7 @@ void do_replace_highlight(bool highlight, const char *word)
|
|||||||
reset_cursor();
|
reset_cursor();
|
||||||
|
|
||||||
if (highlight)
|
if (highlight)
|
||||||
wattron(edit, A_REVERSE);
|
wattron(edit, reverse_attr);
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
/* This is so we can show zero-length regexes. */
|
/* This is so we can show zero-length regexes. */
|
||||||
@ -3066,7 +3066,7 @@ void do_replace_highlight(bool highlight, const char *word)
|
|||||||
waddch(edit, '$');
|
waddch(edit, '$');
|
||||||
|
|
||||||
if (highlight)
|
if (highlight)
|
||||||
wattroff(edit, A_REVERSE);
|
wattroff(edit, reverse_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NANO_EXTRA
|
#ifdef NANO_EXTRA
|
||||||
@ -3154,7 +3154,7 @@ void do_credits(void)
|
|||||||
* Small Letter O with Diaresis) if applicable. */
|
* Small Letter O with Diaresis) if applicable. */
|
||||||
credits[15] =
|
credits[15] =
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
ISSET(USE_UTF8) ? "Florian K\xC3\xB6nig" :
|
using_utf8() ? "Florian K\xC3\xB6nig" :
|
||||||
#endif
|
#endif
|
||||||
"Florian K\xF6nig";
|
"Florian K\xF6nig";
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user