Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
adf69a05
Commit
adf69a05
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
spelling: keep the cursor at end-of-line if it was there
This fixes
https://savannah.gnu.org/bugs/?50415
.
parent
355a07bb
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+4
-2
src/text.c
with
4 additions
and
2 deletions
+4
-2
src/text.c
View file @
adf69a05
...
...
@@ -2862,6 +2862,7 @@ const char *do_alt_speller(char *tempfile_name)
size_t
current_x_save
=
openfile
->
current_x
;
size_t
pww_save
=
openfile
->
placewewant
;
ssize_t
lineno_save
=
openfile
->
current
->
lineno
;
bool
was_at_eol
=
(
openfile
->
current
->
data
[
openfile
->
current_x
]
==
'\0'
);
struct
stat
spellfileinfo
;
time_t
timestamp
;
pid_t
pid_spell
;
...
...
@@ -2970,7 +2971,7 @@ const char *do_alt_speller(char *tempfile_name)
/* Go back to the old position. */
goto_line_posx
(
lineno_save
,
current_x_save
);
if
(
openfile
->
current_x
>
strlen
(
openfile
->
current
->
data
))
if
(
was_at_eol
||
openfile
->
current_x
>
strlen
(
openfile
->
current
->
data
))
openfile
->
current_x
=
strlen
(
openfile
->
current
->
data
);
openfile
->
placewewant
=
pww_save
;
adjust_viewport
(
STATIONARY
);
...
...
@@ -3372,6 +3373,7 @@ void do_formatter(void)
ssize_t
lineno_save
=
openfile
->
current
->
lineno
;
size_t
current_x_save
=
openfile
->
current_x
;
size_t
pww_save
=
openfile
->
placewewant
;
bool
was_at_eol
=
(
openfile
->
current
->
data
[
openfile
->
current_x
]
==
'\0'
);
pid_t
pid_format
;
static
int
arglen
=
3
;
static
char
**
formatargs
=
NULL
;
...
...
@@ -3449,7 +3451,7 @@ void do_formatter(void)
/* Restore the cursor position. */
goto_line_posx
(
lineno_save
,
current_x_save
);
if
(
openfile
->
current_x
>
strlen
(
openfile
->
current
->
data
))
if
(
was_at_eol
||
openfile
->
current_x
>
strlen
(
openfile
->
current
->
data
))
openfile
->
current_x
=
strlen
(
openfile
->
current
->
data
);
openfile
->
placewewant
=
pww_save
;
adjust_viewport
(
STATIONARY
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help