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

 
 

bug #56405: Search+Replace deleting characters disobeys selection

Submitted by:  Maxim Gawrilow <eldrad_ulthran>
Submitted on:  Tue 28 May 2019 11:59:44 AM UTC  
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Ready For Test Assigned to:  Torsten Lilge <ttl>
Originator Name:  Open/Closed:  Open
Release:  5.1.0 Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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>
Project MemberIn charge of this item.
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'.

Maxim Gawrilow <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>
Project 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>
Project MemberIn charge of this item.
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.

Maxim Gawrilow <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 pantxo (Posted a comment)
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by eldrad_ulthran (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.4