Ticket #407 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

C-w does not delete whole command line

Reported by: iNode Owned by: slavazanko
Priority: major Milestone: 4.7.0
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: Votes for changeset: committed-master

Description

C-w does not delete whole command line.

How to repeat. Enter in command line:

ls ls1<M-backspace><M-y><M-y><C-w>

As result we has "ls" in command line, but it also must be deleted!

Attachments

407_fix_set_mark_on_delete_region (763 bytes) - added by iNode 7 years ago.
fix set mark on delete_region
0001-fix-set-mark-on-delete_region.patch (1.1 KB) - added by iNode 7 years ago.
fix set mark on delete_region, patch formated by git instead of diff

Change History

comment:1 follow-up: ↓ 2 Changed 7 years ago by ossi

see my comment in #357.
though i admittedly have no idea why the location of the mark is changed. maybe somebody feels like running the thing through valgrind?

comment:2 in reply to: ↑ 1 Changed 7 years ago by iNode

Replying to ossi:

see my comment in #357.

In that case it not delete whole line or just one word. It's fully inconsistent.

The same thing happens in any input line, so it's widget problem, not command line
specific. So it's seems like kill_region->delete_region change in->mark in widget.c.

static void
delete_region (WInput *in, int x_first, int x_last)
{
   int first = min (x_first, x_last);
   int last  = max (x_first, x_last);
    size_t len;

   in->point = first;
   in->mark  = first; /* why? */

Why? I don't know.

So who see full picture and sure that not break anything can patch by delete that line.

comment:3 Changed 7 years ago by iNode

  • Owner set to iNode
  • Status changed from new to accepted

I review some code near delete_region and I think that delete_region should not change the mark.

Also set_mark function seems to be forgotten:

    /* Region manipulation */
    { 0,              	  set_mark },
    { XCTRL('w'),     	  kill_region },

comment:4 Changed 7 years ago by iNode

Oh, I find that use case. But we need set_mark work for it.

In that case mark can be in the end of line.

some input<cursor> some more input<mark>

And on C-w mark should be moved to cursor position, only in this case.

See patch. It also fix indent of some code block.

Changed 7 years ago by iNode

fix set mark on delete_region

comment:5 Changed 7 years ago by iNode

  • Keywords review added

Changed 7 years ago by iNode

fix set mark on delete_region, patch formated by git instead of diff

comment:6 Changed 7 years ago by winnie

  • Keywords review removed
  • severity set to on review

comment:7 Changed 7 years ago by slavazanko

  • severity changed from on review to no branch

comment:8 Changed 7 years ago by slavazanko

  • Owner changed from iNode to slavazanko

This bug raised with more simplest test case:

1) run mc
2) type 'word1 word2'
3) press Meta-backspace (after typing 'word2')
4) press Ctrl-w

comment:9 Changed 7 years ago by slavazanko

  • severity changed from no branch to on review
  • Milestone changed from 4.7 to 4.7.0

Created branch 407_ctrl_w_not_delete_line

Initial changeset:068ef6f34529a3f0622393585291791410f49669

review, please.

comment:10 Changed 7 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:11 Changed 7 years ago by andrew_b

  • Votes for changeset changed from slavazanko to slavazanko andrew_b
  • severity changed from on review to approved

comment:12 Changed 7 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko andrew_b to commited-master
  • Resolution set to fixed
  • severity changed from approved to merged

comment:13 Changed 7 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.