Commit Graph

224 Commits (d865d7ac8ff15b4de4d1f1682def0978b57d68fa)

Author SHA1 Message Date
Benno Schulenberg f72fecee9b copyright: update the years for the FSF
And one for me, for the much changed keyboard stuff.
2018-01-24 10:14:43 +01:00
Benno Schulenberg 87206c0607 tweaks: convert the indentation to use only tabs
Each leading tab is converted to two tabs, and any leading four spaces
is converted to one tab.  The intended tab size (for keeping most lines
within 80 columns) is now four.
2017-12-29 20:06:50 +01:00
Benno Schulenberg 440a128d25 indenting: keep affecting last line of marked region if it was at first
When unindenting/uncommenting affected the bottom line of the marked
region, keep affecting this line also during subsequent consecutive
indenting/commenting.

This fixes https://savannah.gnu.org/bugs/?52718.
2017-12-29 16:52:17 +01:00
Benno Schulenberg 23d66949e1 tweaks: frob four comments, and rewrap two lines 2017-12-24 11:53:38 +01:00
Benno Schulenberg c22fef18e4 tweaks: reshuffle a bit of common code, moving it to an existing function 2017-12-23 21:50:18 +01:00
Benno Schulenberg ee5b250b66 indenting: don't exclude last line of region when region is empty
This fixes https://savannah.gnu.org/bugs/?52717.
2017-12-23 11:42:25 +01:00
Benno Schulenberg 25b1114e03 tweaks: elide two parameters from the get_region() function 2017-12-21 19:47:22 +01:00
Benno Schulenberg 4b8a387529 text: let indenting/commenting skip the last line if its x is zero
If the marked region ends at the start of a line, do not include that
line in the indenting/undenting or commenting/uncommenting.  This is
closer to what the eye would expect.
2017-12-21 19:47:22 +01:00
Benno Schulenberg df41114e0e tweaks: drop some old debugging code plus a superfluous comment 2017-12-21 19:45:18 +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 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 5239e7c52b copyright: update some years, and standardize on the dashed format 2017-11-12 10:46:20 +01:00
Benno Schulenberg a7f5907b43 tweaks: move a general function to the utils.c file 2017-11-11 11:34:39 +01:00
Benno Schulenberg 7b133aa6f9 tweaks: change some mayday messages, to urge the user to report a bug
Also, diversify them, and no longer mark them for translation.
2017-11-07 19:14:33 +01:00
David Lawrence Ramsey 477b246771 tweaks: use printf's z modifier for most of the size_t/ssize_t types
Also, properly refer to numreplaced as signed, since it's ssize_t
(even though it's only shown when positive).
2017-11-07 17:55:21 +01:00
Simon Ochsenreither c16e79b612 startup: look for nanorc and history files also in the XDG directories
When not finding a .nanorc file in the user's home directory, nano will
look for a nanorc file in $XDG_CONFIG_HOME and in the ~/.config/nano/
fallback directory.  And when not finding a .nano/ subdir in the user's
home directory, nano will look for (or create) the history files in
$XDG_DATA_HOME or in the ~/.local/share/nano/ fallback directory.

This is a partial implementation of the XDG Base Directory Specification:
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html,
for the purpose of reducing the clutter in a user's home directory, and
to make it easier to back up just the configuration files.

Signed-off-by: Simon Ochsenreither <simon@ochsenreither.de>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-11-04 20:11:57 +01:00
Benno Schulenberg 2a4fc9591f tweaks: transform the token DISABLE_SPELLER to ENABLE_SPELLER 2017-10-31 19:32:42 +01:00
Benno Schulenberg 7c3c3cbb3b tweaks: discard some obsolete debugging stuff 2017-09-22 21:59:51 +02:00
Benno Schulenberg 11072ed587 tweaks: sort the includes, so it's a little easier to see what is there 2017-08-06 19:40:30 +02:00
Benno Schulenberg 80686bb525 tweaks: remove includes that appear to be superfluous
Without them, nano still compiles for me, with everything enabled,
even when using --enable-debug, --enable-utf8, and --with-slang.
2017-08-06 09:08:30 +02:00
Benno Schulenberg aa14526cb3 tweaks: exclude from the tiny version five error-betraying messages 2017-05-16 22:13:10 +02:00
Benno Schulenberg d29d49aece tweaks: remove an old fault-catching message 2017-05-16 20:09:03 +02:00
David Lawrence Ramsey 03c3e2b7c0 tweaks: fix several whitespace irregularities
Add missing spaces, remove excess spaces, and
replace groups of indentation spaces with tabs.
2017-05-07 18:20:01 +02:00
Benno Schulenberg 4953dcec20 tweaks: add another warning for an impossible condition 2017-05-05 22:00:04 +02:00
Benno Schulenberg c42d6d378a tweaks: check for an empty needle in a central place
Searching for an empty string should be impossible, it should never
happen, but it is bit too hard to verify this at the moment.
2017-04-30 20:32:01 +02:00
Benno Schulenberg 46430999d5 build: make --enable-help properly depend on --enable-multibuffer
And in the process transform the token DISABLE_HELP to ENABLE_HELP.
2017-04-25 18:27:55 +02:00
Benno Schulenberg 040bd93cc4 tweaks: distinguish (in the comments) between buffers and linestructs
Call something a buffer when it refers to a linked list of linestructs,
and call something a linestruct when it is a struct that describes a
single line.
2017-04-19 17:48:52 +02:00
Benno Schulenberg 8993c36366 tweaks: reduce the number of additions that actual_x() performs
Replace them by a single subtraction.
2017-04-10 19:25:40 +02:00
Benno Schulenberg 754c62c5cc copyright: update the years, use ranges, and explain this usage
The interval 2013-2017 for the Free Software Foundation is valid
because in those years there were releases with changes by either
Chris or David, and the GNU maintainers guide advises to mention
a new year in all files of a package, not just in the ones that
actually changed, and be done with it for the rest of the year.
2017-04-09 12:09:23 +02:00
Benno Schulenberg aedc3ddd49 tweaks: replace a function call or a macro with a hard number
Verify at startup that the number is not too small.
2017-04-04 19:17:02 +02:00
David Lawrence Ramsey df2a4679d5 softwrap: account for softwrap in get_page_start()
In softwrap mode, nano doesn't horizontally scroll lines at all, so in
this case get_page_start() should always return zero.
2017-03-22 10:44:04 +01:00
Mike Frysinger a9a45f2b55 fix build on systems without pwd.h
Windows doesn't have *nix style account databases.
2017-03-06 12:02:09 +01:00
Mike Frysinger 3deec4352b assume regex.h support is always available
Now that we pull in the gnulib regex module, we can assume it exists.
2017-03-06 12:01:08 +01:00
Mike Frysinger e9a3f858bc drop the getdelim/getline fallback functions
Switch over to gnulib for these.
2017-03-06 12:01:02 +01:00
Benno Schulenberg d365ca80bf tweaks: optimize determining the number of columns that a text spans
Give the strlenpt() routine its own implementation, so that it avoids
a needless comparison plus subtraction in the inner loop.
2017-02-24 11:01:24 +01:00
David Lawrence Ramsey 17f5c056ca tweaks: reduce duplicate code in new_magicline() and move_to_filestruct()
These two functions unnecessarily copy make_new_node(); use that instead.
2017-02-12 10:46:50 +01:00
Benno Schulenberg 64aa8757a8 search: make the \b and \B anchors work correctly in both directions
That is: remove the special treatment of BOW anchors, and instead make
regexes match against the whole line instead of against an artificially
shortened one, because the latter method creates ghost matches: matches
at the starting point of the search that aren't really matches when seen
in the context of the whole line.

This fixes https://savannah.gnu.org/bugs/?50030.
2017-01-26 16:24:18 +01:00
Benno Schulenberg e8c7cf2071 startup: report an error when the given line or column number is invalid
This fixes https://savannah.gnu.org/bugs/?50028.
2017-01-19 10:33:42 +01:00
Benno Schulenberg c88d7ce530 search: begin from where we are, to be able to find the first \B
A search should start at the place of the cursor, not one step beyond,
so that the non-word boundary between the current character and the next
will be found.  Starting one step beyond the current character, as was
done until now, would find the non-word boundary between the next and
the overnext character as the first one.
2017-01-17 11:33:57 +01:00
Benno Schulenberg ea40765904 tweaks: rename two variables, and always pass a valid result back
What is the point of parsing a number when you're not interested in
the result?  All callers of parse_num() pass a container for it.
2017-01-11 19:24:35 +01:00
Benno Schulenberg 87b2df6dea utils: go on to parse the line number even if the column number is bad
This fixes https://savannah.gnu.org/bugs/?49933.
2016-12-26 11:45:38 +01:00
Benno Schulenberg 8db21b68d5 tweaks: use memory on the stack instead of calling malloc() and free() 2016-12-26 10:39:48 +01:00
Benno Schulenberg cb31e45f6c tweaks: remove pointless or obscuring asserts 2016-12-26 10:29:57 +01:00
Benno Schulenberg 8c7e4f5108 tweaks: rename a function to describe what it does
It doesn't align anything -- any allocations are already aligned to
whatever multiple is required -- it just shrinks the allocated space.
2016-12-18 10:30:35 +01:00
Benno Schulenberg 0562d27b9c tweaks: delete a bunch of unneeded asserts
Nano would crash straight afterward if any of these asserts would fail,
so they don't add anything.  A few others are simply superfluous.
2016-12-15 21:15:32 +01:00
Benno Schulenberg 9fa95a3680 tweaks: put some prototypes in the proper order, and move a bit of code 2016-12-15 13:04:52 +01:00
Benno Schulenberg d6cc2c40fe tweaks: conditionalize a function that is not used in the tiny version
The fsfromline() function is mostly used by the undo functions, which
are not present in the tiny version.  It is also used by the comment/
uncomment feature, but this feature cannot be enabled when --enable-tiny
is in effect.
2016-12-15 12:45:02 +01:00
Benno Schulenberg b0b24d9c3a utils: slightly speed up the calculation of the size of a buffer
Achieve this by eliding two conditions from the inner loop,
which is possible because 'end' will never be NULL.
2016-12-13 17:11:08 +01:00
David Lawrence Ramsey bd920b1f49 tweaks: adjust the type of two arguments
Convert digits() to take a ssize_t instead of an int, since it's
used on ssize_t line numbers.  And properly use the long modifier
when displaying a line number.

Also, conditionalize the digits() prototype.
2016-12-13 13:06:20 +01:00
David Lawrence Ramsey 84d6f1a5b6 tweaks: adjust the type of four lockfile variables
The functions read() and fwrite() take size_t, not ssize_t.

And line numbers in the file should be displayed as a long type instead
of an int, since the effective type of ssize_t is not int, but long.
2016-12-09 10:05:33 +01:00