Author Topic: Find-in-File with nulls  (Read 156 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1881
  • Hero Points: 182
  • Text
Find-in-File with nulls
« on: January 02, 2020, 10:39:33 pm »
Bit of an odd case...
I've found that when the clipboard has text with embedded nulls and I paste into the "SearchFor" box in F-in-F, it confuses Slick dialog history.

Repro:
1. Get an appropriate clip. You can do this directly in Slick - insert a few \0 characters like "Word\0\0\0", select and copy to clipboard.
2. Open FnF and Paste into Search For.
3. Set Lookin to something
4. Set FileTypes to "*"
5. Do the search.

6. Reopen FnF.
7. Note that "FileTypes" is now set to "*.c;*.cxx;*.cpp;*.c++;*.h;*.hpp;*.hxx;*.h++;*.inl"
instead of "*"


Maybe SearchFor could make special characters visible? That would be Nice!
Maybe it shouldn't support inserting null characters?
Or Dialog history should support nulls correctly?

Fun thing I found: SearchFor supports Ctrl+Q (quote_char) allowing inserting of control characters.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5010
  • Hero Points: 417
Re: Find-in-File with nulls
« Reply #1 on: January 03, 2020, 01:48:27 am »
Not surprised. Null is being used as a string field separator. All character except null is supported. That's just not supported at the moment. Use a regex to search for nulls.

If your curious how the dialog history is stored, type this on the SlickEdit command line:

Code: [Select]
e +b .dialogs

jporkkahtc

  • Senior Community Member
  • Posts: 1881
  • Hero Points: 182
  • Text
Re: Find-in-File with nulls
« Reply #2 on: January 03, 2020, 04:05:19 am »
I didn't want to search for nulls, I just didn't know that the text I was pasting had nulls.

I was doing remote desktop from Win10 to Windows server something.
The console on older windows apparently adds nulls to the copied text.
Lots of them even when you select a block.

It would be better if paste into these controls would stop at the first null.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5010
  • Hero Points: 417
Re: Find-in-File with nulls
« Reply #3 on: January 03, 2020, 04:31:49 am »
I think the nulls in values could be stripped out. I'll have to take a look.

jporkkahtc

  • Senior Community Member
  • Posts: 1881
  • Hero Points: 182
  • Text
Re: Find-in-File with nulls
« Reply #4 on: January 07, 2020, 09:28:15 pm »
So this is definitely a change in behavior with 24.0.1
I tested with 23.0.2 and 24.0.0.8 vs. 24.0.1

Copy text from CMD.exe (from an OS before Windows 10).
CMD will post extra text to the clipboard with a NULL at the end, and sometimes lots of NULLs.

Paste into V24.0.1, you get everything.
Paste into V23 or 24.0.0.8, it stops at the first NULL, like you would expect.

I tried this pasting into a plain edit window.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5010
  • Hero Points: 417
Re: Find-in-File with nulls
« Reply #5 on: January 07, 2020, 11:41:49 pm »
24.0.1 has completely rewritten clipboard code for Windows. This was done to fix instability when using Qt's clipboard code on Windows.

Not hot fixable. Fixed for 24.0.2. Added code to truncate at the first null.

Being able to support binary clipboards on Windows would have been nice but it's not necessary and no other platform supports it either. v24.0.1 has some new hex clipboard features for supporting binary clipboards. In hex mode, you can copy/paste binary clipboards within the same instance of SlickEdit either as hex bytes (left hand side) or binary text (right hand side - definitely supports nulls). This is easily possible because SlickEdit will detect that an internal clipboard is being used and not copy text from the system clipboard.