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
17429d7f
Commit
17429d7f
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: fix some whitespace errors, and convert alignment tabs to spaces
parent
87206c06
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
src/browser.c
+1
-1
src/browser.c
src/chars.c
+1
-1
src/chars.c
src/files.c
+7
-7
src/files.c
src/global.c
+2
-2
src/global.c
src/help.c
+1
-1
src/help.c
src/history.c
+1
-1
src/history.c
src/nano.c
+2
-2
src/nano.c
src/nano.h
+29
-29
src/nano.h
src/search.c
+9
-9
src/search.c
src/text.c
+11
-12
src/text.c
src/winio.c
+20
-20
src/winio.c
with
84 additions
and
85 deletions
+84
-85
src/browser.c
View file @
17429d7f
...
...
@@ -216,7 +216,7 @@ char *do_browser(char *path)
selected
=
filelist_len
-
1
;
else
if
(
selected
+
editwinrows
*
width
>=
filelist_len
)
selected
=
(
selected
+
editwinrows
*
width
-
filelist_len
)
%
width
+
filelist_len
-
width
;
width
+
filelist_len
-
width
;
else
selected
+=
editwinrows
*
width
;
}
else
if
(
func
==
to_first_file
)
{
...
...
This diff is collapsed.
Click to expand it.
src/chars.c
View file @
17429d7f
...
...
@@ -646,7 +646,7 @@ char *revstrpbrk(const char *head, const char *accept, const char *pointer)
{
if
(
*
pointer
==
'\0'
)
{
if
(
pointer
==
head
)
return
NULL
;
return
NULL
;
pointer
--
;
}
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
17429d7f
...
...
@@ -258,7 +258,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
if
(
wroteamt
<
lockdatalen
)
{
statusline
(
MILD
,
_
(
"Error writing lock file %s: %s"
),
lockfilename
,
ferror
(
filestream
));
fclose
(
filestream
);
fclose
(
filestream
);
goto
free_the_data
;
}
...
...
@@ -1452,9 +1452,9 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
int
prompt_failed_backupwrite
(
const
char
*
filename
)
{
static
int
response
;
static
char
*
prevfile
=
NULL
;
/* What was the last file we were
*
passed so we don't keep asking
* this?
Though maybe we should
...
*/
static
char
*
prevfile
=
NULL
;
/* The last file we were
passed
,
so we don't keep asking
this.
*
Though maybe we should
?
*/
if
(
prevfile
==
NULL
||
strcmp
(
filename
,
prevfile
))
{
response
=
do_yesno_prompt
(
FALSE
,
_
(
"Failed to write backup file; "
"continue saving? (Say N if unsure.) "
));
...
...
@@ -1471,7 +1471,7 @@ void init_backup_dir(void)
backup_dir
=
free_and_assign
(
backup_dir
,
get_full_path
(
backup_dir
));
/* If we can't get an absolute path (which means it doesn't exist or
isn't accessible), or it's not a directory, fail. */
*
isn't accessible), or it's not a directory, fail. */
if
(
backup_dir
==
NULL
||
backup_dir
[
strlen
(
backup_dir
)
-
1
]
!=
'/'
)
die
(
_
(
"Invalid backup directory
\n
"
));
...
...
@@ -2224,8 +2224,8 @@ int do_writeout(bool exiting, bool withprompt)
if
(
ISSET
(
TEMP_FILE
)
&&
withprompt
)
{
free
(
given
);
if
(
response
==
1
)
return
write_file
(
openfile
->
filename
,
NULL
,
FALSE
,
OVERWRITE
,
TRUE
);
return
write_file
(
openfile
->
filename
,
NULL
,
FALSE
,
OVERWRITE
,
TRUE
);
else
if
(
response
==
0
)
return
2
;
else
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
17429d7f
...
...
@@ -261,9 +261,9 @@ size_t length_of_list(int menu)
}
/* To make the functions and shortcuts lists clearer. */
#define VIEW TRUE
/* Is allowed in view mode. */
#define VIEW TRUE
/* Is allowed in view mode. */
#define NOVIEW FALSE
#define BLANKAFTER TRUE
/* A blank line after this one. */
#define BLANKAFTER TRUE
/* A blank line after this one. */
#define TOGETHER FALSE
/* Just throw this here. */
...
...
This diff is collapsed.
Click to expand it.
src/help.c
View file @
17429d7f
...
...
@@ -84,7 +84,7 @@ void wrap_the_help_text(bool redisplaying)
while
(
TRUE
)
{
sum
+=
strlen
(
openfile
->
current
->
data
);
if
(
sum
>
location
)
break
;
break
;
openfile
->
current
=
openfile
->
current
->
next
;
}
...
...
This diff is collapsed.
Click to expand it.
src/history.c
View file @
17429d7f
...
...
@@ -328,7 +328,7 @@ void load_history(void)
update_history
(
history
,
line
);
}
else
if
(
history
==
&
search_history
)
history
=
&
replace_history
;
else
else
history
=
&
execute_history
;
}
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
17429d7f
...
...
@@ -1393,7 +1393,7 @@ void do_toggle(int flag)
refresh_needed
=
TRUE
;
break
;
case
WHITESPACE_DISPLAY
:
titlebar
(
NULL
);
/* Fall through. */
titlebar
(
NULL
);
/* Fall through. */
#ifdef ENABLE_COLOR
case
NO_COLOR_SYNTAX
:
#endif
...
...
@@ -1815,7 +1815,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
i
+=
char_len
;
/* If controls are not allowed, ignore an ASCII control character. */
if
(
!
allow_cntrls
&&
is_ascii_cntrl_char
(
*
(
output
+
i
-
char_len
)))
if
(
!
allow_cntrls
&&
is_ascii_cntrl_char
(
*
(
output
+
i
-
char_len
)))
continue
;
/* Make room for the new character and copy it into the line. */
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
17429d7f
...
...
@@ -224,7 +224,7 @@ typedef struct syntaxtype {
char
*
linter
;
/* The command with which to lint this type of file. */
char
*
formatter
;
/* The formatting command (for programming languages mainly). */
/* The formatting command (for programming languages mainly). */
#ifdef ENABLE_COMMENT
char
*
comment
;
/* The line comment prefix (and postfix) for this type of file. */
...
...
@@ -253,17 +253,17 @@ typedef struct lintstruct {
}
lintstruct
;
/* Flags that indicate how a multiline regex applies to a line. */
#define CNONE
(1<<1)
#define CNONE
(1<<1)
/* Yay, regex doesn't apply to this line at all! */
#define CBEGINBEFORE
(1<<2)
#define CBEGINBEFORE
(1<<2)
/* Regex starts on an earlier line, ends on this one. */
#define CENDAFTER
(1<<3)
#define CENDAFTER
(1<<3)
/* Regex starts on this line and ends on a later one. */
#define CWHOLELINE
(1<<4)
#define CWHOLELINE
(1<<4)
/* Whole line engulfed by the regex, start < me, end > me. */
#define CSTARTENDHERE
(1<<5)
#define CSTARTENDHERE
(1<<5)
/* Regex starts and ends within this line. */
#define CWOULDBE
(1<<6)
#define CWOULDBE
(1<<6)
/* An unpaired start match on or before this line. */
#endif
/* ENABLE_COLOR */
...
...
@@ -534,25 +534,25 @@ enum
};
/* Flags for the menus in which a given function should be present. */
#define MMAIN
(1<<0)
#define MWHEREIS
(1<<1)
#define MREPLACE
(1<<2)
#define MREPLACEWITH
(1<<3)
#define MGOTOLINE
(1<<4)
#define MWRITEFILE
(1<<5)
#define MINSERTFILE
(1<<6)
#define MEXTCMD
(1<<7)
#define MHELP
(1<<8)
#define MSPELL
(1<<9)
#define MBROWSER
(1<<10)
#define MWHEREISFILE
(1<<11)
#define MGOTODIR
(1<<12)
#define MYESNO
(1<<13)
#define MLINTER
(1<<14)
#define MFINDINHELP
(1<<15)
#define MMAIN
(1<<0)
#define MWHEREIS
(1<<1)
#define MREPLACE
(1<<2)
#define MREPLACEWITH
(1<<3)
#define MGOTOLINE
(1<<4)
#define MWRITEFILE
(1<<5)
#define MINSERTFILE
(1<<6)
#define MEXTCMD
(1<<7)
#define MHELP
(1<<8)
#define MSPELL
(1<<9)
#define MBROWSER
(1<<10)
#define MWHEREISFILE
(1<<11)
#define MGOTODIR
(1<<12)
#define MYESNO
(1<<13)
#define MLINTER
(1<<14)
#define MFINDINHELP
(1<<15)
/* This is an abbreviation for all menus except Help and YesNo. */
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
#ifndef NANO_TINY
#define MSOME MMOST
#else
...
...
@@ -605,12 +605,12 @@ enum
#define KEY_WINCH -2
/* Some extra flags for the undo function. */
#define WAS_FINAL_BACKSPACE
(1<<1)
#define WAS_WHOLE_LINE
(1<<2)
#define WAS_FINAL_LINE
(1<<3)
#define WAS_FINAL_BACKSPACE
(1<<1)
#define WAS_WHOLE_LINE
(1<<2)
#define WAS_FINAL_LINE
(1<<3)
/* The flags for the mark need to be the highest. */
#define MARK_WAS_SET
(1<<4)
#define WAS_MARKED_FORWARD
(1<<5)
#define MARK_WAS_SET
(1<<4)
#define WAS_MARKED_FORWARD
(1<<5)
#endif
/* !NANO_TINY */
/* The maximum number of entries displayed in the main shortcut list. */
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
17429d7f
...
...
@@ -169,7 +169,7 @@ int search_init(bool replacing, bool use_answer)
if
(
ISSET
(
USE_REGEXP
)
&&
!
regexp_init
(
last_search
))
return
-
1
;
else
return
0
;
/* We have a valid string or regex. */
return
0
;
/* We have a valid string or regex. */
}
func
=
func_from_key
(
&
i
);
...
...
@@ -188,7 +188,7 @@ int search_init(bool replacing, bool use_answer)
return
1
;
}
else
if
(
func
==
flip_replace
)
{
backupstring
=
mallocstrcpy
(
backupstring
,
answer
);
return
-
2
;
/* Call the opposite search function. */
return
-
2
;
/* Call the opposite search function. */
}
else
if
(
func
==
do_gotolinecolumn_void
)
{
do_gotolinecolumn
(
openfile
->
current
->
lineno
,
openfile
->
placewewant
+
1
,
TRUE
,
TRUE
);
...
...
@@ -359,11 +359,11 @@ void do_search(void)
{
int
i
=
search_init
(
FALSE
,
FALSE
);
if
(
i
==
-
1
)
/* Cancelled, or some other exit reason. */
if
(
i
==
-
1
)
/* Cancelled, or some other exit reason. */
search_replace_abort
();
else
if
(
i
==
-
2
)
/* Do a replace instead. */
else
if
(
i
==
-
2
)
/* Do a replace instead. */
do_replace
();
else
if
(
i
==
1
)
/* Toggled something. */
else
if
(
i
==
1
)
/* Toggled something. */
do_search
();
if
(
i
==
0
)
...
...
@@ -732,11 +732,11 @@ void do_replace(void)
i
=
search_init
(
TRUE
,
FALSE
);
if
(
i
==
-
1
)
/* Cancelled, or some other exit reason. */
if
(
i
==
-
1
)
/* Cancelled, or some other exit reason. */
search_replace_abort
();
else
if
(
i
==
-
2
)
/* Do a search instead. */
else
if
(
i
==
-
2
)
/* Do a search instead. */
do_search
();
else
if
(
i
==
1
)
/* Toggled something. */
else
if
(
i
==
1
)
/* Toggled something. */
do_replace
();
if
(
i
!=
0
)
...
...
@@ -1048,7 +1048,7 @@ void do_find_bracket(void)
/* If we found an identical bracket, increment count. If we
* found a complementary bracket, decrement it. */
count
+=
(
strncmp
(
openfile
->
current
->
data
+
openfile
->
current_x
,
ch
,
ch_len
)
==
0
)
?
1
:
-
1
;
ch
,
ch_len
)
==
0
)
?
1
:
-
1
;
/* If count is zero, we've found a matching bracket. Update
* the screen and get out. */
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
17429d7f
...
...
@@ -281,7 +281,7 @@ void indent_a_line(filestruct *line, char *indentation)
/* Compensate for the change in the current line. */
if
(
line
==
openfile
->
mark
&&
openfile
->
mark_x
>
0
)
openfile
->
mark_x
+=
indent_len
;
openfile
->
mark_x
+=
indent_len
;
if
(
line
==
openfile
->
current
&&
openfile
->
current_x
>
0
)
{
openfile
->
current_x
+=
indent_len
;
openfile
->
placewewant
=
xplustabs
();
...
...
@@ -349,7 +349,7 @@ size_t length_of_white(const char *text)
if
(
*
text
!=
' '
)
return
bytes_of_white
;
if
(
++
bytes_of_white
==
tabsize
)
if
(
++
bytes_of_white
==
tabsize
)
return
tabsize
;
text
++
;
...
...
@@ -1933,14 +1933,14 @@ bool indents_match(const char *a_line, size_t a_indent, const char
*
* A line is "the beginning of a paragraph" if it is part of a
* paragraph and
*
1) it is the top line of the file, or
*
2) the line above it is not part of a paragraph, or
*
3) the line above it does not have precisely the same quote
*
part, or
*
4) the indentation of this line is not an initial substring of
*
the indentation of the previous line, or
*
5) this line has no quote part and some indentation, and
*
autoindent isn't turned on.
*
1) it is the top line of the file, or
*
2) the line above it is not part of a paragraph, or
*
3) the line above it does not have precisely the same quote
*
part, or
*
4) the indentation of this line is not an initial substring of
*
the indentation of the previous line, or
*
5) this line has no quote part and some indentation, and
*
autoindent isn't turned on.
* The reason for number 5) is that if autoindent isn't turned on,
* then an indented line is expected to start a paragraph, as in
* books. Thus, nano can justify an indented paragraph only if
...
...
@@ -3139,8 +3139,7 @@ void do_linter(void)
*
* filenameorcategory:line:column:message (e.g. splint)
* filenameorcategory:line,column:message (e.g. pylint)
* filenameorcategory:line:message (e.g. pyflakes)
*/
* filenameorcategory:line:message (e.g. pyflakes) */
if
(
strstr
(
message
,
": "
)
!=
NULL
)
{
filename
=
strtok
(
read_buff_word
,
":"
);
if
((
linestr
=
strtok
(
NULL
,
":"
))
!=
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
17429d7f
...
...
@@ -671,7 +671,7 @@ int parse_kbinput(WINDOW *win)
/* ncurses and Slang don't support KEY_SUP. */
case
KEY_SUP
:
#endif
case
KEY_SR
:
/* Scroll backward, on Xfce4-terminal. */
case
KEY_SR
:
/* Scroll backward, on Xfce4-terminal. */
shift_held
=
TRUE
;
return
KEY_UP
;
#endif
...
...
@@ -680,7 +680,7 @@ int parse_kbinput(WINDOW *win)
/* ncurses and Slang don't support KEY_SDOWN. */
case
KEY_SDOWN
:
#endif
case
KEY_SF
:
/* Scroll forward, on Xfce4-terminal. */
case
KEY_SF
:
/* Scroll forward, on Xfce4-terminal. */
shift_held
=
TRUE
;
return
KEY_DOWN
;
#endif
...
...
@@ -690,7 +690,7 @@ int parse_kbinput(WINDOW *win)
#endif
case
SHIFT_HOME
:
shift_held
=
TRUE
;
case
KEY_A1
:
/* Home (7) on keypad with NumLock off. */
case
KEY_A1
:
/* Home (7) on keypad with NumLock off. */
return
KEY_HOME
;
#ifdef KEY_SEND
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
...
...
@@ -698,25 +698,25 @@ int parse_kbinput(WINDOW *win)
#endif
case
SHIFT_END
:
shift_held
=
TRUE
;
case
KEY_C1
:
/* End (1) on keypad with NumLock off. */
case
KEY_C1
:
/* End (1) on keypad with NumLock off. */
return
KEY_END
;
#ifndef NANO_TINY
#ifdef KEY_SPREVIOUS
case
KEY_SPREVIOUS
:
#endif
case
SHIFT_PAGEUP
:
/* Fake key, from Shift+Alt+Up. */
case
SHIFT_PAGEUP
:
/* Fake key, from Shift+Alt+Up. */
shift_held
=
TRUE
;
#endif
case
KEY_A3
:
/* PageUp (9) on keypad with NumLock off. */
case
KEY_A3
:
/* PageUp (9) on keypad with NumLock off. */
return
KEY_PPAGE
;
#ifndef NANO_TINY
#ifdef KEY_SNEXT
case
KEY_SNEXT
:
#endif
case
SHIFT_PAGEDOWN
:
/* Fake key, from Shift+Alt+Down. */
case
SHIFT_PAGEDOWN
:
/* Fake key, from Shift+Alt+Down. */
shift_held
=
TRUE
;
#endif
case
KEY_C3
:
/* PageDown (3) on keypad with NumLock off. */
case
KEY_C3
:
/* PageDown (3) on keypad with NumLock off. */
return
KEY_NPAGE
;
#ifdef KEY_SDC
/* Slang doesn't support KEY_SDC. */
...
...
@@ -740,7 +740,7 @@ int parse_kbinput(WINDOW *win)
/* Slang doesn't support KEY_BEG. */
case
KEY_BEG
:
#endif
case
KEY_B2
:
/* Center (5) on keypad with NumLock off. */
case
KEY_B2
:
/* Center (5) on keypad with NumLock off. */
return
ERR
;
#ifdef KEY_CANCEL
#ifdef KEY_SCANCEL
...
...
@@ -1975,7 +1975,7 @@ char *display_string(const char *buf, size_t column, size_t span, bool isdata)
/* For invalid codepoints, skip extra bytes. */
if
(
charlength
<
-
1
)
buf
+=
charlength
+
7
;
buf
+=
charlength
+
7
;
}
/* If there is more text than can be shown, make room for the $ or >. */
...
...
@@ -2555,7 +2555,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
* and the current line. But is there an end after the start
* at all? We don't paint unterminated starts. */
while
(
end_line
!=
NULL
&&
regexec
(
varnish
->
end
,
end_line
->
data
,
1
,
&
endmatch
,
0
)
==
REG_NOMATCH
)
1
,
&
endmatch
,
0
)
==
REG_NOMATCH
)
end_line
=
end_line
->
next
;
/* If there is no end, there is nothing to paint. */
...
...
@@ -3525,11 +3525,11 @@ void do_credits(void)
bool
old_no_help
=
ISSET
(
NO_HELP
);
int
kbinput
=
ERR
,
crpos
=
0
,
xlpos
=
0
;
const
char
*
credits
[
CREDIT_LEN
]
=
{
NULL
,
/* "The nano text editor" */
NULL
,
/* "version" */
NULL
,
/* "The nano text editor" */
NULL
,
/* "version" */
VERSION
,
""
,
NULL
,
/* "Brought to you by:" */
NULL
,
/* "Brought to you by:" */
"Chris Allegretta"
,
"Jordi Mallach"
,
"Adam Rogoyski"
,
...
...
@@ -3550,7 +3550,7 @@ void do_credits(void)
"Ryan Krebs"
,
"Albert Chin"
,
""
,
NULL
,
/* "Special thanks to:" */
NULL
,
/* "Special thanks to:" */
"Monique, Brielle & Joseph"
,
"Plattsburgh State University"
,
"Benet Laboratories"
,
...
...
@@ -3558,16 +3558,16 @@ void do_credits(void)
"Linda Young"
,
"Jeremy Robichaud"
,
"Richard Kolb II"
,
NULL
,
/* "The Free Software Foundation" */
NULL
,
/* "The Free Software Foundation" */
"Linus Torvalds"
,
NULL
,
/* "the many translators and the TP" */
NULL
,
/* "For ncurses:" */
NULL
,
/* "the many translators and the TP" */
NULL
,
/* "For ncurses:" */
"Thomas Dickey"
,
"Pavel Curtis"
,
"Zeyd Ben-Halim"
,
"Eric S. Raymond"
,
NULL
,
/* "and anyone else we forgot..." */
NULL
,
/* "Thank you for using nano!" */
NULL
,
/* "and anyone else we forgot..." */
NULL
,
/* "Thank you for using nano!" */
""
,
""
,
""
,
...
...
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