Skip to main content
johnrellis
Legend
October 7, 2022

P: SDK: Windows edit field truncates multi-line pasted text

  • October 7, 2022
  • 9 replies
  • 1698 views

On Windows, when you paste multi-line text into an osFactory:edit_field with height_in_lines = 1, all but the first line is discarded. But this doesn't happen when you paste more than two lines into an edit field with height_in_lines = 2 -- all the lines are preserved.  Nor does the bad behavior occur on Mac.  The Windows behavior of height_in_lines = 1 is inconsistent with height_in_lines = 2 and with Mac height_in_lines = 1.

 

This bug affects my Any Filter plugin's user interface -- it's important for users to be able to paste in multiple lines of text into an edit_field that for UI design purposes should otherwise be one line high:

 

The script below illustrates the problem.  I've attached screen recordings of running it on Windows and Mac.

 

 

 

local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"

local bind = LrView.bind
local f = LrView.osFactory()

LrFunctionContext.callWithContext ("", function (context)
    local prop = LrBinding.makePropertyTable (context)
    local controls = f:column {bind_to_object = prop,
        f:edit_field {height_in_lines = 1, width_in_chars = 10,
            immediate = true, value = bind "text1"},
        f:static_text {height_in_lines = 5, width_in_chars = 10,
            title = bind "text1"},
        f:edit_field {height_in_lines = 2, width_in_chars = 10,
            immediate = true, value = bind "text2"},
        f:static_text {height_in_lines = 5, width_in_chars = 10,
            title = bind "text2"}}

    local result = LrDialogs.presentModalDialog {title = "edit_field bug", 
        contents = controls}
    end)

 

 

 

9 replies

Rikk Flohr_Photography
Community Manager
Community Manager
May 6, 2025

@johnrellis 

 

I've forwarded your post to the team and asked them to review in the context of the previous bug. We will wait for their direction. 

 

Rikk Flohr: Adobe Photography Org
johnrellis
Legend
May 6, 2025

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

@Rikk Flohr: Photography, this bug was not completely fixed. Please reopen the bug report. 

 

Pasting multiple lines of text into an edit_field() succeeds on Windows when the regular-sized font is used but still fails when the small-sized font is used.  It works correctly on Mac. 

 

To reproduce, run the script below from within a plugin or using my Debugging Toolkit's Debug Script command. (It won't work from the Scripts folder due to another bug I just reported.)  Copy these four lines of text:

Line 1
Line 2
Line 3
Line 4

and paste them into the four edit_field boxes.   On Mac, the four lines correctly paste into each box:

 

But on Windows, the last three lines don't paste correctly into the 1-line edit field using the small font:

 

The workaround provided above by the team appears to work in this case.

 

local LrBinding = import "LrBinding"
local LrDialogs = import "LrDialogs"
local LrFunctionContext = import "LrFunctionContext"
local LrView = import "LrView"

local bind = LrView.bind
local f = LrView.osFactory()

LrFunctionContext.callWithContext ("", function (context)
    local prop = LrBinding.makePropertyTable (context)
    local controls = f:column {bind_to_object = prop, 
        f:row {
            f:column {size = "small",
                f:static_text {title = "Small 1-line:"},
                f:edit_field {height_in_lines = 1, width_in_chars = 10,
                    immediate = true, value = bind "text1",
                    use_RTF = WIN_ENV, resize_to_fit_text_height = false},
                f:static_text {height_in_lines = 5, width_in_chars = 10,
                    title = bind "text1"}},
            f:column {size = "regular",
                f:static_text {title = "Regular 1-line:"},
                f:edit_field {height_in_lines = 1, width_in_chars = 10,
                    immediate = true, value = bind "text2"},
                f:static_text {height_in_lines = 5, width_in_chars = 10,
                    title = bind "text2"}}},
        f:row {
            f:column {size = "small",
                f:static_text {title = "Small 2-line:"},
                f:edit_field {height_in_lines = 2, width_in_chars = 10,
                    immediate = true, value = bind "text3"},
                f:static_text {height_in_lines = 5, width_in_chars = 10,
                    title = bind "text3"}},
            f:column {size = "regular",
                f:static_text {title = "Regular 2-line:"},
                f:edit_field {height_in_lines = 2, width_in_chars = 10,
                    immediate = true, value = bind "text4"},
                f:static_text {height_in_lines = 5, width_in_chars = 10,
                    title = bind "text4"}}}}
    local result = LrDialogs.presentModalDialog {title = "edit_field bug", 
        contents = controls}
    end)

 

johnrellis
Legend
August 17, 2023

I confirmed that the original test script now runs correctly on both Win and Mac, thanks much.

Rikk Flohr_Photography
Community Manager
Community Manager
August 17, 2023

Greetings all,

 

Updates for the Adobe Photography Products have been released.  The August 2023 updates contain a fix for this issue. 

If you do not see the update in your Creative Cloud Application, you can refresh it by hitting [Ctrl/Cmd]+[Alt/Opt]+[ R ].

Note: It may take up to 24 hours for your update to be available in your Creative Cloud app.

 

Thank you for your patience.

Rikk Flohr: Adobe Photography Org
Rikk Flohr_Photography
Community Manager
Community Manager
June 8, 2023

I will pass that back to the team.

Rikk Flohr: Adobe Photography Org
johnrellis
Legend
June 8, 2023

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

The workaround works on Win, but on Mac (where the bug doesn't occur), it stores rich-text-formatted code in the bound value of the edit field, e.g.

 

 

I don't have access to any Lua code that parses RTF, but this modified workaround works just fine:

 

use_RTF = WIN_ENV, resize_to_fit_text_height = false

 

johnrellis
Legend
June 8, 2023

That works, thanks much.

Rikk Flohr_Photography
Community Manager
Community Manager
June 8, 2023

@johnrellis 
The team has asked if you can verify this workaround:

 

"A workaround is to have the below values for the edit_field. use_RTF will make the edit_field accept multiline text, and resize_to_fit_text_height will prevent the edit_field from expanding.

use_RTF = true, resize_to_fit_text_height = false"

Rikk Flohr: Adobe Photography Org
Rikk Flohr_Photography
Community Manager
Community Manager
October 7, 2022

Update Status for Bug

Rikk Flohr: Adobe Photography Org