+2014-02-22 Benno Schulenberg <bensberg@justemail.net>
+ * src/nano.c (move_to_filestruct) - Update the data in 'mark_begin'
+ when mark and cursor are on the same line. This avoids a segfault
+ after M-A, right, M-T, left, ^K, or a hang when the left is left out.
+
2014-02-22 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main) - Add two conditions on ENABLE_NANORC.
* src/files.c (close_buffer, do_insertfile) - Likewise.
bool edittop_inside;
#ifndef NANO_TINY
bool mark_inside = FALSE;
+ bool same_line = FALSE;
#endif
assert(file_top != NULL && file_bot != NULL && top != NULL && bot != NULL);
openfile->fileage->lineno && openfile->edittop->lineno <=
openfile->filebot->lineno);
#ifndef NANO_TINY
- if (openfile->mark_set)
+ if (openfile->mark_set) {
mark_inside = (openfile->mark_begin->lineno >=
openfile->fileage->lineno &&
openfile->mark_begin->lineno <=
openfile->mark_begin_x >= top_x) &&
(openfile->mark_begin != openfile->filebot ||
openfile->mark_begin_x <= bot_x));
+ same_line = (openfile->mark_begin == openfile->fileage);
+ }
#endif
/* Get the number of characters in the text, and subtract it from
if (mark_inside) {
openfile->mark_begin = openfile->current;
openfile->mark_begin_x = openfile->current_x;
- }
+ } else if (same_line)
+ /* update the content of this partially cut line */
+ openfile->mark_begin = openfile->current;
#endif
top_save = openfile->fileage;