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
17cf833b
Commit
17cf833b
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: normalize some whitespace
parent
aaab6e57
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
+5
-7
src/browser.c
src/chars.c
+3
-3
src/chars.c
src/files.c
+11
-9
src/files.c
src/help.c
+2
-2
src/help.c
src/nano.c
+7
-8
src/nano.c
src/nano.h
+2
-2
src/nano.h
src/prompt.c
+1
-1
src/prompt.c
src/text.c
+5
-6
src/text.c
src/winio.c
+3
-3
src/winio.c
with
39 additions
and
41 deletions
+39
-41
src/browser.c
View file @
17cf833b
...
...
@@ -311,16 +311,14 @@ char *do_browser(char *path)
#endif
if
(
stat
(
filelist
[
selected
],
&
st
)
==
-
1
)
{
/* We can't open this file for some reason.
* Complain. */
statusline
(
ALERT
,
_
(
"Error reading %s: %s"
),
/* We can't open this file for some reason. Complain. */
statusline
(
ALERT
,
_
(
"Error reading %s: %s"
),
filelist
[
selected
],
strerror
(
errno
));
continue
;
continue
;
}
if
(
!
S_ISDIR
(
st
.
st_mode
))
{
/* We've successfully opened a file, we're done, so
* get out. */
/* We've successfully opened a file, so we're done. */
retval
=
mallocstrcpy
(
NULL
,
filelist
[
selected
]);
break
;
}
...
...
@@ -395,7 +393,7 @@ char *do_browse_from(const char *inpath)
beep
();
napms
(
1200
);
return
NULL
;
}
else
}
else
align
(
&
path
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/chars.c
View file @
17cf833b
...
...
@@ -934,9 +934,9 @@ bool has_blank_mbchars(const char *s)
bool
is_valid_unicode
(
wchar_t
wc
)
{
return
((
0
<=
wc
&&
wc
<=
0xD7FF
)
||
(
0xE000
<=
wc
&&
wc
<=
0xFDCF
)
||
(
0xFDF0
<=
wc
&&
wc
<=
0xFFFD
)
||
(
0xFFFF
<
wc
&&
wc
<=
0x10FFFF
&&
(
wc
&
0xFFFF
)
<=
0xFFFD
));
(
0xE000
<=
wc
&&
wc
<=
0xFDCF
)
||
(
0xFDF0
<=
wc
&&
wc
<=
0xFFFD
)
||
(
0xFFFF
<
wc
&&
wc
<=
0x10FFFF
&&
(
wc
&
0xFFFF
)
<=
0xFFFD
));
}
#endif
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
17cf833b
...
...
@@ -288,7 +288,7 @@ int delete_lockfile(const char *lockfilename)
{
if
(
unlink
(
lockfilename
)
<
0
&&
errno
!=
ENOENT
)
{
statusline
(
MILD
,
_
(
"Error deleting lock file %s: %s"
),
lockfilename
,
strerror
(
errno
));
strerror
(
errno
));
return
-
1
;
}
return
1
;
...
...
@@ -411,7 +411,7 @@ bool open_buffer(const char *filename, bool undoable)
{
bool
new_buffer
=
(
openfile
==
NULL
#ifndef DISABLE_MULTIBUFFER
||
ISSET
(
MULTIBUFFER
)
||
ISSET
(
MULTIBUFFER
)
#endif
);
/* Whether we load into this buffer or a new one. */
...
...
@@ -2261,7 +2261,7 @@ int do_writeout(bool exiting)
const
char
*
formatstr
,
*
backupstr
;
formatstr
=
(
openfile
->
fmt
==
DOS_FILE
)
?
_
(
" [DOS Format]"
)
:
(
openfile
->
fmt
==
MAC_FILE
)
?
_
(
" [Mac Format]"
)
:
""
;
(
openfile
->
fmt
==
MAC_FILE
)
?
_
(
" [Mac Format]"
)
:
""
;
backupstr
=
ISSET
(
BACKUP_FILE
)
?
_
(
" [Backup]"
)
:
""
;
...
...
@@ -2271,13 +2271,13 @@ int do_writeout(bool exiting)
* the command line. */
if
(
openfile
->
mark_set
&&
!
exiting
&&
!
ISSET
(
RESTRICTED
))
msg
=
(
append
==
PREPEND
)
?
_
(
"Prepend Selection to File"
)
:
(
append
==
APPEND
)
?
_
(
"Append Selection to File"
)
:
_
(
"Write Selection to File"
);
(
append
==
APPEND
)
?
_
(
"Append Selection to File"
)
:
_
(
"Write Selection to File"
);
else
#endif
/* !NANO_TINY */
msg
=
(
append
==
PREPEND
)
?
_
(
"File Name to Prepend to"
)
:
(
append
==
APPEND
)
?
_
(
"File Name to Append to"
)
:
_
(
"File Name to Write"
);
(
append
==
APPEND
)
?
_
(
"File Name to Append to"
)
:
_
(
"File Name to Write"
);
present_path
=
mallocstrcpy
(
present_path
,
"./"
);
...
...
@@ -2987,13 +2987,15 @@ int check_dotnano(void)
if
(
stat
(
nanodir
,
&
dirstat
)
==
-
1
)
{
if
(
mkdir
(
nanodir
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
)
==
-
1
)
{
history_error
(
N_
(
"Unable to create directory %s: %s
\n
"
"It is required for saving/loading search history or cursor positions.
\n
"
),
"It is required for saving/loading "
"search history or cursor positions.
\n
"
),
nanodir
,
strerror
(
errno
));
ret
=
0
;
}
}
else
if
(
!
S_ISDIR
(
dirstat
.
st_mode
))
{
history_error
(
N_
(
"Path %s is not a directory and needs to be.
\n
"
"Nano will be unable to load or save search history or cursor positions.
\n
"
),
"Nano will be unable to load or save "
"search history or cursor positions.
\n
"
),
nanodir
);
ret
=
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/help.c
View file @
17cf833b
...
...
@@ -446,7 +446,7 @@ void help_init(void)
/* First see how many toggles there are. */
for
(
s
=
sclist
;
s
!=
NULL
;
s
=
s
->
next
)
maximum
=
(
s
->
toggle
&&
s
->
ordinal
>
maximum
)
?
s
->
ordinal
:
maximum
;
maximum
=
(
s
->
toggle
&&
s
->
ordinal
>
maximum
)
?
s
->
ordinal
:
maximum
;
/* Now show them in the original order. */
while
(
counter
<
maximum
)
{
...
...
@@ -454,7 +454,7 @@ void help_init(void)
for
(
s
=
sclist
;
s
!=
NULL
;
s
=
s
->
next
)
if
(
s
->
toggle
&&
s
->
ordinal
==
counter
)
{
ptr
+=
sprintf
(
ptr
,
"%s
\t\t
%s %s
\n
"
,
(
s
->
menus
==
MMAIN
?
s
->
keystr
:
""
),
_
(
flagtostr
(
s
->
toggle
)),
_
(
"enable/disable"
));
_
(
flagtostr
(
s
->
toggle
)),
_
(
"enable/disable"
));
if
(
s
->
toggle
==
NO_COLOR_SYNTAX
||
s
->
toggle
==
TABS_TO_SPACES
)
ptr
+=
sprintf
(
ptr
,
"
\n
"
);
break
;
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
17cf833b
...
...
@@ -530,7 +530,7 @@ openfilestruct *make_new_opennode(void)
void
unlink_opennode
(
openfilestruct
*
fileptr
)
{
assert
(
fileptr
!=
NULL
&&
fileptr
->
prev
!=
NULL
&&
fileptr
->
next
!=
NULL
&&
fileptr
!=
fileptr
->
prev
&&
fileptr
!=
fileptr
->
next
);
fileptr
!=
fileptr
->
prev
&&
fileptr
!=
fileptr
->
next
);
fileptr
->
prev
->
next
=
fileptr
->
next
;
fileptr
->
next
->
prev
=
fileptr
->
prev
;
...
...
@@ -1111,9 +1111,8 @@ void do_exit(void)
if
(
ISSET
(
TEMP_FILE
))
no_current_file_name_warning
();
i
=
do_yesno_prompt
(
FALSE
,
_
(
"Save modified buffer? (Answering
\"
No
\"
will"
" DISCARD changes.) "
));
i
=
do_yesno_prompt
(
FALSE
,
_
(
"Save modified buffer? "
"(Answering
\"
No
\"
will DISCARD changes.) "
));
}
#ifdef DEBUG
...
...
@@ -1782,8 +1781,8 @@ int do_mouse(void)
if
(
ISSET
(
SOFTWRAP
))
{
size_t
i
=
0
;
for
(
openfile
->
current
=
openfile
->
edittop
;
openfile
->
current
->
next
&&
i
<
mouse_y
;
openfile
->
current
=
openfile
->
current
->
next
,
i
++
)
{
openfile
->
current
->
next
&&
i
<
mouse_y
;
openfile
->
current
=
openfile
->
current
->
next
,
i
++
)
{
openfile
->
current_y
=
i
;
i
+=
strlenpt
(
openfile
->
current
->
data
)
/
COLS
;
}
...
...
@@ -1812,10 +1811,10 @@ int do_mouse(void)
{
/* Move to where the click occurred. */
for
(;
openfile
->
current_y
<
mouse_y
&&
openfile
->
current
!=
openfile
->
filebot
;
openfile
->
current_y
++
)
openfile
->
filebot
;
openfile
->
current_y
++
)
openfile
->
current
=
openfile
->
current
->
next
;
for
(;
openfile
->
current_y
>
mouse_y
&&
openfile
->
current
!=
openfile
->
fileage
;
openfile
->
current_y
--
)
openfile
->
fileage
;
openfile
->
current_y
--
)
openfile
->
current
=
openfile
->
current
->
prev
;
openfile
->
current_x
=
actual_x
(
openfile
->
current
->
data
,
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
17cf833b
...
...
@@ -434,9 +434,9 @@ typedef struct openfilestruct {
#ifndef DISABLE_NANORC
typedef
struct
rcoption
{
const
char
*
name
;
const
char
*
name
;
/* The name of the rcfile option. */
long
flag
;
long
flag
;
/* The flag associated with it, if any. */
}
rcoption
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
17cf833b
...
...
@@ -619,7 +619,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
#endif
if
(
allow_tabs
)
answer
=
input_tab
(
answer
,
allow_files
,
&
statusbar_x
,
&
tabbed
,
refresh_func
,
listed
);
&
tabbed
,
refresh_func
,
listed
);
update_the_statusbar
();
}
else
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
17cf833b
...
...
@@ -220,13 +220,13 @@ void do_cutword(bool backward)
/* Delete a word leftward. */
void
do_cut_prev_word
(
void
)
{
do_cutword
(
TRUE
);
do_cutword
(
TRUE
);
}
/* Delete a word rightward. */
void
do_cut_next_word
(
void
)
{
do_cutword
(
FALSE
);
do_cutword
(
FALSE
);
}
#endif
/* !NANO_TINY */
...
...
@@ -2519,7 +2519,7 @@ void do_justify(bool full_justify)
if
(
func
==
do_uncut_text
#ifndef NANO_TINY
||
func
==
do_undo
||
func
==
do_undo
#endif
)
{
/* Splice the justify buffer back into the file, but only if we
...
...
@@ -3049,15 +3049,14 @@ const char *do_alt_speller(char *tempfile_name)
}
#endif
/* Replace the text of the current buffer with the spell-checked
* text. */
/* Replace the text of the current buffer with the spell-checked text. */
replace_buffer
(
tempfile_name
);
#ifndef NANO_TINY
if
(
old_mark_set
)
{
filestruct
*
top_save
=
openfile
->
fileage
;
/* Adjust the end point of the marked region for any change in
length of the region's last line. */
*
length of the region's last line. */
if
(
right_side_up
)
current_x_save
=
strlen
(
openfile
->
filebot
->
data
);
else
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
17cf833b
...
...
@@ -3059,8 +3059,8 @@ void total_refresh(void)
void
display_main_list
(
void
)
{
#ifndef DISABLE_COLOR
if
(
openfile
->
syntax
&&
(
openfile
->
syntax
->
formatter
||
openfile
->
syntax
->
linter
))
if
(
openfile
->
syntax
&&
(
openfile
->
syntax
->
formatter
||
openfile
->
syntax
->
linter
))
set_lint_or_format_shortcuts
();
else
set_spell_shortcuts
();
...
...
@@ -3140,7 +3140,7 @@ void spotlight(bool active, const char *word)
{
size_t
word_len
=
strlenpt
(
word
),
room
;
/* Compute the number of columns that are available for the word. */
/* Compute the number of columns that are available for the word. */
room
=
COLS
+
get_page_start
(
xplustabs
())
-
xplustabs
();
assert
(
room
>
0
);
...
...
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