bugGNU Octave - Bugs: bug #57633, Allow search/replace CR and LF in...

 
 

bug #57633: Allow search/replace CR and LF in GUI editor

Submitted by:  Philip Nienhuis <philipnienhuis>
Submitted on:  Sun 19 Jan 2020 12:11:52 PM UTC  
 
Category:  GUI Severity:  2 - Minor
Priority:  3 - Low Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  Open
Release:  dev Operating System:  Any

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)

Mon 20 Jan 2020 07:35:58 PM UTC, comment #6: 

Some more information aside the problem with LF and CR:

  • Any control character can be search in RegExp mode by just entering \xHH into the search field. This searches for the Hex-Character HH, e.g., \x00 for NUL and \x07 for BEL (see [1], no. 12)
  • Unfortunately, the same syntax does not work for the replace strings. Entering \xHH for the replace string just leads to \xHH in the text.
  • However, using \a, \t, \f etc as replace strings works.
  • \0 does not work, it is used for the complete matched expression (comparable to \1, \2 etc. when using RegExp).

An extended mode as the one of notepad++ might help for the replace string. In this case, we could parse for \x and then insert the following control character HH instead of the string \xHH.

[1]  https://www.scintilla.org/SciTERegEx.html

Torsten Lilge <ttl>
Project Member
Mon 20 Jan 2020 02:04:05 PM UTC, comment #5: 

In notepad++? easy, just '\0' (see attached pic). I just tried, works good.

Changed title as per your suggestion, severity a little higher (minor), priority => low.


Philip Nienhuis <philipnienhuis>
Project Member
Mon 20 Jan 2020 05:09:01 AM UTC, comment #4: 

"bell" is \a, but \0 does not work (at least the octave editor shows the same behavior as geany). How do you enter \0 in notepad++?

I agree that not being able to find and replace \n and/or \r is really not helpful. Since the alternative would be to code the complete find procedure by ourselves, we have to live with this for now. I suggest to change the report's summary into "Allow search/replace \n in GUI editor" and lower the severity to "1 - wish".

Torsten Lilge <ttl>
Project Member
Sun 19 Jan 2020 08:56:07 PM UTC, comment #3: 

Ah you're right, didn't occur to me that this functionality would live there. It isn't very obvious and explained nowhere.

So OK, it works for \t (tab) (fine! that's at least what I'd use it most often for), but other characters? \0 ?
How would I enter e.g., a "bell" (ascii 7)? Or am I asking just too much?

That \r (CR) and \n (LF) can't be processed is too bad (notepad++ can handle those; very very handy in selected cases) but well, I just may have to live with that.

If all functionality is there this bug report can be closed with "invalid" I suppose. Sorry for the noise in that case :-)

Philip Nienhuis <philipnienhuis>
Project Member
Sun 19 Jan 2020 08:25:04 PM UTC, comment #2: 

I remembered correctly: When checking "Regular Expressions", special characters are found and can be replaced except for "\n", as  stated on page https://www.scintilla.org/SciTERegEx.html:

Note that \r and \n are never matched because in Scintilla, regular expression searches are made line per line (stripped of end-of-line chars)

Torsten Lilge <ttl>
Project Member
Sun 19 Jan 2020 02:02:31 PM UTC, comment #1: 

Confirmed, this is an important feature.  I (whyever) have been assuming that this would already be working when activating "Regular Expressions". 

Torsten Lilge <ttl>
Project Member
Sun 19 Jan 2020 12:11:52 PM UTC, original submission:  

Title may say it all, but for completeness:

It would be nice if the GUI editor could find/replace special characters tabs, NULL characters, etc.
Use case example: currently an external editor like notepad++ is required for preprocessing e.g., large contributed files (replacing tabs with double spaces) before I can polish them in Octave's own editor.

I know that the editor can change CRLF into LF, but I sometimes need to process other special characters as well.

Philip Nienhuis <philipnienhuis>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-20 philipnienhuis Attached File- => Added notepadpp_null.PNG, #48258
        Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        SummaryAllow search/replace of special characters like tab, bell, CR, \0, etc. in GUI editor => Allow search/replace CR and LF in GUI editor
    2020-01-19 ttl StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.5