Ticket #1868 (closed defect: fixed)

Opened 10 years ago

Last modified 7 years ago

stuck on replace with regexp

Reported by: fp Owned by: slavazanko
Priority: minor Milestone: 4.8.3
Component: mcedit Version: master
Keywords: Cc: firmanp@…
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master committed-stable

Description

summary:
mcedit stuck and eating resources on replace with regexp

how-to-repeat:

  1. create/open dummy file
  2. replace (with regexp enabled)
  • on search string, put: a single circumflex accent
  • on replacement string, put *any string*
  • on confirm replace, select All
  1. boom. mcedit stuck and start eating resources

system:
Fedora release 12
mc-4.7.0-0.4.pre2.fc12.x86_64

tq,

Change History

comment:1 Changed 10 years ago by andrew_b

Please try latest release instead of pre2. See http://www.midnight-commander.org/wiki/NightlyBuilds.

comment:2 Changed 10 years ago by fp

  • Cc firmanp@… added

ok, i've test rebuild from source rpm from:

  • mc-4.7.0-0.7.pre4.fc13.src.rpm
  • mc-4.7.0.pre4.148.g1f900af-1.fc12.src.rpm

the problem still exists with both version above.

fyi, expected result should be the same as doing this command on Vi or Vim

%s/^/TEST/g

tq,

comment:3 follow-up: ↓ 4 Changed 10 years ago by andrew_b

Another test case:

  1. Open emtpy file (Shift-F4).
  2. Type "123456"
  3. Place cursor to '4' symbol.
  4. Call replace dialog. Set search string to '', set replace string to "aaa". Select "Regular expression". Press Enter.
  5. Press "Replace" in "Confirm replace" dialog.
  6. Replacement result is "123aaa456". Expected result is "aaa123456" (as in ViM).

In any case the replacement starts from current cursor position, but sometimes such behaviour produces incorrect results.

Version 0, edited 10 years ago by andrew_b (next)

comment:4 in reply to: ↑ 3 Changed 10 years ago by andrew_b

Replying to andrew_b:

Set search string to '',

Set search to '^' ("line start" regexp).

comment:5 Changed 9 years ago by fp

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

comment:6 Changed 9 years ago by fp

hello,

sorry for late respons, here some updates for this bug:

replace with REPLACE button, now works well (line by line), with single '^' mark on search string.

as in Vim:
(REPLACE) : s/^/123/g

replace with REPLACE and ALL button, now works well, while char(s) follow the '^' mark.

as in Vim:
(REPLACE) : s/^a/123/g
(ALL) : %s/^a/123/g

example:
file content:
abc
abc
abc

search string:
^a

replacement string:
123

result:
123bc
123bc
123bc

replace with ALL button, still buggy, with single '^' mark on search string.

as in Vim:
(ALL) : %s/^/123/g

tested on:

  • 4.7.0.9 (source build)
  • mc-4.7.4-1.fc12.x86_64

tq,

comment:7 Changed 8 years ago by zaytsev

  • Version changed from 4.7.0-pre2 to master
  • Milestone changed from 4.7 to 4.8

comment:8 Changed 8 years ago by andrew_b

  • Owner fp deleted
  • Status changed from accepted to assigned
  • Component changed from mcedit to mc-search
  • Branch state set to no branch
  • Milestone changed from 4.8 to Future Releases

comment:9 Changed 7 years ago by slavazanko

  • Status changed from assigned to accepted
  • Owner set to slavazanko

comment:10 Changed 7 years ago by slavazanko

  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.3

Created branch 1868_replace_regexp_hangup.
Review, please.

comment:11 Changed 7 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Component changed from mc-search to mcedit

comment:12 Changed 7 years ago by andrew_b

  • Keywords stable-candidate added

comment:13 Changed 7 years ago by angel_il

  • Votes for changeset changed from andrew_b to andrew_b angel_il
  • Branch state changed from on review to approved

comment:14 Changed 7 years ago by slavazanko

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

Metged to master:

git log --pretty=oneline db83281..0e5b78b

comment:15 Changed 7 years ago by slavazanko

  • Keywords stable-candidate removed
  • Status changed from testing to closed
  • Votes for changeset changed from committed-master to committed-master committed-stable

Merged to stable:

git log --pretty=oneline 4b9d746 5f98155
Note: See TracTickets for help on using tickets.