bugGNU Octave - Bugs: bug #56405, Search+Replace deleting characters...

 
 

bug #56405: Search+Replace deleting characters disobeys selection

Submitter:  Eldrad Ulthran <eldrad_ulthran>
Submitted:  Tue 28 May 2019 11:59:44 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  ttl
Originator Name:  Open/Closed:  * Closed
Release:  * 5.1.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 30 Sep 2019 04:15:21 PM UTC, comment #9: 

I merged stable to default.  I think the conflicts were happening because of changes I have made recently.

John W. Eaton <jwe>
Group administrator
Mon 30 Sep 2019 03:51:38 AM UTC, comment #8: 

@Torsten: Can you merge stable to default?  I tried to do so, but there were conflicts during the merge and I don't know the code well enough to choose the correct piece of code to keep for the 3-way merge.

Rik <rik5>
Group administrator
Sun 29 Sep 2019 12:12:34 PM UTC, comment #7: 

I have grafted the fix of this bug into the stable branch with
http://hg.savannah.gnu.org/hgweb/octave/rev/e92bab9a7f26

I therefore close this bug report.

Torsten Lilge <ttl>
Group Member
Sat 01 Jun 2019 05:48:33 PM UTC, comment #6: 

From my tests, the remaining issue is in qscintilla's way to search in selections. Since we already have a workaround for another issue in this case, I decided to drop the use of findFirstInSelection () and handle the search in a given selection by gui's code. The related changeset
http://hg.savannah.gnu.org/hgweb/octave/rev/fbe46901ae62
was pushed to the default branch, since this is a complete redesign of the search & replace in selected text. As a positive side effect, we can drop a configuration test for Qt's abilities.

I leave the report open since I would like to cherry-pick this patch into stable is there are no complains about side effects I was missing during my tests.

Torsten Lilge <ttl>
Group Member
Thu 30 May 2019 09:49:41 AM UTC, comment #5: 

Changeset http://hg.savannah.gnu.org/hgweb/octave/rev/8854d65e3bcc provides the possibility to undo a complete replace-all action at once.

Changesets for the bugs covered by this report will follow.

Torsten Lilge <ttl>
Group Member
Wed 29 May 2019 06:39:02 PM UTC, comment #4: 

With the example from comment #3 I can confirm the issue.

Also the weird effect that replacing A in AAA results in DAD.

Torsten Lilge <ttl>
Group Member
Wed 29 May 2019 09:21:57 AM UTC, comment #3: 

The bugs posted by Pantxo seem to be a bit different… as for me, it doesn't matter whether I first select and then press Ctrl+F or vice versa, the effect is the same.

A test file that produces my bug:

AAA

BBB

AAA

CCC

xyC

z


Select the second and third paragraph, press Ctrl+F, check "only in selection", replace 'A' with '', and all six A's get deleted.

Additionally, I just discovered another bug in this file sample: select one line with AAA and replace 'A' with 'D' in this selection – only two A's get replaced and the result is 'DAD' instead of 'DDD'.

Eldrad Ulthran <eldrad_ulthran>
Tue 28 May 2019 09:55:41 PM UTC, comment #2: 

I can confirm the issue with the following content in a file:

AAA
BBB
AAA
AAA


If I first select the 3 first lines, press Ctrl+F, and try to replace AAA by CCC, whether I use the Replace button repeatedly or the Replace All button, all 3 occurrences of AAA in the file are replaced while only two of them were initially in the selection.

In short, selecting a region of text prior to Ctrl+F has no effect, whatever the options chosen in the Search dialog.

Pantxo Diribarne <pantxo>
Group Member
Tue 28 May 2019 08:59:48 PM UTC, comment #1: 

Thanks for the report. Sorry, I can not reproduce this issue. For me, only occurrences within the selection are removed. Can you please attach the file where this happens and which options of the find dialog are actually selected?

Torsten Lilge <ttl>
Group Member
Tue 28 May 2019 11:59:44 AM UTC, original submission:  

When the Search+Replace widget of the editor is used to delete certain strings inside a selection, deletion occurs in the whole document instead.

Steps to reproduce:

1. In the editor, mark a piece of code
2. press Ctrl-F
3. In "search for" enter any string that is present in the selection
4. Leave "Replace by" empty
5. Make sure to check "search in selection"
6. Press "replace all"

Result: All instances of the search pattern throughout the whole document are deleted
Expected result: Deletion should occur only in the selected part.

If the search pattern is not found in the selected region, nothing happens, as it should be. If "replace by" is not empty, everything works fine.

A possible workaround is to extend the search string with another character, which should be kept. E.g. if there are many instances of "abc" and one wants to delete "ab", one should not replace "ab" with "", but "abc" with "c".

Since I'm at it currently, two little changes to the search widget would be nice:
If the widget is open and I select a new part of the code, the tick "search in selection" gets unchecked automatically, therefore I need to re-check it again. It would be nice if it stayed checked.
Also, the "replace all" action is done in many single replacements, therefore undoing (Ctrl-Z) such an action can get quite tedious. It would be nice if all replacements could be undone in a single step.

Eldrad Ulthran <eldrad_ulthran>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by eldrad_ulthran (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-29 ttl StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-06-01 ttl StatusIn Progress Ready For Test
    2019-05-30 ttl StatusConfirmed In Progress
    2019-05-29 ttl Assigned toNone ttl
    2019-05-28 pantxo StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code