Basic IDE: Copy / paste not working properly / safely

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
hansz
Posts: 12
Joined: Thu Jun 05, 2008 2:01 pm
Location: Bielefeld, Germany

Basic IDE: Copy / paste not working properly / safely

Post by hansz »

I imported a moderately large VBA module (about 1800 lines of code) into a new OOo Basic module to convert the code step by step. Most of it is very basic Basic (math, string and array operations) on a level, where there are no or only small differences between VBA and OOo Basic. So I expected no difficulties. Then I attempted to paste some lines of standard disclaimer into the module. A messagebox appeared saying: „The inserted text is longer than the maximum length allowed for this textfield. The text has been truncated.“ - What?

1) Paste issues:
It turns out that I can't paste anything anymore into a module that contains more than 65535 characters (paragraph breaks included). I can type in additional code and I can move or multiply parts of code by drag and drop, but not paste a single character into the module. And even the message is totally wrong. (The above message text is my translation of the German message, so it may be different in an English localization.)

This problem was not reproducible on a machine with OOo 2.1, only with versions 2.4 and 2.4.1. All on different machines with Windows XP.

2) Copy issues:
When I select all the text in the module (CTRL+A), copy and paste it to a Writer or a Word document, or any other editor, only the first 65535 characters (paragraph breaks included) of the selection will be copied. Without any notification.

This problem was reproducible on OOo 2.1, and 2.4.1, where I tested it – both on Windows XP machines.

In my view, both the paste and copy issues are very serious bugs. Copy and paste belong to the most basic functionality of any text processing environment on a computer. When I can't rely on proper functioning, it's like I can't rely on breathing without thinking.

I simply can't do serious work without copy and paste. Of course I can split the module in smaller parts. But it is one logical unit and represents only one function of the add-in. And it is only one of more than 60 modules in the whole project. So splitting makes things much harder to manage. Furthermore there's no direct way to notice when you come near to the maximum length of code for pasting.

Please tell me: Are these known problems? Should I file bug reports? Are they still there in the 3.0 beta?

Best regards, Hans
OOo 3.2.1 Win XP, Vista, 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Basic IDE: Copy / paste not working properly / safely

Post by Villeroy »

Yes, it's a known limit. No need to file an issue. 65536 chars per paragraph in Writer and 65536, per Basic module and per Calc cell.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
hansz
Posts: 12
Joined: Thu Jun 05, 2008 2:01 pm
Location: Bielefeld, Germany

Re: Basic IDE: Copy / paste not working properly / safely

Post by hansz »

Villeroy wrote:Yes, it's a known limit. No need to file an issue. 65536 chars per paragraph in Writer and 65536, per Basic module and per Calc cell.
Thank you for answering, Villeroy. Well, I don't see any circumstances, where a limit of 65536 chars for a paragraph in writer would be much of a problem.

But these are different things. Copy and paste do work properly in writer, as far as I can see, and without any special limit. So I think the behaviour I described must still be seen as real and ugly bugs, not as limits. And at least the paste issue is a newly created one, OOo 2.1 didn't have it.

Hans
 Edit: Just for clarification: Villeroy's answer can be misinterpreted as saying that there's a limit of 65536 chars per Basic module. This is not the case. Instead, a paragraph (i.e. a line of code) in a Basic module is limited to a length of 65536 chars . This is not a problem at all, and not the problem I have described. You can have as much paragraphs (lines) of code as you want.

What I said was: When the whole content of the module counts more than 65536 chars (invisible characters included), you can't do paste operations anymore. And you can't copy more than 65536 chars from a Basic module to the clipboard. The rest of a selection larger than 65536 chars will just be ignored. 
Last edited by hansz on Fri Jun 27, 2008 2:53 pm, edited 1 time in total.
OOo 3.2.1 Win XP, Vista, 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Basic IDE: Copy / paste not working properly / safely

Post by Villeroy »

It is not a bug if it's designed to be limited for any technical reason. I'm shure this limit was around ever since version 1.
Does this help: http://www.oooforum.org/forum/viewtopic ... 536+module :?:
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
hansz
Posts: 12
Joined: Thu Jun 05, 2008 2:01 pm
Location: Bielefeld, Germany

Re: Basic IDE: Copy / paste not working properly / safely

Post by hansz »

No, Villeroy, the assumptions and conclusions made there are not what I encounter on my machine.
To test, do the following:

1.Fill one line (paragraph) in a Basic module to the brink with x's. Now you can try to paste something to the module. I can't. This is the paste issue I mentioned above. (Remember: in OOo 2.4 or 2.41, not in 2.1)
2.Change the last character of the paragraph (line) into a „u“.
3.Select and copy the line to a Writer document or an editor capable of character count.
4.Make sure you see the last „u“ in the Writer document, so that you're sure the whole length of the line is copied. Choose Tools - Word Count. What do you see? I see 65535 characters counted. In Microsoft Word, too. (BTW: After pasting the line into a Writer document, it is miraculously split into 7 paragraphs. Microsoft Word doesn't do that. Seems like another bug.)
5.Then go back to the module. Set the caret (write cursor) behind the last character and hit ENTER. Now you have a second paragraph.
6.Select the whole first paragraph minus one character and drag and drop it onto the second line while holding down STRG to copy it. Then add one character. Now you have two paragraphs, holding 65535 characters each.
7.Repeat step 6. as often as you like.
8. Select more than one of these paragraphs and copy the selection to the clipboard. On my machine, only one paragraph will have been copied, when I paste the clipboard content into any editor or word processor.
9.Copy the clipboard content several times into a writer document. Look at the page count. Then copy the whole content of the document into a new document via the clipboard. The new document will hold the same total amount of text as the first one. At least on my machine.

So that's what I said: Copy and paste do work properly in a Writer document, but not in a Basic module.

It seems, there are some urban legends around in the OOo community, that may have been right at times, but are not any more.

Hans
OOo 3.2.1 Win XP, Vista, 7
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Basic IDE: Copy / paste not working properly / safely

Post by Villeroy »

Well, that's a detailed description. Why not file an issue?
[Tutorial] Reporting bugs
Personally, I'm rather fatalistic about this issue. Basic has by far more serious bugs. In my opinion it is unusable as a programming language. Well it is a nice toy to embed some API calls in a document or write very easy spreadsheet functions. However, the latter could be dangerous.

Code: Select all

print cDbl("3,142"), cDbl("3.142")
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply