Commit Graph

649 Commits (839743fd24e9c4aa67ad195f68970fd3cae19b0a)

Author SHA1 Message Date
Benno Schulenberg 839743fd24 tweaks: move a function to its proper location 2018-04-01 10:54:14 +02:00
Benno Schulenberg 5726514869 linting: drop messages for other files when configured for one buffer
This fixes https://savannah.gnu.org/bugs/?53445.
2018-03-26 08:56:03 +02:00
Benno Schulenberg 88234c90bc tweaks: adjust the indentation after the previous changes 2018-03-26 08:53:06 +02:00
Benno Schulenberg 02719ec4bf tweaks: fuse two ifs into one 2018-03-26 08:52:51 +02:00
Benno Schulenberg 415bf82690 tweaks: move an 'if' and then remove an unneeded label 2018-03-26 08:52:04 +02:00
Benno Schulenberg bf1a080923 build: exclude more things when configured with --disable-multibuffer
This will make the tiny version slightly smaller.
2018-03-23 11:09:37 +01:00
Benno Schulenberg 30fc197b66 tweaks: adjust a couple of types, to reduce the number of warnings
This avoids eleven warnings of the kind "comparison between signed
and unsigned integer expressions [-Wsign-compare]".
2018-03-22 19:33:22 +01:00
Benno Schulenberg b9de5525c4 tweaks: elide a parameter, as it's always the inverse of another 2018-03-22 12:52:28 +01:00
Benno Schulenberg f4d1ef1c4e tweaks: remove unneeded settings and unsettings of MULTIBUFFER
In the preceding commit, open_buffer() was changed so that it gets
told whether to load into a new buffer or not, so it is no longer
needed to convey this information through a flag.
2018-03-22 12:50:48 +01:00
Benno Schulenberg dd157f1494 tweaks: change a parameter of open_buffer() and invert its logic 2018-03-22 12:35:50 +01:00
Benno Schulenberg dcda98fb73 tweaks: remove an inconsistent space from two pointer declarations
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-03-17 15:53:22 +01:00
Benno Schulenberg e8505b2d3e memory: plug a leak, by actually freeing a discarded undo struct
This fixes https://savannah.gnu.org/bugs/?53269.
Reported-by: Ashish Kunwar <dorkerdevil280@gmail.com>

The leak was mistakenly introduced by commit dc3618a1
-- probably as a leftover of testing things.
2018-03-11 20:16:09 +01:00
Benno Schulenberg 95fffa99aa tweaks: adjust two comments, move two declarations, rewrap three lines 2018-03-05 10:43:05 +01:00
Benno Schulenberg 22f7861694 tweaks: reshuffle the undo types into mostly the same order everywhere
First the two that add something (ADD, ENTER), then the three that
delete something (BACK, DEL, JOIN), and then the one that changes
something (REPLACE).  Then the SPLITs, CUT, PASTE, and INSERT, and
then the INDENTs and COMMENTs, when they exist.
2018-03-05 10:05:07 +01:00
Benno Schulenberg ba96d507dd tweaks: drop some debugging stuff, and adjust what remains of it 2018-03-05 09:42:57 +01:00
Benno Schulenberg 9bf57e5ca0 tweaks: do not needlessly renumber the lines in the buffer
For cuts, pastes, and inserts, the lines have already been renumbered;
for indents, comments, and replacements, the line numbers cannot have
changed.  (And anyway, variable 'f' is not set for those cases.)

Only when lines get split (ENTER) or fused together (JOIN) do the later
lines need to be renumbered.  This mirrors what is done for do_redo().
2018-03-04 10:27:07 +01:00
Benno Schulenberg f9103a5cb5 tweaks: make the fsfromline() call only for the undo types that need it
The 'f' variable is used only in the ADD, BACK, DEL, ENTER, JOIN, and
REPLACE undo/redo cases.  So, avoid making a somewhat costly call when
it is entirely superfluous.  Rearrange the undo types to make checking
for the above six types easier.
2018-03-03 17:12:25 +01:00
Benno Schulenberg e9eabdcdcb undo: when redoing, don't try to find a line number that might not exist
This fixes https://savannah.gnu.org/bugs/?53272.
2018-03-03 16:41:33 +01:00
Benno Schulenberg dd9766c2e0 editing: when --smooth is used, make <Enter>-at-bottom scroll one row
When using --smooth or 'set smooth', the screen should scroll the
minimum amount needed to get the cursor back into view.  (The only
exceptions are search, undo, and redo -- when there the cursor goes
offscreen, the cursor line is centered.)

This change brings the behavior of pressing <Enter> on the bottom
row into line with, for example, pasting a single line.  See also
http://lists.gnu.org/archive/html/nano-devel/2018-02/msg00027.html.
2018-02-16 11:48:24 +01:00
Benno Schulenberg 4295baa5fe tweaks: transform a 'do' to a 'while', and reshuffle a comment 2018-02-04 18:14:28 +01:00
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 a429dc4a76 tweaks: rename a variable, to better fit its usage 2018-01-23 13:09:12 +01:00
Benno Schulenberg 91073be49c wrapping: don't trim a blank character that the user just typed
Trimming trailing spaces is good, but we should not trim the space
(or tab or other blank) that the user just typed and that caused the
hard-wrapping to occur.

This fixes https://savannah.gnu.org/bugs/?52948.
Reported-by: Andreas Schamanek <schamane@fam.tuwien.ac.at>
2018-01-23 13:06:05 +01:00
Benno Schulenberg 7947d9d2a5 build: fix compilation when configured with --enable(tiny,color,nanorc}
This fixes https://savannah.gnu.org/bugs/?52834.
Reported-by: <akiko@mailbox.org>
2018-01-09 13:30:25 +01:00
Benno Schulenberg ada78dc89d build: fix compilation with --enable-tiny --enable-justify 2018-01-08 19:12:41 +01:00
Benno Schulenberg 17429d7f38 tweaks: fix some whitespace errors, and convert alignment tabs to spaces 2017-12-29 21:35:14 +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 b574f73e60 tweaks: add a separate function that actually wipes the status bar 2017-12-29 17:40:41 +01:00
David Lawrence Ramsey 62ebd93579 tweaks: use printf's z modifier for (s)size_t, instead of casting 2017-12-26 14:11:18 +01:00
Benno Schulenberg 184bb11fd9 tweaks: factor out a piece of common code 2017-12-24 11:25:10 +01:00
Benno Schulenberg a70db34fc9 tweaks: remove two irrelevant conditions
They were mistakenly added by changeset fb85c055, four commits ago.
2017-12-24 11:10:41 +01:00
Benno Schulenberg fbde1b2d71 tweaks: reshuffle another bit of code, for conciseness 2017-12-24 10:56:16 +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 fb85c05594 text: keep cursor at left edge when it IS there when indenting/commenting
Suggested-by: Brand Huntsman <alpha@qzx.com>
2017-12-21 19:47:22 +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 dc3618a127 text: set and reset the Modified state correctly when undoing/redoing
Unset the "Modified" marker only at the point where the file was last
saved -- if there is such a point, because it can be missing when the
undo stack was discarded.

This fixes https://savannah.gnu.org/bugs/?52689.
Reported-by: Liu Hao <lh_mouse@126.com>

Original-idea-by: Brand Huntsman <alpha@qzx.com>
2017-12-19 19:22:52 +01:00
Benno Schulenberg e2843ede7e text: let a Shift-selection persist when indenting and commenting
To achieve that, fake the Shift key being held when indenting/
unindenting/commenting/uncommenting.

Reported-by: Brand Huntsman <alpha@qzx.com>
2017-12-12 21:09:28 +01:00
Benno Schulenberg bcd187d7d6 tweaks: rewrap some lines and some comments, and trim two others 2017-12-10 20:03:51 +01:00
Benno Schulenberg 03783a7d1b tweaks: trim another placing of a terminating nul byte
Make both preceding character moves include the terminating byte.
2017-12-10 19:56:36 +01:00
Benno Schulenberg f2fb8c01f4 tweaks: remove a superfluous placing of a terminating nul byte
The character move has already copied the terminating byte.
And a reallocation to save just one character of memory is
a waste of time.
2017-12-10 19:49:57 +01:00
Benno Schulenberg eb937f81fa text: allow unindenting when not all lines are indented
And also allow it when lines are only partially indented.

This makes it possible to equalize the indentations of (accidentally)
unevenly indented lines: by first fully unindenting a group of lines,
and then reindenting them to the desired amount.

Suggested-by: Liu Hao <lh_mouse@126.com>
2017-12-09 17:44:12 +01:00
Benno Schulenberg 66fd6a5ab1 options: rename 'justifytrim' to 'trimblanks', because it has morphed
The option now causes nano to trim trailing whitespace also when
hardwrapping occurs while the user is typing.
2017-12-06 20:38:13 +01:00
Benno Schulenberg c30d3d8010 wrapping: delete trailing blanks upon hardwrapping, when requested
This fulfills https://savannah.gnu.org/bugs/?52198.
2017-12-06 20:32:08 +01:00
Benno Schulenberg 0c40f87b55 tweaks: invert the logic of a variable, and rename it
To get rid of two double negatives.
2017-12-03 20:49:01 +01:00
Benno Schulenberg 0133d5cba8 tweaks: elide two variables that are used just once 2017-12-02 18:07:50 +01:00
Benno Schulenberg 9066a96dde tweaks: rename three variables, for more contrast and variety 2017-12-02 18:07:22 +01:00
Benno Schulenberg 6abb551fdd tweaks: avoid incrementing a variable that won't be used again later 2017-12-02 17:55:27 +01:00
Benno Schulenberg 97bdf13b59 tweaks: remove a redundant call of renumber()
The call of do_delete() four lines earlier already does a renumber.
2017-12-02 17:47:01 +01:00
Benno Schulenberg dae88f8dc7 tweaks: remove a superfluous condition
When the WAS_FINAL_LINE flag is relevant (when NO_NEWLINES isn't set),
the only way for 'current' to be equal to 'filebot' is when 'current_x'
is zero.
2017-12-02 17:40:16 +01:00