Skip to content

Search & Replace does not handle \n and \t correctly + is inconsistent. Also rendering problems after Cmd-Z #255

@tomm174

Description

@tomm174

Fill the following template, and post it on GitHub Issues or send to subethaedit-bugs@lone.monkey.productions. Please note that the contents of the sent email can be shared on the Issue page. Please write the contents in English.

Title: Search & Replace incorrctly handles \n & \t + rendering errors after undo


Short Description

Putting \n as the replacement string results in a literal \n in the edited file. similarly \t results in literal \t. Inconsistent results of search & replace seemingly depending on previous contents of 'Replace' box. Also transient incorrect rendering problems Ctrl-Z.
If I attempt to replace by pasting a new line character in the replace box, then the search character is replaced by three new lines.

Steps to Reproduce the Issue

Paste some text with a character to be replaced e.g.
79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin)

Position caret to start of line
Put , into the 'find' box
Put \n into the 'replace' box

TEST 1/ Replace string \n not treated as new line

Click the 'Show the next match' arrow. Click replace, replace, replace.

Expected Result

79(_appserverusr)
80(admin)
81(_appserveradm)
98(_lpadmin)

Actual Result

79(_appserverusr)
\n
80(admin)
\n
81(_appserveradm)
\n
98(_lpadmin)

TEST 2/ Rendering error after Ctrl-Z to undo

Ctrl-Z, Ctrl-Z, Ctrl-Z to undo

Expected Result

79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin)

Actual Result

79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin)
\n
80(admin),81(_appserveradm),98(_lpadmin)

  • Then click anywhere and the last 2 lines disappear leaving

79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin)

TEST 3/ Replace all

Steps

setup as for TEST 1
Click 'Replace All'

Expected Result

79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin)

Actual Result

The results are inconsistent, depending - at least partly - on what has been put into the replace box before.
I have repeated this and had the , replaced with an actual new-line character, with \n, with three new line characters...
Is it that the previous contents of the 'Replace' box are getting appended / prepended to the contents ??? I don't know..

Sorry, I wanted to produce a nice bug report for you but with inconsistent behaviour I really don't know how to.
Shame, I quite liked the program but I don't think I can go on using it.
Good luck, and thanks for your work.

Some results :

80(admin)

\n
81(_appserveradm)zzz

\n
98(_lpadmin)

79(_appserverusr)\n80(admin)\n81(_appserveradm)\n98(_lpadmin)

79(_appserverusr)
80(admin)
81(_appserveradm)
98(_lpadmin)

(Hooray for the last one)

Environment

  • SubEthaEdit: Version 5.2.4 (9810)
  • System: Version 12.7.4 (Build 21H1123)
  • Language: English
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro11,4
      Processor Name: Quad-Core Intel Core i7
      Processor Speed: 2.5 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 6 MB
      Hyper-Threading Technology: Enabled
      Memory: 16 GB
      System Firmware Version: 489.0.0.0.0
      OS Loader Version: 540.120.3~37
      SMC Version (system): 2.29f24
      Serial Number (system): C02TP00MG8WL
      Hardware UUID: BBAC513A-25BB-50A5-90D7-7E773CE32357
      Provisioning UDID: BBAC513A-25BB-50A5-90D7-7E773CE32357


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions