Ticket #3390 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Alt+Backspace on one-letter word erases too much

Reported by: egmont Owned by: andrew_b
Priority: minor Milestone: 4.8.14
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

Either on the command line, or in any other text entry field (e.g. copy file to) enter a string where the last word consists of one single letter only. E.g. "abc de f".

Press Alt+Backspace.

Expected behavior: Remove the last word, that is, the letter "f" only, leaving "abc de ".

Actual behavior: Yet another word is removed, leaving "abc ".

Attachments

mc-3390-backward-word-off-by-1.patch (484 bytes) - added by egmont 2 years ago.
Fix

Change History

Changed 2 years ago by egmont

Fix

comment:1 follow-up: ↓ 3 Changed 2 years ago by egmont

Here's the fix.

I'm not sure about the intent of that "for" loop, the rest (the two "while" loops later) does the job perfectly. The only thing I can think of is removing trailing '\0' characters, if any. For that purpose, it was off by one, looking at the wrong character, always removing the last one.

comment:2 Changed 2 years ago by egmont

Note: Same story for Ctrl+Left.

comment:3 in reply to: ↑ 1 Changed 2 years ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.14

Replying to egmont:

I'm not sure about the intent of that "for" loop, the rest (the two "while" loops later) does the job perfectly.

I agree that that loop can be removed.

Branch: 3390_input_backward_word
changeset:ecf4b113d874acf35d3279cc4568798dd493fc85

comment:4 Changed 2 years ago by slavazanko

  • Votes for changeset set to slavazanko
  • Branch state changed from on review to approved

comment:5 Changed 2 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:6 Changed 2 years ago by andrew_b

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