Recent

Author Topic: anything in the clipboard of MS Word shows up in my project file  (Read 4959 times)

billd

  • Jr. Member
  • **
  • Posts: 51
This is weird and I am wondering if anyone else has seen this. 

If I copy some code into MS Word so I can format it better for printing, that text will later show up in my project file next time I open the IDE and load the project, even is Word is closed.

It took me a while to narrow this down and I am still not sure I have it figured out exactly, but here is what I did the most recent time this happened.

I opened the Lazarus IDE, and my most recent project loaded
I close all the open files
I created a new project and entered some code. I compiled it, ran it.
I copied that code into MS Word, reformatted it, printed it, shut Word down.
I closed the IDE, saving the new project as a "temp.lpr" project.
I clicked directly on my primary project (not the temp.lpr) and loaded it in the IDE

All the main project code was there, but what I copied into MS word was inserted into the main project. I have to let the complier find where it was inserted (to get the error messages to locate it) and delete it to get the code to compile.  Maybe it has nothing to do with Word, but rather with the copy operation. To copy, I am highlighting the text and using Ctrl-C and then pasting it into Word with Ctrl-V. 

Do the Ctrl-C and Ctrl-V keys do something different in the IDE causing this, or is something going on with MS Word and Lazarus?

Totally confused here.

Thanks,
 - Bill

Dzandaa

  • Full Member
  • ***
  • Posts: 249
  • From C# to Lazarus
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #1 on: August 17, 2023, 07:24:49 pm »
Hi,
Weird!!!

I use Ctrl+C and Ctrl+V without problem with LibreOffice Write, PSPad or directly from Firefox.

Perhaps Word insert some special formatting characters?

B->
Dzandaa

wp

  • Hero Member
  • *****
  • Posts: 11902
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #2 on: August 17, 2023, 08:22:17 pm »
Cannot reproduce based on your description.

Since you use Word, you must be on Windows. Which version? And which version of Word?
Next version question: Which version of Lazarus? Of FPC? 32bit or 64 bit?

If I understand correctly, the only copy operation goes from the IDE to Word? You copy a section of your source code? Just to make sure you do not make any intentional paste operation into the IDE? And within Word? You do only the only initial paste or any other copy/paste operations?

When I do a Ctrl+C with some highlighted text in the IDE, and paste it into word (with Ctrl+V), my clipboard viewer (https://sourceforge.net/p/wp-laz/code/HEAD/tree/ClipboardExplorer/) shows me that the clipboard contains the formats

1 - CF_TEXT
7 - CF_OEMTEXT
13 - CF_UNICODETEXT
16 - CF_LOCALE
49991 - Application/X-Laz-SynEdit-Tagged

I would say: This is nothing special: When I copy some text into the clipboard from Notepad++ I get the same formats, except for the Lazarus specific 49991.

You say: "I clicked directly on my primary project (not the temp.lpr) and loaded it in the IDE". Does this mean that you double-click on the project.lpr (or .lpi) file in the Windows explorer? Maybe this is a difference because I cannot do this since I have so many parallel versions of Lazarus. Does the error also appear when you first open the IDE and then open the project in the "File" menu or the recently-used files menu?

Since you had closed all main project units in one of the previous steps, the project now opens will all forms closed. Same with you? Do you open any files here again? Or do you simply start compiling and notice the broken source code now?

Do you have any utility apps running which create a "Ctrl+V" on special occasions?

billd

  • Jr. Member
  • **
  • Posts: 51
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #3 on: August 17, 2023, 10:01:56 pm »
Thanks for the thoughtful reply.  I will try to do some more tests tomorrow and nail things down so I can answer your question.  I first want to back up all my .Lxx files and put them in a different folder so this doesn't happen again...just in case.

I was hoping that it was something easily identifiable, but that would have been lucky.

I am running Win10 Pro and I think it is Word 2016.  It's the latest download from Lazarus and I am running in console mode with "simple projects"

It is almost as if whatever is in the Word clipboard is getting dumped into my Lazarus file. 

billd

  • Jr. Member
  • **
  • Posts: 51
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #4 on: August 20, 2023, 08:11:42 pm »
I have more information.

It does  not appear to be Word causing this. It happens when I use a ^F in the IDE to find something.  I went searching for the string "note:=--"

The IDE found the string, I did not use any paste operations.  I went back to compile my program and the "note:--" was in the middle of a procedure (and obviously the compile failed).  This is especially odd because I searched for some other strings before this and they did not show up. I must be doing something to cause this, but I can't figure out what it is.

One thing that was different, for the previous searches, I typed the search term in the search box. For the last search, I highlighted the "note:--" string so it would automatically show up in the search box.  Now that I think more about it, when it was happening with MS Word, I was highlighting also.

Could selecting the area have something to do with this paste operation I don't think I am causing?

Thanks for your insight

- Bill

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9844
  • Debugger - SynEdit - and more
    • wiki
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #5 on: August 20, 2023, 08:30:04 pm »
I close all the open files
I created a new project and entered some code. I compiled it, ran it.

I don't know if it is related... It still wouldn't explain anything...
But:

"Menu: File > Close all files" Does not close the current project.

Just in case you did that menu item, and expected different.

Of course if you do "Menu: Project > New Project" It will ask you do if to save the current project, and then close it.
If you used that. If you just did "Menu: File > new unit" then you are still in the old project.

And if you save it later under a new name.... If you did compile before the new name, then you did save under the old name.


wp

  • Hero Member
  • *****
  • Posts: 11902
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #6 on: August 21, 2023, 01:12:58 am »
It happens when I use a ^F in the IDE to find something. 
Just a - very - wild guess: F and V are very close on the keyboard. Maybe you hit ^V instead of ^F?

billd

  • Jr. Member
  • **
  • Posts: 51
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #7 on: August 21, 2023, 06:30:36 pm »
WP, I don't think that's the case. I've used the ^V and ^C frequently and I don't have the issue show up elsewhere, but I will keep my eyes open for that possibility.

I will continue to try and narrow this down more. There is obviously something I am doing that's unique to me since it does not seem to be a common problem.

Thanks all.

1HuntnMan

  • Full Member
  • ***
  • Posts: 183
  • From Delphi 7 to Lazarus
    • NewFound Photo Art
Re: anything in the clipboard of MS Word shows up in my project file
« Reply #8 on: October 25, 2023, 07:56:39 pm »
I do something similar that you do especially copying a bit of code from an old code files but I use NotePad++. Word probably has hidden stuff even when you copy/paste whether you right-click and select copy or Ctrl-C.
As for printing, NotePad++ will learn that you are opening up a pascal file and it's easy to format for printing.
Just a suggestion...

 

TinyPortal © 2005-2018