Skip to content

FIX #39959: COCOA: TEdit (TCocoaTextField): line-breaks are not removed when pasting multi-line text, and offset display error

rich2014 requested to merge richware/lazarus:cocoa/control/textfield into main

FIX: #39959 (closed) Cocoa: TEdit (TCocoaTextField): line-breaks are not removed when pasting multi-line text, and offset display error.

  1. line-breaks removed in TCocoaTextField.textView_shouldChangeTextInRange_replacementString(), just like in Windows.
  2. and then setUsesSingleLineMode(false) in TCocoaWSCustomEdit.CreateHandle(), all displays return to normal.

bypass the LCL and test directly at the Cocoa layer. after various property settings and various callback functions of NSTextField, NSTextField, NSTextCell, and NSTextView, we can roughly make the position of Cell and Editor correct when setUsesSingleLineMode:=true , there are still many small problems such as border size. and setUsesSingleLineMode:=false is a relatively simple and suitable choice. base on the paste issue fixed, there is only one line in TextField even setUsesSingleLineMode:=false.

Merge request reports