Recent

Author Topic: [SOLVED] Why is there no: "Convert to '...'#13#10+ " menu?  (Read 2469 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12387
  • Debugger - SynEdit - and more
    • wiki
Re: Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #15 on: December 18, 2025, 11:43:02 am »
But... it's not missing   :)

Well, it's not "convert". Convert would be if it takes text already in the editor.

But it does the job, if you are willing to copy/cut the text first, and then paste it.

DomingoGP

  • Full Member
  • ***
  • Posts: 115
Re: Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #16 on: December 18, 2025, 02:09:50 pm »
I use a Pascal script macro to do it.

The macro convert the selected text to a Pascal string. Useful when dealing with  SQL queries  or OpenGL shaders.

https://github.com/DomingoGP/LazarusMacroPasDoc/blob/master/MacroSelectionToString.txt

Requires pascal script enabled.

Nicole

  • Hero Member
  • *****
  • Posts: 1324
Re: Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #17 on: December 18, 2025, 03:09:16 pm »
There is a nice thing working with all text:
sLineBreak;

s:='You will need it often:' + slinebreak + 'May be you remember "sLinebreak" and not keep mixing up #13#10 and #10#13"' + linebreak + linebreak + 'Enjoy!';

ShowMessage(s);

PizzaProgram

  • Jr. Member
  • **
  • Posts: 62
  • ...developing Delphi apps since 25 years.
Re: [SOLVED] Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #18 on: December 24, 2025, 06:24:52 am »
Thanks You very much for all the solutions!
Marry Christmas to ALL of You!  :D

(Sorry I had not time to answer sooner, but I had a deadline until Christmas. Which I've succeeded! )  :-[
 
1. I've never have thought that it could be solved with Edit>Multiline  ("cut first", paste it back ... )

1.1. Especially because it is translated to my local language (hu) as "Beillesztés forráskóddal ..."
 = which could be translated back to English as: "Paste with source code ..."

1.2. IMHO the "Beillesztés mint ..." = "Paste as ..." would be a better naming for that menu.

2. Yes, I had 25 years long used a separate little EXE to do the job, which I've wrote to myself (in D7), having 2 text boxes + 1 button which already copied to the clipboard the result.
(... but this time I did not have it at my hand, because I'm developing on a remote secured Win-VPS via RDP.)
 
3. Those, who are developing Lazarus IDE, please consider to:
   - Add +1 line under the context menu [Source]: '  Convert to '...'+sLineBreak+
(put spaces before/after + sign, if it is set so. 'string' + sLineBreak +

That's where I was (logically) searched first. (and +3x after, if I might have missed something) 

4. While I like the idea that the new FPC will be able to handle multiline strings at the source, that would mean we'll loose intention (="TABulation") of the code.
Personally I always disliked it in other programming languages. Makes very hard to see where the real code starts or ends.
 
PS.: Edited Subject as [SOLVED] ...
x86_64-win64 --Win7 PRO 64bit HUN

dseligo

  • Hero Member
  • *****
  • Posts: 1686
Re: [SOLVED] Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #19 on: December 24, 2025, 11:01:11 am »
2. Yes, I had 25 years long used a separate little EXE to do the job, which I've wrote to myself (in D7), having 2 text boxes + 1 button which already copied to the clipboard the result.

I also have similar program (but not for that long :)). Only my program have one more button: it's purpose is to make clear SQL when from source, so it works in both ways.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12387
  • Debugger - SynEdit - and more
    • wiki
Re: [SOLVED] Why is there no: "Convert to '...'#13#10+ " menu?
« Reply #20 on: December 24, 2025, 11:04:35 am »
3. Those, who are developing Lazarus IDE, please consider to:
   - Add +1 line under the context menu [Source]: '  Convert to '...'+sLineBreak+
(put spaces before/after + sign, if it is set so. 'string' + sLineBreak +

Please add as a feature request "Convert selected text to quoted string".
Same as "Multipaste...", just work on text already in editor.

 

TinyPortal © 2005-2018