Recent

Author Topic: "copy" not working in source editor  (Read 10473 times)

dahaiou

  • New Member
  • *
  • Posts: 40
"copy" not working in source editor
« on: June 17, 2012, 07:14:31 pm »
Hello,
I just discovered I couldn't copy and paste text in the source editor. It turns out the copy operation fails.

Details: running: lazarus-0.9.30.4-fpc-2.6.0-win32 under Win7 64bit.

Fault: cannot copy text from source editor to windows clipboard.

method 1: mark some text and press Ctrl-C
method 2: mark some text, right-click and select "copy" from the pop-up menu
method 3: mark some text, click the "Edit" menu and select "copy"

The only effect of this "copy" operation is that any text already existing in the windows clipboard is eliminated. The selected text is never copied, and trying to paste elsewhere in the text, or in other apps, has no effect.

Has anybody else seen this? Any ideas?

Update: also "cut" has the effect of cutting out the selected text, but it is not copied to the clipboard and cannot be pasted.

Update: I uninstalled lazarus and installed the 64 bit version, and still have the same fault. Trying to go back to an earlier version next...

Update: Unistalled and reinstalled a previous version lazarus-0.9.30.2-fpc-2.4.4-win32 - still same results,
« Last Edit: June 17, 2012, 07:31:09 pm by dahaiou »

ttomas

  • Full Member
  • ***
  • Posts: 245
Re: "copy" not working in source editor
« Reply #1 on: June 17, 2012, 11:15:07 pm »
I don't know is it related with your problem, but one my client have problem with MS Office 2010 and other programs Copy/Paste. Searching web I find that problem is Skype Internet Explorer plugin ????
I know very strange. I disable Skype plugin in Internet Explorer and problem solved.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: "copy" not working in source editor
« Reply #2 on: June 18, 2012, 12:24:03 am »
Very strange.

I know it happens like once in a 100 times. This is caused if an other app locked the clipboard, at the exact moment. But then I am not sure if it should be cleared.

Please try the following:
- Use Lazarus 0.9.31 snapshot, if you can
- close ALL "designer forms". Form1 and other forms of your projert
- Options / Editor / General / Misc: "Copy/Paste with fold info disable"
- Test if your antivirus interferes (disable for a few moments).
  Though, I think this is really really unlikely ....
- Recompile the IDE with SynClipboardExceptions defined
  Tools / Build IDE / Edit defines (and then check it)
  or add -dSynClipboardExceptions to the build options

dahaiou

  • New Member
  • *
  • Posts: 40
Re: "copy" not working in source editor
« Reply #3 on: June 18, 2012, 01:33:41 pm »
Thanks for trying!

- Options / Editor / General / Misc: "Copy/Paste with fold info disable"

Actually disabling this option fixed it temporarily.

Then I went and turned this option back on, to check that this really was the culprit - sure enough, the fault reappeared, but when I wanted to disable it and go back it wouldn't work anymore.

Digging up snapshots or compiling Lazarus myself is not a viable option due to lack of time now, and I am having this fault on a laptop that I don't use a lot making it a low-priority issue in any case.

dahaiou

  • New Member
  • *
  • Posts: 40
Re: "copy" not working in source editor
« Reply #4 on: June 19, 2012, 01:13:37 am »
OK, I experimented some more, and "copy" is still failing.

Recompiling the IDE with that switch solved it very temporarily. After compiling and running a project in Lazarus, then stopping it, the fault reappears.

I also downloaded the latest snapshot, recompiled it with that switch, and again the same result.

The Lazarus source editor is simply broken on this particular system. So frustrating. Copying and pasting in text editors are such basic things you just expect them to work. I'm giving up.

ttomas

  • Full Member
  • ***
  • Posts: 245
Re: "copy" not working in source editor
« Reply #5 on: June 19, 2012, 11:14:25 am »
Don't giving up :'(
Do you have Skype installed?
Do you disable Skype plugin in Internet Explorer?
Skype Application is OK, but Skype plugin in IE monitor system Clipboard and corrupt any copy in clipboard. Skype plugin is active when your computer start without starting of IE.
Maybe some other plugin or application mess your clipboard.
In my client comp basic text copy/paste works in notepad, but any complex c/p from OpenOffice Write to MS Word or OO Calc to Excel don't work. Also when Copy range of cells in Excel, Paste copy only one cell (only text, without format)

dahaiou

  • New Member
  • *
  • Posts: 40
Re: "copy" not working in source editor
« Reply #6 on: June 19, 2012, 12:57:11 pm »
Thanks, but yes, I did disable the Skype plugin in IE.

Only the Lazarus source editor is having these difficulties.
I can copy and paste in all other apps just fine.

Whatever the fault is, it seems like there must be something different in the way Lazarus handles copy operations, compared to other apps, and the source editor is tripped up by these differences where other apps are not.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: "copy" not working in source editor
« Reply #7 on: June 19, 2012, 01:06:07 pm »
Only the Lazarus source editor is having these difficulties.
I can copy and paste in all other apps just fine.

Whatever the fault is, it seems like there must be something different in the way Lazarus handles copy operations, compared to other apps, and the source editor is tripped up by these differences where other apps are not.

Yes most likely. Btw, I tried the skype stuff, and enabling it, did not fail the IDE

Only, knowing that there is a bug in the IDE does not help. In order to fix it we need to be able to reproduce it.


dahaiou

  • New Member
  • *
  • Posts: 40
Re: "copy" not working in source editor
« Reply #8 on: June 20, 2012, 02:39:21 pm »
Yes, I absolutely agree, and I'd be happy to help with reproducing.

Strangest thing of all is that it suddenly started working for me again, without doing anything new, at least that I am aware of. I just gave it another go and lo and behold, the fault was gone and has stayed that way for just over a day now.

Something must be different compared to yesterday but I have no idea what it might be. I'll keep an eye out and report back here if I can detect a pattern.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: "copy" not working in source editor
« Reply #9 on: June 20, 2012, 03:22:19 pm »
Well, it is possible, that something else interferes with the clipboard (e.g. by monitoring, and maybe locking it).
That does not necessaries mean, that this something else is at fault. Maybe Lazarus does indeed have a problem with certain scenarios, and does not react correct to them.

Candidates to lock for could be (but not limited to):
- AntiVirus, (personally, I don't think that it would be...)
- Anything that monitors for specific clipboard content (e.g. phone number, url, ...)
- Virtual-Machines/Remote Desktop (due to clipboard sharing)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: "copy" not working in source editor
« Reply #10 on: June 20, 2012, 03:27:44 pm »
There is one thing, that may be worth trying:
  components\synedit\syneditmiscclasses.pp line 1286
Code: [Select]
function TSynClipboardStream.WriteToClipboard(AClipboard: TClipboard): Boolean;
begin
  if FIsPlainText and (FText <> '') then begin
    AClipboard.AsText:= FText;
    if not AClipboard.HasFormat(CF_TEXT) then
      raise ESynEditError.Create('Clipboard copy operation failed: HasFormat');
  end;
  Result := AClipboard.AddFormat(ClipboardFormatId, FMemStream.Memory^, FMemStream.Size);
end;
wrap the entire procedure body into a

Code: [Select]
  AClipboard.Open;
  try
Code: [Select]
  finally
     AClipboard.Close;
  end;


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9864
  • Debugger - SynEdit - and more
    • wiki
Re: "copy" not working in source editor
« Reply #11 on: June 20, 2012, 03:45:41 pm »
Actually, I committed that code. So just go SVN, or tomorrows snapshot.

A similar issue existed with an old linux, inside VirtualBox. But only affected the shared clipboard. Copy from SourceEdit to other linux apps did work.

Since SynEdit does add some format info in addition to the text, it takes to steps, to get that into the clipboard. Apparently other apps could get in between.

 

TinyPortal © 2005-2018