Compare commits

..

21 Commits

Author SHA1 Message Date
Benno Schulenberg
d646a3b97b po: update translations and regenerate POT file and PO files 2017-11-27 19:21:00 +01:00
Benno Schulenberg
800a997008 bump version numbers and add a news item for the 2.9.1 release 2017-11-27 19:06:26 +01:00
Benno Schulenberg
c17a8a9836 undo: discarding the stack does not always lose information
When some or all edits have been undone, and the user starts to make
new edits, the old part of the undo stack is discarded, but this does
not mean that the undo stack doesn't go back to the very beginning.

This really fixes https://savannah.gnu.org/bugs/?52504.
2017-11-27 16:19:28 +01:00
Benno Schulenberg
20aa167c14 files: always update the stat info when the entire file is written
This fixes https://savannah.gnu.org/bugs/?52519.
2017-11-26 20:57:30 +01:00
Benno Schulenberg
0c9905dbd0 undo: clear the Modified state when the very first edit is undone
This also means that no question needs to be asked when exiting.

This fixes https://savannah.gnu.org/bugs/?52504.
Reported-by: Peter Passchier <peter@passchier.net>
2017-11-26 19:55:44 +01:00
Benno Schulenberg
73c7f1cbdc history: make nano's state directory accessible for the user only 2017-11-26 19:54:47 +01:00
Benno Schulenberg
4200ed3003 history: create the path '~/.local/share/' when it is needed
On a freshly installed system, or for a new user, the default
XDG data directory may not exist yet.  So, create it when not.

Reported-by: Brand Huntsman <alpha@qzx.com>
2017-11-26 19:54:47 +01:00
Benno Schulenberg
2b314ed18f selecting: let a justification cancel a softmark
Otherwise a second justification will cancel it, which is weird.
2017-11-26 19:54:29 +01:00
Benno Schulenberg
88a0bb9685 selecting: do not cancel the softmark when the cursor is not moved
The softmark is now only cancelled when the cursor is moved without
Shift being held, not for things like ^L (Refresh), ^C (Position),
or ^G (Help).

This addresses https://savannah.gnu.org/bugs/?52470.
2017-11-26 19:41:14 +01:00
Benno Schulenberg
1e718cec35 tweaks: reshuffle a couple of lines, to put similar things together 2017-11-26 18:01:02 +01:00
Benno Schulenberg
5487551ce9 history: save the positions file also when a record was deleted
When a file is closed with the cursor on line 1, column 1, this
position is not recorded in file-positions history file -- if a
record for the file existed, it is deleted.  In the latter case
the history file needs to be saved, so that other instances of
nano will know about the deletion.

This fixes https://savannah.gnu.org/bugs/?52505.
2017-11-26 09:28:36 +01:00
Benno Schulenberg
763bf2ed26 gnulib: update to its current upstream state 2017-11-23 18:00:18 +01:00
Benno Schulenberg
cf63a2910a files: save the marked region only when we've prompted for a file name
Otherwise we would overwrite the current file with just the selection.

This fixes https://savannah.gnu.org/bugs/?52482.
2017-11-22 20:56:37 +01:00
Benno Schulenberg
7c3c942097 tweaks: adjust indentation after previous change 2017-11-22 19:43:50 +01:00
Benno Schulenberg
77d24300f3 tweaks: reshuffle a couple of lines, and frob a comment or two 2017-11-22 19:36:33 +01:00
Benno Schulenberg
d33b5f3dab tweaks: rename, rewrap, and reshuffle some stuff, and frob some comments 2017-11-21 21:17:08 +01:00
Benno Schulenberg
c24e95e3d6 tweaks: elide the 'mark_set' boolean -- the 'mark' pointer is enough
The pointer not being NULL is enough indication that the mark is set.

Also, rename the pointer from 'mark_begin' to simply 'mark', since
the former is kind of pleonastic.
2017-11-21 21:14:33 +01:00
Benno Schulenberg
c42489d946 linting: switch the mark off when the linter starts
Because the highlighting hinders the display of affected lines,
and, more importantly, only the highlighted part would be written
if the file was modified and the user answers yes to the "Save?"
prompt.

This fixes https://savannah.gnu.org/bugs/?52474.
2017-11-21 21:12:16 +01:00
Benno Schulenberg
2b438e6ef4 input: make the macro key discoverable by giving feedback when undefined 2017-11-20 19:57:33 +01:00
Benno Schulenberg
8165b20fc1 build: fix compilation with --disable-browser --disable-tabcomp
While doing that, move the affected function to the utils.c file
and tweak it a bit.

This fixes https://savannah.gnu.org/bugs/?52468.
2017-11-20 19:37:08 +01:00
Benno Schulenberg
bacb0f717d syntax: adjust the magic strings for the changes since file-5.10
Since file-5.10 (end of 2011), libmagic identifies a C file in most
cases as "C source" instead of as "C program".  Nano's magic strings
for some other files didn't match any more what file-5.32 currently
produces, either.  So, they have been adjusted, new ones added, and
old ones deleted.

This fixes https://savannah.gnu.org/bugs/?52445.
2017-11-19 11:24:30 +01:00
76 changed files with 15514 additions and 15379 deletions

View File

@@ -1,3 +1,29 @@
Changes between v2.9.0 and v2.9.1:
----------------------------------
Benno Schulenberg (20):
build: fix compilation with --disable-browser --disable-tabcomp
bump version numbers and add a news item for the 2.9.1 release
files: always update the stat info when the entire file is written
files: save the marked region only when we've prompted for a file name
gnulib: update to its current upstream state
history: create the path '~/.local/share/' when it is needed
history: make nano's state directory accessible for the user only
history: save the positions file also when a record was deleted
input: make the macro key discoverable by giving feedback when undefined
linting: switch the mark off when the linter starts
selecting: do not cancel the softmark when the cursor is not moved
selecting: let a justification cancel a softmark
syntax: adjust the magic strings for the changes since file-5.10
tweaks: adjust indentation after previous change
tweaks: elide the 'mark_set' boolean -- the 'mark' pointer is enough
tweaks: rename, rewrap, and reshuffle some stuff, and frob some comments
tweaks: reshuffle a couple of lines, and frob a comment or two
tweaks: reshuffle a couple of lines, to put similar things together
undo: clear the Modified state when the very first edit is undone
undo: discarding the stack does not always lose information
Changes between v2.8.7 and v2.9.0:
----------------------------------

7
NEWS
View File

@@ -1,3 +1,10 @@
2017.11.27 - GNU nano 2.9.1 "Damyatta" fixes a bug where, when the mark
is on, ^S would overwrite the file with just the marked
region. This release further clears the "Modified" flag
when all edits are undone, adds or updates some magic
strings, and does not forget when the cursor was last
at line 1, column 1.
2017.11.18 - GNU nano 2.9.0 "Eta" introduces the ability to record and
replay keystrokes (M-: to start and stop recording, M-;
to play the macro back), makes ^Q and ^S do something

View File

@@ -2,7 +2,7 @@
# Generate configure & friends for GIT users.
gnulib_url="git://git.sv.gnu.org/gnulib.git"
gnulib_hash="7f2c4e91361c28b8a6744a8b47f1d8d847c61d55"
gnulib_hash="b9d0b50f6cd122a1748e1e5b79ecca7a0fef214e"
modules="
futimens

View File

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
AC_INIT([GNU nano], [2.9.0], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.9.1], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.14])

View File

@@ -83,7 +83,7 @@
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.0</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano <i>should</i> be <b>2.9.1</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANO 1 "version 2.9.0" "November 2017"
.TH NANO 1 "version 2.9.1" "November 2017"
.SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico clone

View File

@@ -8,7 +8,7 @@
@smallbook
@set EDITION 0.5
@set VERSION 2.9.0
@set VERSION 2.9.1
@set UPDATED November 2017
@dircategory Editors
@@ -23,7 +23,7 @@
@titlepage
@title GNU @command{nano}
@subtitle a small and friendly text editor
@subtitle version 2.9.0
@subtitle version 2.9.1
@author Chris Allegretta
@page
@@ -63,7 +63,7 @@ e-mail: @email{chrisa@@asty.org}@*
@node Top
@top
This manual documents the GNU @command{nano} editor, version 2.9.0.
This manual documents the GNU @command{nano} editor, version 2.9.1.
@menu
* Introduction::

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH NANORC 5 "version 2.9.0" "November 2017"
.TH NANORC 5 "version 2.9.1" "November 2017"
.SH NAME
nanorc \- GNU nano's configuration file

View File

@@ -16,7 +16,7 @@
.\" Documentation License along with this program. If not, see
.\" <http://www.gnu.org/licenses/>.
.\"
.TH RNANO 1 "version 2.9.0" "November 2017"
.TH RNANO 1 "version 2.9.1" "November 2017"
.SH NAME
rnano \- a restricted nano

872
po/bg.po

File diff suppressed because it is too large Load Diff

952
po/ca.po

File diff suppressed because it is too large Load Diff

872
po/cs.po

File diff suppressed because it is too large Load Diff

872
po/da.po

File diff suppressed because it is too large Load Diff

892
po/de.po

File diff suppressed because it is too large Load Diff

876
po/eo.po

File diff suppressed because it is too large Load Diff

872
po/es.po

File diff suppressed because it is too large Load Diff

872
po/eu.po

File diff suppressed because it is too large Load Diff

872
po/fi.po

File diff suppressed because it is too large Load Diff

876
po/fr.po

File diff suppressed because it is too large Load Diff

872
po/ga.po

File diff suppressed because it is too large Load Diff

872
po/gl.po

File diff suppressed because it is too large Load Diff

958
po/hr.po

File diff suppressed because it is too large Load Diff

872
po/hu.po

File diff suppressed because it is too large Load Diff

872
po/id.po

File diff suppressed because it is too large Load Diff

876
po/it.po

File diff suppressed because it is too large Load Diff

962
po/ja.po

File diff suppressed because it is too large Load Diff

872
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

872
po/nb.po

File diff suppressed because it is too large Load Diff

878
po/nl.po

File diff suppressed because it is too large Load Diff

872
po/nn.po

File diff suppressed because it is too large Load Diff

872
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

876
po/ro.po

File diff suppressed because it is too large Load Diff

872
po/ru.po

File diff suppressed because it is too large Load Diff

872
po/sl.po

File diff suppressed because it is too large Load Diff

872
po/sr.po

File diff suppressed because it is too large Load Diff

948
po/sv.po

File diff suppressed because it is too large Load Diff

876
po/tr.po

File diff suppressed because it is too large Load Diff

872
po/uk.po

File diff suppressed because it is too large Load Diff

881
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -147,10 +147,10 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
if (cut_till_eof) {
/* Move all text up to the end of the file into the cutbuffer. */
cut_to_eof();
} else if (openfile->mark_set) {
} else if (openfile->mark) {
/* Move the marked text to the cutbuffer, and turn the mark off. */
cut_marked(&right_side_up);
openfile->mark_set = FALSE;
openfile->mark = NULL;
} else if (ISSET(CUT_FROM_CURSOR))
/* Move all text up to the end of the line into the cutbuffer. */
cut_to_eol();
@@ -216,7 +216,7 @@ void do_cut_text_void(void)
void do_copy_text(void)
{
static struct filestruct *next_contiguous_line = NULL;
bool mark_set = openfile->mark_set;
bool mark_is_set = (openfile->mark != NULL);
/* Remember the current viewport and cursor position. */
ssize_t is_edittop_lineno = openfile->edittop->lineno;
@@ -224,16 +224,16 @@ void do_copy_text(void)
ssize_t is_current_lineno = openfile->current->lineno;
size_t is_current_x = openfile->current_x;
if (mark_set || openfile->current != next_contiguous_line)
if (mark_is_set || openfile->current != next_contiguous_line)
cutbuffer_reset();
do_cut_text(TRUE, FALSE);
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line = (mark_set ? NULL : openfile->current);
next_contiguous_line = (mark_is_set ? NULL : openfile->current);
if (mark_set) {
/* Restore the viewport and cursor position. */
/* If the mark was set, restore the viewport and cursor position. */
if (mark_is_set) {
openfile->edittop = fsfromline(is_edittop_lineno);
openfile->firstcolumn = is_firstcolumn;
openfile->current = fsfromline(is_current_lineno);

View File

@@ -93,16 +93,14 @@ void make_new_buffer(void)
openfile->modified = FALSE;
#ifndef NANO_TINY
openfile->mark_set = FALSE;
openfile->mark_begin = NULL;
openfile->mark_begin_x = 0;
openfile->kind_of_mark = SOFTMARK;
openfile->mark = NULL;
openfile->fmt = NIX_FILE;
openfile->undotop = NULL;
openfile->current_undo = NULL;
openfile->last_action = OTHER;
openfile->pristine = TRUE;
openfile->current_stat = NULL;
openfile->lock_filename = NULL;
@@ -1594,7 +1592,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
* only if the file has not been modified by someone else since nano
* opened it. */
if (ISSET(BACKUP_FILE) && !tmp && realexists && openfile->current_stat &&
(method != OVERWRITE || openfile->mark_set ||
(method != OVERWRITE || openfile->mark ||
openfile->current_stat->st_mtime == st.st_mtime)) {
static struct timespec filetime[2];
char *backupname;
@@ -1952,7 +1950,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
}
#ifndef NANO_TINY
if (!openfile->mark_set)
if (!nonamechange)
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
#endif
@@ -2023,7 +2021,6 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
* the buffer is to be discarded. */
int do_writeout(bool exiting, bool withprompt)
{
int i = 0;
bool result = FALSE;
kind_of_writing_type method = OVERWRITE;
char *given;
@@ -2039,25 +2036,25 @@ int do_writeout(bool exiting, bool withprompt)
given = mallocstrcpy(NULL,
#ifndef NANO_TINY
(openfile->mark_set && !exiting) ? "" :
(openfile->mark && !exiting) ? "" :
#endif
openfile->filename);
while (TRUE) {
const char *msg;
int i = 0;
functionptrtype func;
#ifndef NANO_TINY
const char *formatstr, *backupstr;
formatstr = (openfile->fmt == DOS_FILE) ? _(" [DOS Format]") :
(openfile->fmt == MAC_FILE) ? _(" [Mac Format]") : "";
backupstr = ISSET(BACKUP_FILE) ? _(" [Backup]") : "";
/* If we're using restricted mode, don't display the "Write
* Selection to File" prompt. This function is disabled, since
* it allows reading from or writing to files not specified on
* the command line. */
if (openfile->mark_set && !exiting && !ISSET(RESTRICTED))
/* When the mark is on, offer to write the selection to disk, but
* not when in restricted mode, because it would allow writing to
* a file not specified on the command line. */
if (openfile->mark && !exiting && !ISSET(RESTRICTED))
/* TRANSLATORS: The next six strings are prompts. */
msg = (method == PREPEND) ? _("Prepend Selection to File") :
(method == APPEND) ? _("Append Selection to File") :
@@ -2092,171 +2089,167 @@ int do_writeout(bool exiting, bool withprompt)
if (i < 0) {
statusbar(_("Cancelled"));
break;
} else {
functionptrtype func = func_from_key(&i);
}
/* Upon request, abandon the buffer. */
if (func == discard_buffer) {
free(given);
return 2;
}
func = func_from_key(&i);
given = mallocstrcpy(given, answer);
/* Upon request, abandon the buffer. */
if (func == discard_buffer) {
free(given);
return 2;
}
given = mallocstrcpy(given, answer);
#ifdef ENABLE_BROWSER
if (func == to_files_void) {
char *chosen = do_browse_from(answer);
if (func == to_files_void) {
char *chosen = do_browse_from(answer);
if (chosen == NULL)
continue;
if (chosen == NULL)
continue;
/* We have a file now. Indicate this. */
free(answer);
answer = chosen;
} else
free(answer);
answer = chosen;
} else
#endif
#ifndef NANO_TINY
if (func == dos_format_void) {
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
DOS_FILE;
continue;
} else if (func == mac_format_void) {
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE :
MAC_FILE;
continue;
} else if (func == backup_file_void) {
TOGGLE(BACKUP_FILE);
continue;
} else if (func == prepend_void) {
method = (method == PREPEND) ? OVERWRITE : PREPEND;
continue;
} else if (func == append_void) {
method = (method == APPEND) ? OVERWRITE : APPEND;
continue;
} else
if (func == dos_format_void) {
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE : DOS_FILE;
continue;
} else if (func == mac_format_void) {
openfile->fmt = (openfile->fmt == MAC_FILE) ? NIX_FILE : MAC_FILE;
continue;
} else if (func == backup_file_void) {
TOGGLE(BACKUP_FILE);
continue;
} else if (func == prepend_void) {
method = (method == PREPEND) ? OVERWRITE : PREPEND;
continue;
} else if (func == append_void) {
method = (method == APPEND) ? OVERWRITE : APPEND;
continue;
}
#endif /* !NANO_TINY */
if (func == do_help_void) {
continue;
}
if (func == do_help_void) {
continue;
}
#ifdef ENABLE_EXTRA
/* If the current file has been modified, we've pressed
* Ctrl-X at the edit window to exit, we've pressed "y" at
* the "Save modified buffer" prompt to save, we've entered
* "zzy" as the filename to save under (hence "xyzzy"), and
* this is the first time we've done this, show an Easter
* egg. Display the credits. */
if (!did_credits && exiting && !ISSET(TEMP_FILE) &&
strcasecmp(answer, "zzy") == 0) {
do_credits();
did_credits = TRUE;
break;
}
/* If the current file has been modified, we've pressed
* Ctrl-X at the edit window to exit, we've pressed "y" at
* the "Save modified buffer" prompt to save, we've entered
* "zzy" as the filename to save under (hence "xyzzy"), and
* this is the first time we've done this, show an Easter
* egg. Display the credits. */
if (!did_credits && exiting && !ISSET(TEMP_FILE) &&
strcasecmp(answer, "zzy") == 0) {
do_credits();
did_credits = TRUE;
break;
}
#endif
if (method == OVERWRITE) {
bool name_exists, do_warning;
char *full_answer, *full_filename;
struct stat st;
if (method == OVERWRITE) {
bool name_exists, do_warning;
char *full_answer, *full_filename;
struct stat st;
full_answer = get_full_path(answer);
full_filename = get_full_path(openfile->filename);
name_exists = (stat((full_answer == NULL) ?
full_answer = get_full_path(answer);
full_filename = get_full_path(openfile->filename);
name_exists = (stat((full_answer == NULL) ?
answer : full_answer, &st) != -1);
if (openfile->filename[0] == '\0')
do_warning = name_exists;
else
do_warning = (strcmp((full_answer == NULL) ?
if (openfile->filename[0] == '\0')
do_warning = name_exists;
else
do_warning = (strcmp((full_answer == NULL) ?
answer : full_answer, (full_filename == NULL) ?
openfile->filename : full_filename) != 0);
free(full_filename);
free(full_answer);
free(full_filename);
free(full_answer);
if (do_warning) {
/* When in restricted mode, we aren't allowed to overwrite
* an existing file with the current buffer, nor to change
* the name of the current file if it already has one. */
if (ISSET(RESTRICTED)) {
/* TRANSLATORS: Restricted mode forbids overwriting. */
warn_and_shortly_pause(_("File exists -- "
"cannot overwrite"));
continue;
}
if (do_warning) {
/* When in restricted mode, we aren't allowed to overwrite
* an existing file with the current buffer, nor to change
* the name of the current file if it already has one. */
if (ISSET(RESTRICTED)) {
/* TRANSLATORS: Restricted mode forbids overwriting. */
warn_and_shortly_pause(_("File exists -- "
"cannot overwrite"));
continue;
}
if (!maychange) {
if (!maychange) {
#ifndef NANO_TINY
if (exiting || !openfile->mark_set)
if (exiting || !openfile->mark)
#endif
{
if (do_yesno_prompt(FALSE, _("Save file under "
"DIFFERENT NAME? ")) < 1)
continue;
maychange = TRUE;
}
}
if (name_exists) {
char *question = _("File \"%s\" exists; OVERWRITE? ");
char *message = charalloc(strlen(question) +
strlen(answer) + 1);
sprintf(message, question, answer);
i = do_yesno_prompt(FALSE, message);
free(message);
if (i < 1)
{
if (do_yesno_prompt(FALSE, _("Save file under "
"DIFFERENT NAME? ")) < 1)
continue;
maychange = TRUE;
}
}
if (name_exists) {
char *question = _("File \"%s\" exists; OVERWRITE? ");
char *message = charalloc(strlen(question) +
strlen(answer) + 1);
sprintf(message, question, answer);
i = do_yesno_prompt(FALSE, message);
free(message);
if (i < 1)
continue;
}
}
#ifndef NANO_TINY
/* Complain if the file exists, the name hasn't changed,
* and the stat information we had before does not match
* what we have now. */
else if (name_exists && openfile->current_stat &&
/* Complain if the file exists, the name hasn't changed,
* and the stat information we had before does not match
* what we have now. */
else if (name_exists && openfile->current_stat &&
(openfile->current_stat->st_mtime < st.st_mtime ||
openfile->current_stat->st_dev != st.st_dev ||
openfile->current_stat->st_ino != st.st_ino)) {
int response;
int response;
warn_and_shortly_pause(_("File on disk has changed"));
warn_and_shortly_pause(_("File on disk has changed"));
response = do_yesno_prompt(FALSE, _("File was modified "
response = do_yesno_prompt(FALSE, _("File was modified "
"since you opened it; continue saving? "));
blank_statusbar();
blank_statusbar();
/* When in tool mode and not called by 'savefile',
* overwrite the file right here when requested. */
if (ISSET(TEMP_FILE) && withprompt) {
free(given);
if (response == 1)
return write_file(openfile->filename,
NULL, FALSE, OVERWRITE, FALSE);
else if (response == 0)
return 2;
else
return 0;
} else if (response != 1) {
free(given);
return 1;
}
/* When in tool mode and not called by 'savefile',
* overwrite the file right here when requested. */
if (ISSET(TEMP_FILE) && withprompt) {
free(given);
if (response == 1)
return write_file(openfile->filename,
NULL, FALSE, OVERWRITE, FALSE);
else if (response == 0)
return 2;
else
return 0;
} else if (response != 1) {
free(given);
return 1;
}
#endif
}
/* Here's where we allow the selected text to be written to
* a separate file. If we're using restricted mode, this
* function is disabled, since it allows reading from or
* writing to files not specified on the command line. */
#ifndef NANO_TINY
if (openfile->mark_set && !exiting && !ISSET(RESTRICTED))
result = write_marked_file(answer, NULL, FALSE, method);
else
#endif
result = write_file(answer, NULL, FALSE, method, FALSE);
break;
}
/* Here's where we allow the selected text to be written to
* a separate file. If we're using restricted mode, this
* function is disabled, since it allows reading from or
* writing to files not specified on the command line. */
#ifndef NANO_TINY
if (openfile->mark && !exiting && withprompt && !ISSET(RESTRICTED))
result = write_marked_file(answer, NULL, FALSE, method);
else
#endif
result = write_file(answer, NULL, FALSE, method, FALSE);
break;
}
free(given);
@@ -2348,19 +2341,6 @@ int diralphasort(const void *va, const void *vb)
* have to use multibyte strcasecmp() instead. */
return mbstrcasecmp(a, b);
}
/* Free the memory allocated for array, which should contain len
* elements. */
void free_chararray(char **array, size_t len)
{
if (array == NULL)
return;
for (; len > 0; len--)
free(array[len - 1]);
free(array);
}
#endif
#ifdef ENABLE_TABCOMP

View File

@@ -51,11 +51,6 @@ int margin = 0;
int editwincols = -1;
/* The number of usable columns in the edit window: COLS - margin. */
#ifdef ENABLE_COLOR
bool have_palette = FALSE;
/* Whether the colors for the current syntax have been initialized. */
#endif
bool suppress_cursorpos = FALSE;
/* Should we skip constant position display for current keystroke? */
@@ -184,6 +179,8 @@ syntaxtype *syntaxes = NULL;
/* The global list of color syntaxes. */
char *syntaxstr = NULL;
/* The color syntax name specified on the command line. */
bool have_palette = FALSE;
/* Whether the colors for the current syntax have been initialized. */
#endif
bool refresh_needed = FALSE;

View File

@@ -26,10 +26,6 @@
#ifdef ENABLE_HISTORIES
#ifndef XDG_DATA_FALLBACK
#define XDG_DATA_FALLBACK "/.local/share"
#endif
#ifndef SEARCH_HISTORY
#define SEARCH_HISTORY "search_history"
#endif
@@ -272,10 +268,18 @@ bool have_statedir(void)
if (xdgdatadir != NULL)
statedir = concatenate(xdgdatadir, "/nano/");
else
statedir = concatenate(homedir, XDG_DATA_FALLBACK "/nano/");
statedir = concatenate(homedir, "/.local/share/nano/");
if (stat(statedir, &dirstat) == -1) {
if (mkdir(statedir, S_IRWXU | S_IRWXG | S_IRWXO) == -1) {
if (xdgdatadir == NULL) {
char *statepath = concatenate(homedir, "/.local");
mkdir(statepath, S_IRWXU | S_IRWXG | S_IRWXO);
free(statepath);
statepath = concatenate(homedir, "/.local/share");
mkdir(statepath, S_IRWXU);
free(statepath);
}
if (mkdir(statedir, S_IRWXU) == -1) {
history_error(N_("Unable to create directory %s: %s\n"
"It is required for saving/loading "
"search history or cursor positions.\n"),
@@ -326,7 +330,6 @@ void load_history(void)
history = &replace_history;
else
history = &execute_history;
}
fclose(hisfile);
@@ -548,6 +551,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
posprev->next = posptr->next;
free(posptr->filename);
free(posptr);
save_poshistory();
}
free(fullpath);
return;

View File

@@ -306,16 +306,14 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
edittop_inside = (openfile->edittop->lineno >= openfile->fileage->lineno &&
openfile->edittop->lineno <= openfile->filebot->lineno);
#ifndef NANO_TINY
if (openfile->mark_set) {
mark_inside = (openfile->mark_begin->lineno >=
openfile->fileage->lineno &&
openfile->mark_begin->lineno <=
openfile->filebot->lineno &&
(openfile->mark_begin != openfile->fileage ||
openfile->mark_begin_x >= top_x) &&
(openfile->mark_begin != openfile->filebot ||
openfile->mark_begin_x <= bot_x));
same_line = (openfile->mark_begin == openfile->fileage);
if (openfile->mark) {
mark_inside = (openfile->mark->lineno >= openfile->fileage->lineno &&
openfile->mark->lineno <= openfile->filebot->lineno &&
(openfile->mark != openfile->fileage ||
openfile->mark_x >= top_x) &&
(openfile->mark != openfile->filebot ||
openfile->mark_x <= bot_x));
same_line = (openfile->mark == openfile->fileage);
}
#endif
@@ -368,11 +366,11 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
openfile->current_x = top_x;
#ifndef NANO_TINY
if (mark_inside) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
} else if (same_line)
/* Update the pointer to this partially cut line. */
openfile->mark_begin = openfile->current;
openfile->mark = openfile->current;
#endif
top_save = openfile->fileage;
@@ -412,7 +410,7 @@ void ingraft_buffer(filestruct *somebuffer)
#ifndef NANO_TINY
/* Keep track of whether the mark begins inside the partition and
* will need adjustment. */
if (openfile->mark_set) {
if (openfile->mark) {
filestruct *top, *bot;
size_t top_x, bot_x;
@@ -445,10 +443,10 @@ void ingraft_buffer(filestruct *somebuffer)
* x coordinate for the change in the current line. */
if (openfile->fileage == openfile->filebot) {
#ifndef NANO_TINY
if (openfile->mark_set && single_line) {
openfile->mark_begin = openfile->current;
if (openfile->mark && single_line) {
openfile->mark = openfile->current;
if (!right_side_up)
openfile->mark_begin_x += openfile->current_x;
openfile->mark_x += openfile->current_x;
}
#endif
/* When the pasted stuff contains no newline, adjust the cursor's
@@ -456,12 +454,12 @@ void ingraft_buffer(filestruct *somebuffer)
openfile->current_x += current_x_save;
}
#ifndef NANO_TINY
else if (openfile->mark_set && single_line) {
else if (openfile->mark && single_line) {
if (right_side_up)
openfile->mark_begin = openfile->fileage;
openfile->mark = openfile->fileage;
else {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += openfile->current_x - current_x_save;
openfile->mark = openfile->current;
openfile->mark_x += openfile->current_x - current_x_save;
}
}
#endif
@@ -525,7 +523,7 @@ void delete_opennode(openfilestruct *fileptr)
free(fileptr->current_stat);
free(fileptr->lock_filename);
/* Free the undo stack. */
discard_until(NULL, fileptr);
discard_until(NULL, fileptr, TRUE);
#endif
free(fileptr);
}
@@ -1625,8 +1623,8 @@ int do_input(bool allow_funcs)
puddle[depth++] = (char)input;
}
#ifndef NANO_TINY
if (openfile->mark_set && openfile->kind_of_mark == SOFTMARK) {
openfile->mark_set = FALSE;
if (openfile->mark && openfile->kind_of_mark == SOFTMARK) {
openfile->mark = NULL;
refresh_needed = TRUE;
}
#endif
@@ -1689,11 +1687,13 @@ int do_input(bool allow_funcs)
#endif
{
#ifndef NANO_TINY
filestruct *was_current = openfile->current;
size_t was_x = openfile->current_x;
/* If Shifted movement occurs, set the mark. */
if (shift_held && !openfile->mark_set) {
openfile->mark_set = TRUE;
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
if (shift_held && !openfile->mark) {
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
openfile->kind_of_mark = SOFTMARK;
}
#endif
@@ -1701,10 +1701,11 @@ int do_input(bool allow_funcs)
s->scfunc();
#ifndef NANO_TINY
/* If Shiftless movement occurred, discard a soft mark. */
if (openfile->mark_set && !shift_held &&
openfile->kind_of_mark == SOFTMARK) {
openfile->mark_set = FALSE;
openfile->mark_begin = NULL;
if (!shift_held && openfile->mark &&
openfile->kind_of_mark == SOFTMARK &&
(openfile->current_x != was_x ||
openfile->current != was_current)) {
openfile->mark = NULL;
refresh_needed = TRUE;
}
#endif
@@ -1835,9 +1836,9 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
add_undo(ADD);
/* Note that current_x has not yet been incremented. */
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
openfile->current_x < openfile->mark_begin_x)
openfile->mark_begin_x += char_len;
if (openfile->current == openfile->mark &&
openfile->current_x < openfile->mark_x)
openfile->mark_x += char_len;
/* When the cursor is on the top row and not on the first chunk
* of a line, adding text there might change the preceding chunk

View File

@@ -382,22 +382,23 @@ typedef struct openfilestruct {
struct stat *current_stat;
/* The file's current stat information. */
#ifndef NANO_TINY
bool mark_set;
/* Whether the mark is on in this file. */
filestruct *mark_begin;
/* The file's line where the mark is, if any. */
size_t mark_begin_x;
/* The file's mark's x-coordinate position, if any. */
filestruct *mark;
/* The line in the file where the mark is set; NULL if not set. */
size_t mark_x;
/* The mark's x position in the above line. */
mark_type kind_of_mark;
/* Whether this is a soft or a hard mark. */
/* Whether it is a soft (with Shift) or a hard mark. */
file_format fmt;
/* The file's format. */
/* The file's format -- Unix or DOS or Mac or mixed. */
undo *undotop;
/* The top of the undo list. */
undo *current_undo;
/* The current (i.e. next) level of undo. */
undo_type last_action;
/* The type of the last action the user performed. */
bool pristine;
/* Whether the undo stack still contains the first edit -- it won't
* when a justification or spell check discarded the undo stack. */
char *lock_filename;
/* The path of the lockfile, if we created one. */
#endif

View File

@@ -43,10 +43,6 @@ extern bool as_an_at;
extern int margin;
extern int editwincols;
#ifdef ENABLE_COLOR
extern bool have_palette;
#endif
extern bool suppress_cursorpos;
extern message_type lastmessage;
@@ -106,9 +102,6 @@ extern openfilestruct *firstfile;
#ifndef NANO_TINY
extern char *matchbrackets;
#endif
#ifndef NANO_TINY
extern char *whitespace;
extern int whitespace_len[2];
#endif
@@ -124,7 +117,7 @@ extern char *quotestr;
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
#endif /* !ENABLE_JUSTIFY */
#endif
extern char *word_chars;
@@ -148,6 +141,7 @@ extern char *alt_speller;
#ifdef ENABLE_COLOR
extern syntaxtype *syntaxes;
extern char *syntaxstr;
extern bool have_palette;
#endif
extern bool refresh_needed;
@@ -315,7 +309,6 @@ void do_savefile(void);
char *real_dir_from_tilde(const char *buf);
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
int diralphasort(const void *va, const void *vb);
void free_chararray(char **array, size_t len);
#endif
#ifdef ENABLE_TABCOMP
char *input_tab(char *buf, bool allow_files, size_t *place,
@@ -542,7 +535,7 @@ void do_enter(void);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
void discard_until(const undo *thisitem, openfilestruct *thefile);
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep);
void add_undo(undo_type action);
void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action);
@@ -591,6 +584,9 @@ void snuggly_fit(char **str);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
void free_chararray(char **array, size_t len);
#endif
const char *fixbounds(const char *r);
#ifdef ENABLE_SPELLER
bool is_separate_word(size_t position, size_t length, const char *buf);

View File

@@ -83,7 +83,7 @@ void not_found_msg(const char *str)
void search_replace_abort(void)
{
#ifndef NANO_TINY
if (openfile->mark_set)
if (openfile->mark)
refresh_needed = TRUE;
#endif
regexp_cleanup();
@@ -140,7 +140,7 @@ int search_init(bool replacing, bool use_answer)
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") : "", replacing ?
#ifndef NANO_TINY
/* TRANSLATORS: The next two modify the search prompt. */
openfile->mark_set ? _(" (to replace) in selection") :
openfile->mark ? _(" (to replace) in selection") :
#endif
_(" (to replace)") : "", buf);
@@ -550,18 +550,18 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
bool skipone = FALSE;
int modus = REPLACING;
#ifndef NANO_TINY
filestruct *was_mark = openfile->mark;
filestruct *top, *bot;
size_t top_x, bot_x;
bool mark_was_set = openfile->mark_set;
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
/* If the mark is on, frame the region, and turn the mark off. */
if (mark_was_set) {
if (openfile->mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
openfile->mark_set = FALSE;
openfile->mark = NULL;
modus = INREGION;
/* Start either at the top or the bottom of the marked region. */
@@ -591,7 +591,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
#ifndef NANO_TINY
/* An occurrence outside of the marked region means we're done. */
if (mark_was_set && (openfile->current->lineno > bot->lineno ||
if (was_mark && (openfile->current->lineno > bot->lineno ||
openfile->current->lineno < top->lineno ||
(openfile->current == bot &&
openfile->current_x + match_len > bot_x) ||
@@ -643,20 +643,20 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
#ifndef NANO_TINY
/* If the mark was on and it was located after the cursor,
* then adjust its x position for any text length changes. */
if (mark_was_set && !right_side_up) {
if (openfile->current == openfile->mark_begin &&
openfile->mark_begin_x > openfile->current_x) {
if (openfile->mark_begin_x < openfile->current_x + match_len)
openfile->mark_begin_x = openfile->current_x;
if (was_mark && !right_side_up) {
if (openfile->current == was_mark &&
openfile->mark_x > openfile->current_x) {
if (openfile->mark_x < openfile->current_x + match_len)
openfile->mark_x = openfile->current_x;
else
openfile->mark_begin_x += length_change;
bot_x = openfile->mark_begin_x;
openfile->mark_x += length_change;
bot_x = openfile->mark_x;
}
}
/* If the mark was not on or it was before the cursor, then
* adjust the cursor's x position for any text length changes. */
if (!mark_was_set || right_side_up) {
if (!was_mark || right_side_up) {
#endif
if (openfile->current == real_current &&
openfile->current_x < *real_current_x) {
@@ -706,13 +706,11 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
else if (numreplaced > 0)
refresh_needed = TRUE;
#endif
#ifndef NANO_TINY
if (mark_was_set)
openfile->mark_set = TRUE;
openfile->mark = was_mark;
#endif
/* If the NO_NEWLINES flag isn't set, and text has been added to the
/* If "automatic newline" is enabled, and text has been added to the
* magicline, make a new magicline. */
if (!ISSET(NO_NEWLINES) && openfile->filebot->data[0] != '\0')
new_magicline();

View File

@@ -57,17 +57,14 @@ static completion_word *list_of_completions;
/* Toggle the mark. */
void do_mark(void)
{
openfile->mark_set = !openfile->mark_set;
if (openfile->mark_set) {
if (!openfile->mark) {
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
statusbar(_("Mark Set"));
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
openfile->kind_of_mark = HARDMARK;
} else {
openfile->mark = NULL;
statusbar(_("Mark Unset"));
openfile->mark_begin = NULL;
openfile->mark_begin_x = 0;
refresh_needed = TRUE;
}
}
@@ -117,9 +114,9 @@ void do_deletion(undo_type action)
#ifndef NANO_TINY
/* Adjust the mark if it is after the cursor on the current line. */
if (openfile->mark_set && openfile->mark_begin == openfile->current &&
openfile->mark_begin_x > openfile->current_x)
openfile->mark_begin_x -= char_len;
if (openfile->mark == openfile->current &&
openfile->mark_x > openfile->current_x)
openfile->mark_x -= char_len;
#endif
/* Adjust the file size. */
openfile->totsize--;
@@ -154,9 +151,9 @@ void do_deletion(undo_type action)
openfile->current_undo->newsize = openfile->totsize;
/* Adjust the mark if it was on the line that was "eaten". */
if (openfile->mark_set && openfile->mark_begin == joining) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += openfile->current_x;
if (openfile->mark == joining) {
openfile->mark = openfile->current;
openfile->mark_x += openfile->current_x;
}
#endif
unlink_node(joining);
@@ -217,9 +214,8 @@ void do_cutword(bool backward)
do_next_word(ISSET(WORD_BOUNDS), FALSE);
/* Set the mark at the start of that word. */
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
openfile->mark_set = TRUE;
openfile->mark = openfile->current;
openfile->mark_x = openfile->current_x;
/* Put the cursor back where it was, so an undo will put it there too. */
openfile->current = is_current;
@@ -286,8 +282,8 @@ void indent_a_line(filestruct *line, char *indentation)
openfile->totsize += indent_len;
/* Compensate for the change in the current line. */
if (openfile->mark_set && line == openfile->mark_begin)
openfile->mark_begin_x += indent_len;
if (line == openfile->mark)
openfile->mark_x += indent_len;
if (line == openfile->current) {
openfile->current_x += indent_len;
openfile->placewewant = xplustabs();
@@ -305,7 +301,7 @@ void do_indent(void)
size_t top_x, bot_x;
/* Use either all the marked lines or just the current line. */
if (openfile->mark_set)
if (openfile->mark)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
else {
@@ -387,11 +383,11 @@ void unindent_a_line(filestruct *line, size_t indent_len)
openfile->totsize -= indent_len;
/* Compensate for the change in the current line. */
if (openfile->mark_set && line == openfile->mark_begin) {
if (openfile->mark_begin_x < indent_len)
openfile->mark_begin_x = 0;
if (line == openfile->mark) {
if (openfile->mark_x < indent_len)
openfile->mark_x = 0;
else
openfile->mark_begin_x -= indent_len;
openfile->mark_x -= indent_len;
}
if (line == openfile->current) {
if (openfile->current_x < indent_len)
@@ -410,7 +406,7 @@ void do_unindent(void)
size_t top_x, bot_x;
/* Use either all the marked lines or just the current line. */
if (openfile->mark_set)
if (openfile->mark)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
else {
@@ -512,7 +508,7 @@ void do_comment(void)
#endif
/* Determine which lines to work on. */
if (openfile->mark_set)
if (openfile->mark)
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
else {
@@ -588,8 +584,8 @@ bool comment_line(undo_type action, filestruct *line, const char *comment_seq)
openfile->totsize += pre_len + post_len;
/* If needed, adjust the position of the mark and of the cursor. */
if (openfile->mark_set && line == openfile->mark_begin)
openfile->mark_begin_x += pre_len;
if (line == openfile->mark)
openfile->mark_x += pre_len;
if (line == openfile->current) {
openfile->current_x += pre_len;
openfile->placewewant = xplustabs();
@@ -613,11 +609,11 @@ bool comment_line(undo_type action, filestruct *line, const char *comment_seq)
openfile->totsize -= pre_len + post_len;
/* If needed, adjust the position of the mark and then the cursor. */
if (openfile->mark_set && line == openfile->mark_begin) {
if (openfile->mark_begin_x < pre_len)
openfile->mark_begin_x = 0;
if (line == openfile->mark) {
if (openfile->mark_x < pre_len)
openfile->mark_x = 0;
else
openfile->mark_begin_x -= pre_len;
openfile->mark_x -= pre_len;
}
if (line == openfile->current) {
if (openfile->current_x < pre_len)
@@ -699,9 +695,8 @@ void redo_cut(undo *u)
goto_line_posx(u->lineno, u->begin);
openfile->mark_set = TRUE;
openfile->mark_begin = fsfromline(u->mark_begin_lineno);
openfile->mark_begin_x = (u->xflags == WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
openfile->mark = fsfromline(u->mark_begin_lineno);
openfile->mark_x = (u->xflags == WAS_WHOLE_LINE) ? 0 : u->mark_begin_x;
do_cut_text(FALSE, FALSE);
@@ -837,9 +832,8 @@ void do_undo(void)
oldcutbottom = cutbottom;
cutbuffer = NULL;
cutbottom = NULL;
openfile->mark_begin = fsfromline(u->mark_begin_lineno);
openfile->mark_begin_x = u->mark_begin_x;
openfile->mark_set = TRUE;
openfile->mark = fsfromline(u->mark_begin_lineno);
openfile->mark_x = u->mark_begin_x;
goto_line_posx(u->lineno, u->begin);
cut_marked(NULL);
free_filestruct(u->cutbuffer);
@@ -847,7 +841,6 @@ void do_undo(void)
u->cutbottom = cutbottom;
cutbuffer = oldcutbuffer;
cutbottom = oldcutbottom;
openfile->mark_set = FALSE;
break;
case REPLACE:
undidmsg = _("text replace");
@@ -868,11 +861,17 @@ void do_undo(void)
openfile->current_undo = openfile->current_undo->next;
openfile->last_action = OTHER;
openfile->mark_set = FALSE;
openfile->mark = NULL;
openfile->placewewant = xplustabs();
openfile->totsize = u->wassize;
set_modified();
/* If *everything* was undone, then unset the "Modified" marker. */
if (openfile->current_undo == NULL && openfile->pristine) {
openfile->modified = FALSE;
titlebar(NULL);
} else
set_modified();
}
/* Redo the last thing(s) we undid. */
@@ -1021,7 +1020,7 @@ void do_redo(void)
openfile->current_undo = u;
openfile->last_action = OTHER;
openfile->mark_set = FALSE;
openfile->mark = NULL;
openfile->placewewant = xplustabs();
openfile->totsize = u->newsize;
@@ -1070,10 +1069,10 @@ void do_enter(void)
add_undo(ENTER);
/* Adjust the mark if it was on the current line after the cursor. */
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
openfile->current_x < openfile->mark_begin_x) {
openfile->mark_begin = newnode;
openfile->mark_begin_x += extra - openfile->current_x;
if (openfile->mark == openfile->current &&
openfile->mark_x > openfile->current_x) {
openfile->mark = newnode;
openfile->mark_x += extra - openfile->current_x;
}
#endif
@@ -1187,8 +1186,9 @@ bool execute_command(const char *command)
return TRUE;
}
/* Discard undo items that are newer than the given one, or all if NULL. */
void discard_until(const undo *thisitem, openfilestruct *thefile)
/* Discard undo items that are newer than the given one, or all if NULL.
* When keep is TRUE, do not touch the pristine flag. */
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
{
undo *dropit = thefile->undotop;
undo_group *group;
@@ -1214,6 +1214,10 @@ void discard_until(const undo *thisitem, openfilestruct *thefile)
/* Prevent a chain of editing actions from continuing. */
thefile->last_action = OTHER;
/* When requested, record that the undo stack was chopped. */
if (!keep)
thefile->pristine = FALSE;
}
/* Add a new undo struct to the top of the current pile. */
@@ -1230,7 +1234,7 @@ void add_undo(undo_type action)
return;
/* Blow away newer undo items if we add somewhere in the middle. */
discard_until(u, openfile);
discard_until(u, openfile, TRUE);
#ifdef DEBUG
fprintf(stderr, " >> Adding an undo...\n");
@@ -1315,9 +1319,9 @@ void add_undo(undo_type action)
break;
case CUT:
cutbuffer_reset();
if (openfile->mark_set) {
u->mark_begin_lineno = openfile->mark_begin->lineno;
u->mark_begin_x = openfile->mark_begin_x;
if (openfile->mark) {
u->mark_begin_lineno = openfile->mark->lineno;
u->mark_begin_x = openfile->mark_x;
u->xflags = MARK_WAS_SET;
} else if (!ISSET(CUT_FROM_CURSOR)) {
/* The entire line is being cut regardless of the cursor position. */
@@ -1802,9 +1806,8 @@ void justify_format(filestruct *paragraph, size_t skip)
#ifndef NANO_TINY
/* Keep track of the change in the current line. */
if (openfile->mark_set && openfile->mark_begin ==
paragraph && openfile->mark_begin_x >= end -
paragraph->data)
if (openfile->mark == paragraph &&
openfile->mark_x >= end - paragraph->data)
mark_shift += end_len;
#endif
}
@@ -1857,9 +1860,8 @@ void justify_format(filestruct *paragraph, size_t skip)
#ifndef NANO_TINY
/* Keep track of the change in the current line. */
if (openfile->mark_set && openfile->mark_begin ==
paragraph && openfile->mark_begin_x >= end -
paragraph->data)
if (openfile->mark == paragraph &&
openfile->mark_x >= end - paragraph->data)
mark_shift += end_len;
#endif
}
@@ -1895,10 +1897,10 @@ void justify_format(filestruct *paragraph, size_t skip)
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change in
* the current line. */
if (openfile->mark_set && openfile->mark_begin == paragraph) {
openfile->mark_begin_x -= mark_shift;
if (openfile->mark_begin_x > new_end - new_paragraph_data)
openfile->mark_begin_x = new_end - new_paragraph_data;
if (openfile->mark == paragraph) {
openfile->mark_x -= mark_shift;
if (openfile->mark_x > new_end - new_paragraph_data)
openfile->mark_x = new_end - new_paragraph_data;
}
#endif
} else
@@ -2027,14 +2029,9 @@ void backup_lines(filestruct *first_line, size_t par_len)
ssize_t edittop_lineno_save = openfile->edittop->lineno;
ssize_t current_lineno_save = openfile->current->lineno;
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
ssize_t mb_lineno_save = 0;
size_t mark_begin_x_save = 0;
if (old_mark_set) {
mb_lineno_save = openfile->mark_begin->lineno;
mark_begin_x_save = openfile->mark_begin_x;
}
bool mark_is_set = (openfile->mark != NULL);
ssize_t was_mark_lineno = (mark_is_set ? openfile->mark->lineno : 0);
size_t was_mark_x = openfile->mark_x;
#endif
/* Move bot down par_len lines to the line after the last line of
@@ -2056,10 +2053,9 @@ void backup_lines(filestruct *first_line, size_t par_len)
if (openfile->current != openfile->fileage) {
top = openfile->current->prev;
#ifndef NANO_TINY
if (old_mark_set &&
openfile->current->lineno == mb_lineno_save) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = mark_begin_x_save;
if (mark_is_set && openfile->current->lineno == was_mark_lineno) {
openfile->mark = openfile->current;
openfile->mark_x = was_mark_x;
}
#endif
} else
@@ -2072,9 +2068,9 @@ void backup_lines(filestruct *first_line, size_t par_len)
if (top->lineno == current_lineno_save)
openfile->current = top;
#ifndef NANO_TINY
if (old_mark_set && top->lineno == mb_lineno_save) {
openfile->mark_begin = top;
openfile->mark_begin_x = mark_begin_x_save;
if (mark_is_set && top->lineno == was_mark_lineno) {
openfile->mark = top;
openfile->mark_x = was_mark_x;
}
#endif
top = top->prev;
@@ -2191,8 +2187,8 @@ void do_justify(bool full_justify)
filestruct *current_save = openfile->current;
size_t current_x_save = openfile->current_x;
#ifndef NANO_TINY
filestruct *mark_begin_save = openfile->mark_begin;
size_t mark_begin_x_save = openfile->mark_begin_x;
filestruct *was_mark = openfile->mark;
size_t was_mark_x = openfile->mark_x;
#endif
bool modified_save = openfile->modified;
@@ -2257,7 +2253,7 @@ void do_justify(bool full_justify)
* current and filebot if filebot is the last line in the
* paragraph. Set filebot_inpar to TRUE if this is the case. */
filebot_inpar = (openfile->current->lineno + par_len ==
openfile->filebot->lineno + 1);
openfile->filebot->lineno + 1);
/* If we haven't already done it, move the original paragraph(s)
* to the justify buffer, splice a copy of the original
@@ -2335,9 +2331,9 @@ void do_justify(bool full_justify)
#ifndef NANO_TINY
/* If needed, adjust the coordinates of the mark. */
if (openfile->mark_set && openfile->mark_begin == next_line) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x += line_len - indent_len;
if (openfile->mark == next_line) {
openfile->mark = openfile->current;
openfile->mark_x += line_len - indent_len;
}
#endif
/* Don't destroy edittop! */
@@ -2350,8 +2346,8 @@ void do_justify(bool full_justify)
* this line again. */
i--;
par_len--;
openfile->totsize--;
par_len--;
}
/* Call justify_format() on the paragraph, which will remove
@@ -2396,21 +2392,19 @@ void do_justify(bool full_justify)
strcpy(openfile->current->next->data + indent_len,
openfile->current->data + break_pos);
par_len++;
openfile->totsize += indent_len + 1;
par_len++;
#ifndef NANO_TINY
/* Adjust the mark coordinates to compensate for the change
* in the current line. */
if (openfile->mark_set &&
openfile->mark_begin == openfile->current &&
openfile->mark_begin_x > break_pos) {
openfile->mark_begin = openfile->current->next;
openfile->mark_begin_x -= break_pos - indent_len;
if (openfile->mark == openfile->current &&
openfile->mark_x > break_pos) {
openfile->mark = openfile->current->next;
openfile->mark_x -= break_pos - indent_len;
}
#endif
/* Break the current line. */
/* When requested, snip all trailing blanks. */
if (ISSET(JUSTIFY_TRIM)) {
while (break_pos > 0 &&
is_blank_mbchar(&openfile->current->data[break_pos - 1])) {
@@ -2418,11 +2412,13 @@ void do_justify(bool full_justify)
openfile->totsize--;
}
}
/* Break the current line. */
null_at(&openfile->current->data, break_pos);
/* Go to the next line. */
par_len--;
openfile->current = openfile->current->next;
par_len--;
}
/* We're done breaking lines, so we don't need indent_string
@@ -2454,6 +2450,10 @@ void do_justify(bool full_justify)
if (first_par_line != NULL)
last_par_line = openfile->current;
/* Let a justification cancel a soft mark. */
if (openfile->mark && openfile->kind_of_mark == SOFTMARK)
openfile->mark = NULL;
edit_refresh();
/* Show "Unjustify" in the help lines. */
@@ -2500,9 +2500,9 @@ void do_justify(bool full_justify)
openfile->current = current_save;
openfile->current_x = current_x_save;
#ifndef NANO_TINY
if (openfile->mark_set) {
openfile->mark_begin = mark_begin_save;
openfile->mark_begin_x = mark_begin_x_save;
if (openfile->mark) {
openfile->mark = was_mark;
openfile->mark_x = was_mark_x;
}
#endif
openfile->modified = modified_save;
@@ -2521,7 +2521,7 @@ void do_justify(bool full_justify)
#ifndef NANO_TINY
/* Throw away the entire undo stack, to prevent a crash when
* the user tries to undo something in the justified text. */
discard_until(NULL, openfile);
discard_until(NULL, openfile, FALSE);
#endif
/* Blow away the unjustified text. */
free_filestruct(jusbuffer);
@@ -2569,7 +2569,6 @@ bool do_int_spell_fix(const char *word)
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
#ifndef NANO_TINY
bool old_mark_set = openfile->mark_set;
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
@@ -2591,7 +2590,7 @@ bool do_int_spell_fix(const char *word)
#ifndef NANO_TINY
/* If the mark is on, start at the beginning of the marked region. */
if (old_mark_set) {
if (openfile->mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
/* If the region is marked normally, swap the end points, so that
@@ -2599,10 +2598,9 @@ bool do_int_spell_fix(const char *word)
if (right_side_up) {
openfile->current = top;
openfile->current_x = top_x;
openfile->mark_begin = bot;
openfile->mark_begin_x = bot_x;
openfile->mark = bot;
openfile->mark_x = bot_x;
}
openfile->mark_set = FALSE;
} else
#endif
/* Otherwise, start from the top of the file. */
@@ -2623,9 +2621,14 @@ bool do_int_spell_fix(const char *word)
} else if (result == 1) {
size_t from_col = xplustabs();
size_t to_col = from_col + strlenpt(word);
#ifndef NANO_TINY
filestruct *saved_mark = openfile->mark;
openfile->mark = NULL;
#endif
edit_refresh();
#ifndef NANO_TINY
openfile->mark = saved_mark;
#endif
spotlight(TRUE, from_col, to_col);
/* Let the user supply a correctly spelled alternative. */
@@ -2636,10 +2639,6 @@ bool do_int_spell_fix(const char *word)
/* If a replacement was given, go through all occurrences. */
if (proceed && strcmp(word, answer) != 0) {
#ifndef NANO_TINY
/* Replacements should happen only in the marked region. */
openfile->mark_set = old_mark_set;
#endif
do_replace_loop(word, TRUE, current_save, &current_x_save);
/* TRANSLATORS: Shown after fixing misspellings in one word. */
@@ -2649,18 +2648,17 @@ bool do_int_spell_fix(const char *word)
}
#ifndef NANO_TINY
if (old_mark_set) {
if (openfile->mark) {
/* Restore the (compensated) end points of the marked region. */
if (right_side_up) {
openfile->current = openfile->mark_begin;
openfile->current_x = openfile->mark_begin_x;
openfile->mark_begin = top;
openfile->mark_begin_x = top_x;
openfile->current = openfile->mark;
openfile->current_x = openfile->mark_x;
openfile->mark = top;
openfile->mark_x = top_x;
} else {
openfile->current = top;
openfile->current_x = top_x;
}
openfile->mark_set = TRUE;
} else
#endif
{
@@ -2932,16 +2930,15 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
/* Replace the marked text (or the entire text) of the current buffer
* with the spell-checked text. */
if (openfile->mark_set) {
if (openfile->mark) {
filestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up;
ssize_t was_mark_lineno = openfile->mark_begin->lineno;
openfile->mark_set = FALSE;
ssize_t was_mark_lineno = openfile->mark->lineno;
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
openfile->mark = NULL;
replace_marked_buffer(tempfile_name, top, top_x, bot, bot_x);
@@ -2950,11 +2947,10 @@ const char *do_alt_speller(char *tempfile_name)
if (right_side_up)
current_x_save = openfile->current_x;
else
openfile->mark_begin_x = openfile->current_x;
openfile->mark_x = openfile->current_x;
/* Restore the mark's position and turn it back on. */
openfile->mark_begin = fsfromline(was_mark_lineno);
openfile->mark_set = TRUE;
/* Restore the mark. */
openfile->mark = fsfromline(was_mark_lineno);
} else
#endif
replace_buffer(tempfile_name);
@@ -2974,7 +2970,7 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
/* Flush the undo stack, to avoid making a mess when the user
* tries to undo things in spell-corrected lines. */
discard_until(NULL, openfile);
discard_until(NULL, openfile, FALSE);
#endif
}
@@ -3008,7 +3004,7 @@ void do_spell(void)
}
#ifndef NANO_TINY
if (openfile->mark_set)
if (openfile->mark)
status = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
else
#endif
@@ -3068,6 +3064,9 @@ void do_linter(void)
return;
}
openfile->mark = NULL;
edit_refresh();
if (openfile->modified) {
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
@@ -3398,7 +3397,7 @@ void do_formatter(void)
#ifndef NANO_TINY
/* We're not supporting partial formatting, oi vey. */
openfile->mark_set = FALSE;
openfile->mark = NULL;
#endif
status = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
@@ -3468,7 +3467,7 @@ void do_formatter(void)
#ifndef NANO_TINY
/* Flush the undo stack, to avoid a mess or crash when
* the user tries to undo things in reformatted lines. */
discard_until(NULL, openfile);
discard_until(NULL, openfile, FALSE);
#endif
finalstatus = _("Finished formatting");
}
@@ -3503,17 +3502,17 @@ void do_wordlinechar_count(void)
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
bool old_mark_set = openfile->mark_set;
filestruct *was_mark = openfile->mark;
filestruct *top, *bot;
size_t top_x, bot_x;
/* If the mark is on, partition the buffer so that it
* contains only the marked text, and turn the mark off. */
if (old_mark_set) {
if (was_mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
filepart = partition_filestruct(top, top_x, bot, bot_x);
openfile->mark_set = FALSE;
openfile->mark = NULL;
}
/* Start at the top of the file. */
@@ -3533,14 +3532,14 @@ 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) {
if (was_mark) {
nlines = openfile->filebot->lineno - openfile->fileage->lineno + 1;
chars = get_totsize(openfile->fileage, openfile->filebot);
/* Unpartition the buffer so that it contains all the text
* again, and turn the mark back on. */
unpartition_filestruct(&filepart);
openfile->mark_set = TRUE;
openfile->mark = was_mark;
} else {
nlines = openfile->filebot->lineno;
chars = openfile->totsize;
@@ -3552,7 +3551,7 @@ void do_wordlinechar_count(void)
openfile->placewewant = pww_save;
/* Display the total word, line, and character counts on the statusbar. */
statusline(HUSH, _("%sWords: %lu Lines: %ld Chars: %lu"), old_mark_set ?
statusline(HUSH, _("%sWords: %lu Lines: %ld Chars: %lu"), was_mark ?
_("In Selection: ") : "", (unsigned long)words, (long)nlines,
(unsigned long)chars);
}

View File

@@ -193,6 +193,20 @@ void sunder(char *str)
}
}
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
/* Free the memory of the given array, which should contain len elements. */
void free_chararray(char **array, size_t len)
{
if (array == NULL)
return;
while (len > 0)
free(array[--len]);
free(array);
}
#endif
/* Fix the regex if we're on platforms which require an adjustment
* from GNU-style to BSD-style word boundaries. */
const char *fixbounds(const char *r)
@@ -499,18 +513,18 @@ void remove_magicline(void)
void mark_order(const filestruct **top, size_t *top_x, const filestruct
**bot, size_t *bot_x, bool *right_side_up)
{
if ((openfile->current->lineno == openfile->mark_begin->lineno &&
openfile->current_x > openfile->mark_begin_x) ||
openfile->current->lineno > openfile->mark_begin->lineno) {
*top = openfile->mark_begin;
*top_x = openfile->mark_begin_x;
if ((openfile->current->lineno == openfile->mark->lineno &&
openfile->current_x > openfile->mark_x) ||
openfile->current->lineno > openfile->mark->lineno) {
*top = openfile->mark;
*top_x = openfile->mark_x;
*bot = openfile->current;
*bot_x = openfile->current_x;
if (right_side_up != NULL)
*right_side_up = TRUE;
} else {
*bot = openfile->mark_begin;
*bot_x = openfile->mark_begin_x;
*bot = openfile->mark;
*bot_x = openfile->mark_x;
*top = openfile->current;
*top_x = openfile->current_x;
if (right_side_up != NULL)

View File

@@ -101,8 +101,10 @@ void run_macro(void)
return;
}
if (macro_length == 0)
if (macro_length == 0) {
statusline(HUSH, _("Macro is empty"));
return;
}
free(key_buffer);
key_buffer = (int *)nmalloc(macro_length * sizeof(int));
@@ -2702,10 +2704,10 @@ void edit_draw(filestruct *fileptr, const char *converted,
#ifndef NANO_TINY
/* If the mark is on, and fileptr is at least partially selected, we
* need to paint it. */
if (openfile->mark_set &&
(fileptr->lineno <= openfile->mark_begin->lineno ||
if (openfile->mark &&
(fileptr->lineno <= openfile->mark->lineno ||
fileptr->lineno <= openfile->current->lineno) &&
(fileptr->lineno >= openfile->mark_begin->lineno ||
(fileptr->lineno >= openfile->mark->lineno ||
fileptr->lineno >= openfile->current->lineno)) {
const filestruct *top, *bot;
/* The lines where the marked region begins and ends. */
@@ -2876,7 +2878,7 @@ int update_softwrapped_line(filestruct *fileptr)
bool line_needs_update(const size_t old_column, const size_t new_column)
{
#ifndef NANO_TINY
if (openfile->mark_set)
if (openfile->mark)
return TRUE;
else
#endif
@@ -3266,7 +3268,7 @@ void edit_redraw(filestruct *old_current, update_type manner)
#ifndef NANO_TINY
/* If the mark is on, update all lines between old_current and current. */
if (openfile->mark_set) {
if (openfile->mark) {
filestruct *line = old_current;
while (line != openfile->current) {

View File

@@ -1,7 +1,7 @@
## Here is an example for assembler.
syntax "asm" "\.(S|s|asm)$"
magic "[Aa]ssembl(y|er)"
magic "assembler source"
comment "//"
color red "\<[A-Z_]{2,}\>"

View File

@@ -1,7 +1,7 @@
## Here is an example for awk.
syntax "awk" "\.awk$"
magic "awk.*script text"
magic "awk script"
comment "#"
# Records.

View File

@@ -1,7 +1,7 @@
## Here is an example for C/C++.
syntax "c" "\.(c(c|pp|xx|\+\+)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
magic "(ASCII|UTF-8 Unicode) C(\+\+)? program text"
magic "^(C|C\+\+) (source|program)"
comment "//"
# Constants.

View File

@@ -1,6 +1,7 @@
## Here is an example for Emacs Lisp.
syntax "elisp" "\.el$"
magic "Lisp/Scheme program"
comment ";"
# Basic functions/macros

View File

@@ -2,7 +2,6 @@
syntax "guile" "\.scm$"
header "^#!.*guile"
magic "guile"
comment ";"
# Basic scheme functions

View File

@@ -1,7 +1,7 @@
## Here is an example for HTML.
syntax "html" "\.html?$"
magic "HTML document text"
magic "HTML document"
comment "<!--|-->"
# Tags:

View File

@@ -5,6 +5,7 @@
## Version: 2011-05-05
syntax "lua" "\.lua$"
magic "Lua script"
comment "--"
color brightwhite "\[\[.*\]\]"

View File

@@ -1,6 +1,7 @@
## Here is an example for Makefiles.
syntax "makefile" "Makefile[^/]*$" "\.(make|mk)$"
magic "makefile script"
comment "#"
color red "[:=]"

View File

@@ -1,7 +1,7 @@
## Here is an example for manpages.
syntax "man" "\.[1-9]x?$"
magic "troff or preprocessor input text"
magic "troff or preprocessor input"
comment ".\""
color green "\.(SH|SS|TH) .*$"

View File

@@ -1,6 +1,7 @@
## Here is an example for C/C++/Obj-C.
syntax "m" "\.m$"
magic "Objective-C source"
comment "//"
# Stuffs,

View File

@@ -1,6 +1,7 @@
## Syntax highlighting for OCaml.
syntax "ocaml" "\.mli?$"
magic "OCaml"
comment "(*|*)"
# Uid:

View File

@@ -1,7 +1,7 @@
## Here is an example for patch files.
syntax "patch" "\.(patch|diff|debdiff)$"
magic "diff output text"
magic "diff output"
# There is no official support for comments in patch files.
comment ""

View File

@@ -2,7 +2,7 @@
syntax "perl" "\.p[lm]$"
header "^#!.*perl[-0-9._]*"
magic "Perl script text"
magic "Perl script"
comment "#"
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"

View File

@@ -1,7 +1,7 @@
## Here is an example for PHP.
syntax "php" "\.ph(p[23457s~]?|tml)$"
magic "PHP script text"
magic "PHP script"
comment "//"
# PHP markings.

View File

@@ -1,7 +1,6 @@
## Here is an example for PostgreSQL.
syntax "sql" "\.sql[2345s~]?$"
magic "PostgreSQL script text"
comment "-- "
# Functions.

View File

@@ -2,6 +2,7 @@
syntax "python" "\.py$"
header "^#!.*python[-0-9._]*"
magic "Python script"
linter pyflakes
comment "#"

View File

@@ -2,6 +2,7 @@
syntax "ruby" "\.rb$"
header "^#!.*ruby[-0-9._]*"
magic "Ruby script"
linter ruby -w -c
comment "#"

View File

@@ -2,7 +2,7 @@
syntax "sh" "\.sh$"
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
magic "(POSIX|Bourne.*) shell script text"
magic "(POSIX|Bourne-Again) shell script.*text"
linter dash -n
comment "#"

View File

@@ -1,6 +1,7 @@
## Syntax highlighting for Tcl files.
syntax "tcl" "\.tcl$"
magic "Tcl(/Tk)? script"
comment "#"
# Standard Tcl [info commands]:

View File

@@ -1,6 +1,7 @@
## Here is a short example for TeX files.
syntax "tex" "\.tex$"
magic "(La)?TeX document"
linter chktex -v0 -q -I
comment "%"

View File

@@ -2,7 +2,7 @@
syntax "texinfo" "\.texi$"
header "^\\input texinfo"
magic "Texinfo source text"
magic "Texinfo source"
comment "@c "
# Command arguments, trailing and enclosed.

View File

@@ -2,7 +2,7 @@
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
header "<\?xml.*version=.*\?>"
magic "(XML|SGML) (sub)?document text"
magic "(XML|SGML) (sub)?document"
comment "<!--|-->"
# The entire content of the tag: