Commit Graph

5963 Commits (0e0108098326c182a292527046cc8ccb6eb2035e)

Author SHA1 Message Date
Benno Schulenberg 5aa1df37d1 files: recompute the multidata only when the applicable syntax changed 2016-06-08 14:17:30 +02:00
Benno Schulenberg ca2c808f69 files: free all the multidata when a file is saved, then recompute it
This fixes https://savannah.gnu.org/bugs/?48103.

(The fix is wasteful -- it should only discard the multidata if actually
the name *did* change, *and* if the applicable syntax changed.)
2016-06-08 13:31:18 +02:00
Benno Schulenberg d87c357abe tweaks: remove two redundant assignments
The mark has already been unset by do_cut_text().  And any assignment
to 'mark_begin' is useless when 'mark_set' is FALSE.
2016-06-07 19:53:27 +02:00
Benno Schulenberg ccffc548e1 text: after undoing or redoing something, unset the mark
This fixes https://savannah.gnu.org/bugs/?48108,
and fixes https://savannah.gnu.org/bugs/?48157.
2016-06-07 19:52:23 +02:00
Benno Schulenberg 83b89a49ef text: remove a redundant undo element
Implement its single use case by making better use of another element.
2016-06-07 19:23:51 +02:00
Benno Schulenberg 87a254400e text: remove a pointless setting of an undo element; it is never used 2016-06-07 19:23:51 +02:00
Benno Schulenberg 9192b7fe8c text: add an undo item before starting to comment or uncomment lines
By moving the test for the only situation where do_comment() does nothing
(when only the magic line is selected) further up front, the add_undo()
can be called before the commenting/uncommenting starts and two variables
and an extra function are made unnecessary.
2016-06-07 11:08:06 +02:00
Benno Schulenberg 5dee9fb2c6 files: it is fine to "change" the name of a nameless buffer
This fixes https://savannah.gnu.org/bugs/?48156.
2016-06-07 10:15:25 +02:00
Benno Schulenberg f0c65bc988 tweaks: add come comments and rename a variable 2016-06-06 20:29:53 +02:00
Benno Schulenberg 5f4d759679 tweaks: fix compilation when configured with --enable-tiny
Reported-by: Mike Scalora <mike@scalora.org>
2016-06-06 19:57:51 +02:00
Benno Schulenberg ec7b20eec6 syntax: don't call getcwd() with a NULL pointer
Some platforms don't like that.
2016-06-04 12:02:49 +02:00
Benno Schulenberg edf230b7df text: store the new file size in the undo item also when joining lines
This fixes https://savannah.gnu.org/bugs/?48099 reported by Mike Scalora.
2016-06-04 11:39:59 +02:00
Benno Schulenberg 0eefd2c326 README.GIT: reformat the text a bit 2016-06-04 11:27:15 +02:00
Benno Schulenberg f390eb8da0 docs: mention that pkg-config is needed when building from git 2016-06-04 11:20:29 +02:00
Benno Schulenberg 9f4b4c975a files: prevent dereferencing a possible (although very unlikely) NULL
Don't catch the NULL earlier, because we do want an error message when
opening the lockfile fails.
2016-06-04 11:18:29 +02:00
Benno Schulenberg 0293eac1d1 files: report an unwritable file in a separate message
That is: don't mix the number of lines read with a warning about the
file being unwritable -- the former is just convenience information,
the latter is a must-see.

This fixes https://savannah.gnu.org/bugs/?48047.
2016-06-03 21:18:14 +02:00
Benno Schulenberg 0172cb0e83 tweaks: improve a couple of comments 2016-06-02 12:12:12 +02:00
Benno Schulenberg 56f067a284 chars: ensure that files are sorted also when strncasecmp() is strange
When running in a non-UTF locale, and when strncasecmp() suffers from
the same defect as strncmp(), make sure not to pass a length with the
high bit set.
2016-06-01 21:59:25 +02:00
Benno Schulenberg 660584c1ea search: find, and thus delete, only exact matches from history
This reverts commit df8c3de from six years ago, which prevented a crash
on the Armel/Maemo platforms but causes nano to lose history items.

The strncmp() function on those platforms treats size_t numbers with
the high bit set as if they were zero.  To avoid that, use a number
that cannot be seen as negative, as suggested by <alpha@qzx.com>.

This fixes https://savannah.gnu.org/bugs/?48048.

Tested-by: Tito Ragusa <farmatito@tiscali.it>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-06-01 21:47:06 +02:00
Benno Schulenberg e198c85053 tweaks: rename two variables, and elide a third 2016-06-01 19:49:47 +02:00
Benno Schulenberg 05e2a6d259 chars: a control character can never be an invalid multibyte sequence
The function is_cntrl_mbchar() has always been called successfully before
calling control_mbrep(), so the passed character *is* a valid sequence.
2016-06-01 13:08:40 +02:00
Benno Schulenberg 21d9bd1107 tweaks: rename some variables to be more readable 2016-06-01 13:04:32 +02:00
Benno Schulenberg 5864d97590 tweaks: harmonize the routine for tabs with the one for spaces 2016-06-01 13:04:22 +02:00
Benno Schulenberg 3ac37642c8 screen: check for the most frequent character first: a space 2016-06-01 13:04:08 +02:00
Benno Schulenberg b42887fe14 tweaks: adjust a couple of comments 2016-06-01 13:04:00 +02:00
Benno Schulenberg 4172268bd2 chars: the representation of control characters is always two columns wide 2016-06-01 13:03:43 +02:00
Benno Schulenberg a9f79a6130 tweaks: reindent and rewrap a few lines, and shorten a comment 2016-06-01 13:03:26 +02:00
Mike Scalora 115aeda69b text: keep the file size correct when undoing/redoing a comment/uncomment
Store the file sizes from before and after the commenting/uncommenting
in the undo struct, so they can be restored when undoing or redoing.

This fixes https://savannah.gnu.org/bugs/?48062.

Signed-off-by: Mike Scalora <mike@scalora.org>
2016-05-31 21:36:22 +02:00
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg aaab6e57e0 screen: when using positionlog, show as much of the file as possible
When opening a file that was edited before, and the remembered position
is near the end of the file, then don't center the target line but show
the last line of the file on the bottom line of the screen, thus showing
as much of the file content as possible.

This addresses https://savannah.gnu.org/bugs/?46243.
2016-05-28 21:20:39 +02:00
Benno Schulenberg fbd817fb94 utils: rename some variables, to match those in strnlenpt() 2016-05-28 13:23:41 +02:00
Benno Schulenberg e3e3f655ee tweaks: use an available macro to silence a compiler warning 2016-05-27 21:48:38 +02:00
Benno Schulenberg 3129ff687a tweaks: rename a variable, because nothing is returned there 2016-05-27 21:43:39 +02:00
Benno Schulenberg 1d3d30776a tweaks: more consistently use * instead of [0] when checking for '\0' 2016-05-27 21:31:55 +02:00
Benno Schulenberg 2fae87d9a5 tweaks: harmonize some indentations, elide an #ifdef, and rewrap a line 2016-05-27 21:22:56 +02:00
Benno Schulenberg a5b3f00d78 chars: make comparing multibyte strings twice as fast
Instead of parsing every multibyte character twice, first with
parse_mbchar() and then with mbtowc(), just let mbtowc() do all
the work.  This makes searching for a fixed string twice as fast.

This also gets rid of four variables and lots of memory allocations.
(And, more importantly: it stops nano messing up the internal state
of the multibyte-to-wide character conversion, and thus would make
the calls to mbtowc_reset() superfluous.)
2016-05-27 10:37:43 +02:00
Benno Schulenberg 1bffa17c01 tweaks: rename two more variables 2016-05-27 10:36:54 +02:00
Benno Schulenberg a151167416 tweaks: rename some variables for contrast 2016-05-27 10:36:12 +02:00
Mike Scalora 6a2032f5b0 new feature: comment/uncomment current line or selected lines
This allows for commenting or uncommenting a line or a bunch of lines
with a single keystroke (default binding: M-3).  The characters used
for commenting/uncommenting are specified by the active syntax file.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Mike Scalora <mike@scalora.org>
2016-05-25 22:29:50 +02:00
Benno Schulenberg d3bd855c9d tweaks: rename a function, and move the sorting there too 2016-05-25 12:09:22 +02:00
Rishabh Dave bd3f156044 browser: move all openings and closings of a directory to the same function
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-25 12:02:33 +02:00
Benno Schulenberg 3b21659661 tweaks: elide four #ifdefs, improve one comment and unwrap some others 2016-05-24 17:55:24 +02:00
Benno Schulenberg bf64386717 tweaks: rename a variable, for aptness 2016-05-24 17:52:16 +02:00
Benno Schulenberg 1b902d6267 tweaks: elide unneeded intermediate assignments 2016-05-24 17:52:01 +02:00
Benno Schulenberg 619044e83d tweaks: put some conditions in a better order: the main one first 2016-05-24 17:51:50 +02:00
Benno Schulenberg e0e788e218 tweaks: reshuffle a few things 2016-05-23 21:34:02 +02:00
Benno Schulenberg a617d9c05e tweaks: remove a redundant assignment 2016-05-23 21:25:00 +02:00
Benno Schulenberg 99e6293cd0 tweaks: remove an unnecessary intermediate assignment 2016-05-23 20:57:08 +02:00
Benno Schulenberg 286b6a9088 tweaks: rename a variable, to indicate better what it contains
And to contrast it more with 'answer'.
2016-05-23 20:46:58 +02:00
Benno Schulenberg 27e07d2af5 tweaks: rename two variables, to avoid using a name for different purposes
When calling do_prompt(), 'ans' is used to offer a default answer or the
answer given so far.
2016-05-23 20:30:01 +02:00