Recent

Author Topic: Can I remove #09 from Search in Files results containing <TAB>?  (Read 1029 times)

741

  • New Member
  • *
  • Posts: 17
Is there a way to control the way <TAB> is displayed as #09?

I already have the option that "converts tabs to spaces" checked.
Note, the files being searched were converted from Delphi.

The results are hard to digest due to the #09, for example
   main.pas (14,2) RX_BUF_SIZE #$09      =#$091024;
   main.pas (15,21) TX_BUF_SIZE #$09#$09   =#$09RX_BUF_SIZE;
-------
Lazarus 2.2.6 (rev lazarus_2_2_6) FPC 3.2.2 x86_64-win64-win32/win64

Bart

  • Hero Member
  • *****
  • Posts: 5333
    • Bart en Mariska's Webstek
Re: Can I remove #09 from Search in Files results containing <TAB>?
« Reply #1 on: March 03, 2024, 10:42:34 am »
Is there a way to control the way <TAB> is displayed as #09?
You mean that the actual string '#09' turns up in the converted source file?
(And as a result you cannot compile any of it.)

Further along you write #$09, so this makes it even more strange.

Can you attach the Delphi source file and the converted Lazarus source file in question?
Did you use Lazarus to convert this file/project?
Can you tell us which settings you used to convert this file/project?

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Can I remove #09 from Search in Files results containing <TAB>?
« Reply #2 on: March 03, 2024, 10:50:03 am »
He means "Find in files", I just tested it. And yes, for some (obnoxious) reason it shows tabs as #$09.

Except for leading tabs, leading tabs/spaces aren't shown. But a tab char in the middle of the line => screws up the search result.


Sorry, not aware of any options.

But I suggest to report it as a bug. After all, it makes it impossible to distinguish between a line containing a tab and a line containing the literal text #$09

Bart

  • Hero Member
  • *****
  • Posts: 5333
    • Bart en Mariska's Webstek
Re: Can I remove #09 from Search in Files results containing <TAB>?
« Reply #3 on: March 03, 2024, 11:17:02 am »
Even better. using FindInFiles to search for the literal string '#$09' finds ide/searchfrm.pas (severla lines), but that string does not occur in this file at all. 

Running the exact FiF again (after closing all file FiF results) now finds it in 2 files (one test for the debugger) and in Utf8EscapeControlChars function in LazUtf8 unit.
And indeed that function is used in the search function:

  • searchresultview.pp (871,11) Result:=Utf8EscapeControlChars(APageName, emHexPascal);
  • searchresultview.pp (1457,16) lPart := Utf8EscapeControlChars(lPart, emHexPascal);
  • searchresultview.pp (1476,18) lPart := Utf8EscapeControlChars(lPart, emHexPascal);
  • sourceeditor.pp (3900,49) AText:=Format(lisUESearchStringNotFound, [Utf8EscapeControlChars(aFindText, emPa...

emHexPascal will give '#$09', whereas emPascal will give '#09' for a Tab.

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10222
  • Debugger - SynEdit - and more
    • wiki
Re: Can I remove #09 from Search in Files results containing <TAB>?
« Reply #4 on: March 03, 2024, 11:36:11 am »
It seems it was originally done for multiline pattern matches

Revision: 8783e0100de28ae66b6c85df299b7c3acbdacf79
Author: mattias <nc-gaertnma@netcologne.de>
Date: 01/09/2006 16:38:07
IDE: Find in Files: implemented multi line pattern and replacement, gtk intf: improved z ordering with modal forms git-svn-id: trunk@9779 -


Bart

  • Hero Member
  • *****
  • Posts: 5333
    • Bart en Mariska's Webstek
Re: Can I remove #09 from Search in Files results containing <TAB>?
« Reply #5 on: March 03, 2024, 11:43:56 am »
Reported as issue #40815.

Bart

 

TinyPortal © 2005-2018