Commit Graph

226 Commits

Author SHA1 Message Date
Benno Schulenberg 0b6889cbd8 tweaks: rename another function, to be distinct and fitting 2019-04-24 10:52:49 +02:00
Benno Schulenberg cddfcb1b9d tweaks: rename a struct element, to make sense 2019-03-21 17:23:49 +01:00
Benno Schulenberg aac4fc46e9 tweaks: rename a type, to make more sense 2019-03-21 17:08:52 +01:00
Benno Schulenberg 79ca3ceabf copyright: update the years for the FSF 2019-02-24 19:35:56 +01:00
Benno Schulenberg 322a6f46fa tweaks: switch from checking SMOOTH_SCROLL to checking JUMPY_SCROLLING 2019-02-19 19:52:57 +01:00
Benno Schulenberg e2c61d83ef tweaks: change do_para_end() to not step beyond end of paragraph
Not stepping beyond the last line of the paragraph means that the
length of the paragraph is always the difference in line numbers
(between first and last line of the paragraph) plus one.
2018-11-26 09:16:09 +01:00
Benno Schulenberg 4a70c1393f tweaks: improve a comment, to better match the changed code 2018-11-25 12:24:57 +01:00
Benno Schulenberg 539a18e4c7 tweaks: condense and improve a handful of comments, and rewrap two lines 2018-11-22 20:02:29 +01:00
David Lawrence Ramsey c8e5c85113 moving: make the generic paragraph movement functions work on any buffer
The functions do_para_begin() and do_para_end() can now move through any
buffer, while the functions do_para_begin_void() and do_para_end_void()
operate on the current buffer.  The latter function also returns TRUE
if the last line in the buffer is part of the paragraph.
2018-11-20 19:21:35 +01:00
Benno Schulenberg e0d9fee5d6 build: exclude scrolling functions only from tiny version without help
This fixes https://savannah.gnu.org/bugs/?54891.
2018-10-24 17:33:54 +02:00
Benno Schulenberg d245b07c25 tweaks: remove a now-unused parameter from four functions 2018-10-01 19:56:32 +02:00
Benno Schulenberg d66a68166d tweaks: move some calls of edit_redraw() to where they are needed
Only when actually moving the cursor does the screen need to be redrawn,
not when the wrapped functions are called in other places.
2018-10-01 19:55:06 +02:00
Benno Schulenberg 2e1e157967 copyright: update the years for significantly changed files 2018-06-01 10:18:32 +02:00
Benno Schulenberg 9021725d53 justification: limit the amount of recursion to prevent a stack overflow 2018-05-27 16:09:53 +02:00
Benno Schulenberg 84f8df2df8 tweaks: avoid an unused-variable warning with --enable-tiny 2018-05-23 12:00:43 +02:00
Benno Schulenberg ca538e6f08 scrolling: only do a scroll when the edit window has more than one row
If the edit window consists of a single row, then the do_up() call has
already brought the desired line into view -- which means that trying
to scroll then (when already on the first line of the file) would fail.

This fixes https://savannah.gnu.org/bugs/?53891.
2018-05-13 19:31:57 +02:00
Benno Schulenberg 95002da66c tweaks: normalize indentation and whitespace after previous changes 2018-05-10 11:33:24 +02:00
Mark-Weston 858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg 0d9080a22c scrolling: don't redraw entire edit window when cursor goes offscreen
When the cursor is on the top or bottom line of the edit window, and
an <Up> or <Down> pushes the cursor offscreen, then use edit_scroll()
to bring it back into view, instead of using edit_redraw(), because
the latter would redraw *every row* on the screen, which is a waste
of time.

This addresses https://savannah.gnu.org/bugs/?53562.
Reported-by: Devin Hussey <husseydevin@gmail.com>
2018-04-24 09:59:39 +02:00
Benno Schulenberg f3c4dadcf6 build: fix compilation with --enable-{tiny,help,multibuffer} 2018-03-28 16:37:47 +02:00
Benno Schulenberg 373e3b880f scrolling: first move the cursor before pushing current chunk offscreen
When the cursor is on the first or last row of the edit window, and
thus Scroll-Down or Scroll-Up would push it offscreen, first move
the cursor away from the edge row and then scroll.

This fixes https://savannah.gnu.org/bugs/?53376.
2018-03-18 20:06:29 +01:00
Benno Schulenberg 93318b972d tweaks: elide two parameters and thus a pair of wrapper functions
When just scrolling and the cursor does not need to change position
(that is: it is not on the first or last row of the edit window),
then edit_scroll() has handled everything and there is no need to
additionally redraw anything or update 'placewewant'.
2018-03-17 14:07:42 +01:00
Benno Schulenberg 8656f160d7 tweaks: reshuffle some movement code, to reduce the number of conditions
Also, rename a parameter and invert its logic.
2018-03-17 14:02:55 +01:00
Benno Schulenberg 0e30177db7 scrolling: let Scroll-Up/Down keep the cursor in the same text position
Instead of keeping the cursor in the same spot on the screen,
let the cursor move with the text (whenever possible).

This makes these functions behave the same as in Vim and Emacs.
2018-03-17 14:00:00 +01:00
Benno Schulenberg 1ebb1da382 tweaks: elide a parameter that is always 1
And adjust the comments accordingly.
2018-03-10 12:43:33 +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 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 f9ebf038e0 tweaks: slightly rename four functions, for aptness and variety 2017-12-26 14:15:49 +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 db0b849f9b tweaks: transform the token DISABLE_JUSTIFY to ENABLE_JUSTIFY 2017-10-31 17:40:44 +01:00
Benno Schulenberg 3018ab4706 moving: don't slither and slide over tabs when they are overlong
This fixes https://savannah.gnu.org/bugs/?52183.

Tested-by: David Lawrence Ramsey <pooka109@gmail.com>
Improved-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-10-25 17:46:39 +02:00
Benno Schulenberg 7a3a45e6ac moving: prevent the cursor sticking on or skipping over overwide tabs
When we've landed on a tab and we are moving down and the tab starts
before the current chunk, then push the index forward -- otherwise we
would not advance.  When instead we're moving up and the end of the
preceding row is on the same tab as the target column AND the end of
the current row is not on that same tab, then there is some character
on this row that we can put the cursor on, so push the index forward
-- otherwise we would skip a usable row.

This fixes https://savannah.gnu.org/bugs/?52125
and fixes https://savannah.gnu.org/bugs/?52139.
2017-10-12 20:47:06 +02:00
David Lawrence Ramsey 5f70229c7e moving: set the preferred column properly when doing a smart home
This fixes http://savannah.gnu.org/bugs/?52042.
Reported-by: Mike Frysinger <vapier@gentoo.org>
2017-09-15 21:24:48 +02:00
Benno Schulenberg 21ffa883f7 tweaks: use mnemonic constants instead of TRUE and FALSE
And use these constants in another context too.
2017-08-31 22:14:06 +02:00
Benno Schulenberg a4a32b910a tweaks: reshuffle a couple of lines, and trim some comments 2017-08-31 21:55:10 +02:00
Benno Schulenberg 28cfab7580 tweaks: fix compilation when configured with --enable-tiny
When moving the cursor to the top-left corner, it is not necessary
to compute leftedge because firstcolumn IS the relevant leftedge.

Reported-by: Jordi Mallach <jordi@debian.org>
2017-08-29 19:28:44 +02:00
David Lawrence Ramsey 59451da3ac softwrap: correctly move vertically through overwide tabs
Don't skip rows that contain something when moving up, and do put
the cursor in the desired column whenever possible when moving down.

This fixes http://savannah.gnu.org/bugs/?51827
and fixes http://savannah.gnu.org/bugs/?51828.
2017-08-26 10:14:01 +02:00
David Lawrence Ramsey a850bb2513 moving: redraw not just the new current line but also the prior one
This fixes http://savannah.gnu.org/bugs/?51821.
2017-08-22 19:21:47 +02:00
Benno Schulenberg 047cf9be9c moving: improve retention of the target column somewhat
It's not yet good enough: when proper_x() pushes the index forward,
maybe it should also increase leftedge?  Or go_forward_chunks()?
2017-08-22 16:11:20 +02:00
Benno Schulenberg 97896d30f1 moving: use the correct formula for pushing the index forward
This helps to fix https://savannah.gnu.org/bugs/?51787.
Correction-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-08-22 16:11:11 +02:00
Benno Schulenberg fc367a32eb moving: don't push x forward when backward movement lands on a split tab
This fixes https://savannah.gnu.org/bugs/?51809.
2017-08-22 16:05:44 +02:00
David Lawrence Ramsey 5e10528759 display: revamp how screen updates are done in the movement code
When the screen is narrower than a tab is wide, the cursor does not need
to be on the first/last line of the window before an <Up>/<Down> could
need to scroll the screen.

This fixes http://savannah.gnu.org/bugs/?51776.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-08-21 21:25:55 +02:00
Benno Schulenberg 49fb755cfc moving: get <Up> unstuck when trying to pass over a sprawling tab
This is a temporary fix.  The resultant movement is erratic and
not what is desired (which is: to stay in the same screen column
as much as possible).
2017-08-20 20:26:05 +02:00
Benno Schulenberg 24a64d37dd softwrap: properly move up and down over tabs that are split over rows
Also, move home to the first character after the tab if the current
chunk starts with a partial tab.

This fixes https://savannah.gnu.org/bugs/?51800.
Original-idea-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-08-20 20:24:58 +02:00
Benno Schulenberg 54a92614b2 tweaks: group all movement routines in corresponding pairs 2017-08-18 22:20:32 +02:00
Benno Schulenberg 86e71fa09d tweaks: specify more directly in what manner to move the viewport 2017-08-18 21:46:55 +02:00
David Lawrence Ramsey 5237a42d65 weeding: remove the unused be_clever parameter from do_home()/do_end() 2017-08-18 20:44:46 +02:00
David Lawrence Ramsey 46ccc9ba6a softwrap: improve left/right navigation across line boundaries
Using do_up() and do_end() when the user types <Left> at the start of
a line, and do_down() and do_home() when typing <Right> at line's end
can be problematic when tabs are wider than the screen, because those
functions convert indexes to columns and back again twice, thus causing
inaccuracies.  Therefore, simply adjust current and current_x directly,
and then redraw the screen.

This fixes https://savannah.gnu.org/bugs/index.php?51778.
2017-08-18 20:04:23 +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
David Lawrence Ramsey 8b1f283a73 moving: fix the cursor jumping back and forth with non-smooth paging
Since commit 8490f4ac, get_edge_and_target() depends on an up-to-date
current_x.  So: make sure current_x is updated when we move to the
top left of the screen to start a non-smooth PageUp or PageDown.

This fixes https://savannah.gnu.org/bugs/?51480.
2017-07-17 11:45:57 +02:00