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
d3429a7a
Commit
d3429a7a
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
copy: properly set preferred x position when region was marked backwards
This fixes
https://savannah.gnu.org/bugs/?49964
.
parent
e1538e6d
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cut.c
+9
-4
src/cut.c
src/proto.h
+1
-1
src/proto.h
src/text.c
+1
-1
src/text.c
with
11 additions
and
6 deletions
+11
-6
src/cut.c
View file @
d3429a7a
...
...
@@ -60,13 +60,13 @@ void cut_line(void)
#ifndef NANO_TINY
/* Move all currently marked text into the cutbuffer, and set the
* current place we want to where the text used to start. */
void
cut_marked
(
void
)
void
cut_marked
(
bool
*
right_side_up
)
{
filestruct
*
top
,
*
bot
;
size_t
top_x
,
bot_x
;
mark_order
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
,
NULL
);
(
const
filestruct
**
)
&
bot
,
&
bot_x
,
right_side_up
);
move_to_filestruct
(
&
cutbuffer
,
&
cutbottom
,
top
,
top_x
,
bot
,
bot_x
);
openfile
->
placewewant
=
xplustabs
();
...
...
@@ -124,6 +124,8 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
/* The length of the string at the current end of the cutbuffer,
* before we add text to it. */
bool
old_no_newlines
=
ISSET
(
NO_NEWLINES
);
bool
right_side_up
=
TRUE
;
/* There *is* no region, *or* it is marked forward. */
#endif
size_t
was_totsize
=
openfile
->
totsize
;
...
...
@@ -156,7 +158,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
cut_to_eof
();
}
else
if
(
openfile
->
mark_set
)
{
/* Move the marked text to the cutbuffer, and turn the mark off. */
cut_marked
();
cut_marked
(
&
right_side_up
);
openfile
->
mark_set
=
FALSE
;
}
else
if
(
ISSET
(
CUT_TO_END
))
/* Move all text up to the end of the line into the cutbuffer. */
...
...
@@ -179,7 +181,10 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
}
else
copy_from_filestruct
(
cutbuffer
);
openfile
->
placewewant
=
xplustabs
();
/* If the copied region was marked forward, put the new desired
* x position at its end; otherwise, leave it at its beginning. */
if
(
right_side_up
)
openfile
->
placewewant
=
xplustabs
();
}
/* Restore the magicline behavior now that we're done fiddling. */
if
(
!
old_no_newlines
)
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
d3429a7a
...
...
@@ -276,7 +276,7 @@ void cutbuffer_reset(void);
bool
keeping_cutbuffer
(
void
);
void
cut_line
(
void
);
#ifndef NANO_TINY
void
cut_marked
(
void
);
void
cut_marked
(
bool
*
right_side_up
);
void
cut_to_eol
(
void
);
void
cut_to_eof
(
void
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
d3429a7a
...
...
@@ -798,7 +798,7 @@ void do_undo(void)
openfile
->
mark_begin_x
=
u
->
mark_begin_x
;
openfile
->
mark_set
=
TRUE
;
goto_line_posx
(
u
->
lineno
,
u
->
begin
);
cut_marked
();
cut_marked
(
NULL
);
free_filestruct
(
u
->
cutbuffer
);
u
->
cutbuffer
=
cutbuffer
;
u
->
cutbottom
=
cutbottom
;
...
...
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