Issue 128168 - Pasting Clipboard content into Text field
Summary: Pasting Clipboard content into Text field
Status: CLOSED NOT_AN_OOO_ISSUE
Alias: None
Product: General
Classification: Code
Component: ui (show other issues)
Version: 4.1.6
Hardware: All All
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-06 09:23 UTC by Czesław Wolański
Modified: 2019-10-12 17:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
pasting two character string into text field in Overwrite mode (164.49 KB, image/jpeg)
2019-08-06 20:06 UTC, Czesław Wolański
no flags Details
Calc file with macro - Dialog with text field (11.69 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-08-06 20:12 UTC, Czesław Wolański
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Czesław Wolański 2019-08-06 09:23:50 UTC
Operating system: Windows 7 Home Premium 64 bit
Apache OpenOffice 4.1.6

1. SITUATION:
 - macro executing simple Dialog - only Text Box (com.sun.star.awt.UnoControlEdit)
 - value of Model.MaxTextLen set
 - current length of text equals MaxTextLen
 - OVERWRITE mode is on
 - cursor at any position


2. PROBLEM:   
Pasting content of Clipboard <Ctrl-V> results in:
 - OpenOffice displaying message about cutting text (OK)
 - removing character at cursor position ?????


3. EXAMPLES:

  Edit Control, MaxTexLen = 5, current text = 12345
  Clipboard content = ab
  * - marks cursor position


                *
before pasting  12345

                *
after pasting   2345



                 *  
before pasting 12345
   
                 *
after pasting  1245
Comment 1 oooforum (fr) 2019-08-06 14:24:30 UTC
Save our time and provide the document
Comment 2 Czesław Wolański 2019-08-06 20:06:06 UTC
Created attachment 86720 [details]
pasting two character string into text field in Overwrite mode
Comment 3 Czesław Wolański 2019-08-06 20:12:17 UTC
Created attachment 86721 [details]
Calc file with macro - Dialog with text field

run macro ---> Library PasteTEST, Module1, subroutine Main
Comment 4 oooforum (fr) 2019-08-07 12:27:17 UTC
Well, this message occurs certainly because you have not only "ab" in Clipboard.
Select "ab" in a cell and you will have "ab" and a carriage return. 
So more than 2 chars.
Comment 5 Czesław Wolański 2019-08-07 17:30:09 UTC
(In reply to oooforum (fr) from comment #4)
> Well, this message occurs certainly because you have not only "ab" in
> Clipboard.
> Select "ab" in a cell and you will have "ab" and a carriage return. 
> So more than 2 chars.

I see that "Issue 128168 - Pasting Clipboard content into Text field" has now gained status "RESOLVED NOT_AN_OOO_ISSUE"
Excuse my stubbornness - but am I missing something? If that's the case, would someone care to enlighten me on Clipboard and text/string handling philosophy in OpenOffice.

Please read the following and then - if you find it advisable - reply. I shall truly appreciate it.

1. Issue i.e. MISSING CHARACTER in OVERWRITE mode does not occur when:
   - lenght of text is not equal to MaxTexLen (text is shorter than limit)
   - block is marked (blue background) - one character or more

2. Before I decided to report this "would-be bug" I checked pasting 
   Clipboard content set in:
   - Notepad++ 
     (Menu > View > Show End of Line). Clearly I copied to Clipboard only 
     characters, not characters and CR/LF. NotePad++ allows to copy line 
     with CR/LF too.

   - OpenOffice
     I tested many cases:
      (i) copy cell,
      (ii) copy cell content (as you described in your comment),
      (iii) copy part of a cell content

Your remark << Select "ab" in a cell and you will have "ab" and a carriage return>>  is perfectly correct yet if generalized has strange onsequencies. If the cell content is, say "xxabyy", and I mark part of it - for example "ab" - and copy it, then OpenOffice copies "ab" and adds carriage return. (see (iii) above - after Paste operation one character vanished).
If I paste "ab" into the OpenOffice Writer actually new line appears.
If I paste same "ab" into Notepad++, new line does not appear (spooky, isn't it? Or at least proves inconsistency)
Part of cell content should be string as it is not string with carriage return (unless explicitly stated or predefined - like in Basic: Chr(13) & Chr(10) or "MultiLine" property in UNO), no matter what I intend to do with: copy to Clipboard, copy to another cell and so one.
     
     
3. Even if a carriage return is added (as in case of barcode scanner adding 
   CR/LF/Return or Enter key to barcode for efficiency), why one character       
   after paste operation is MISSING? (see point 1.). One would argue that 
   when lenght of text reaches MaxTextLen and pasting occurs:
   - in INSERT mode text remains unchanged
   - in OVERWRITE mode - text shall be shortened - really? (again: what 
   about missing character and cases mentionned in point 1. above)

Hence my humble request at the beginning.
Comment 6 Czesław Wolański 2019-08-07 19:35:07 UTC
(In reply to oooforum (fr) from comment #4)
> Well, this message occurs certainly because you have not only "ab" in
> Clipboard.
> Select "ab" in a cell and you will have "ab" and a carriage return. 
> So more than 2 chars.

ADDENDUM to Comment #5 (reply to Comment #4)

Seems if have found another clear inconsistency in above explanation, this time solely within OpenOffice.
If, as stated above, OpenOffice adds a carriage return to string copied from a cell, then why when Clipboard content is pasted into another cell, new line does not appear - please compare this with pasting Clipboard content into OpenOffice Writer (new line does appear). Is therefore a carriage return in effect as a general rule or is handled on case-by-case basis?

Please note in this context that pressing OK when cell is in Edit mode
results in moving cursor cell into adjacent cell.

Pasting string with added carriage return merely changes cell content.