File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
library/lua/gui/widgets/text_area Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ Template for new versions:
5858
5959## Fixes
6060- `gui/launcher`: ensure commandline is fully visible when searching through history and switching from a very long command to a short command
61+ - `gui/launcher`: flatten text when pasting multi-line text from the clipboard
6162
6263## Misc Improvements
6364
Original file line number Diff line number Diff line change @@ -127,7 +127,11 @@ function TextAreaContent:eraseSelection()
127127end
128128
129129function TextAreaContent :setClipboard (text )
130- dfhack .internal .setClipboardTextCp437Multiline (text )
130+ if self .one_line_mode then
131+ dfhack .internal .setClipboardTextCp437 (text )
132+ else
133+ dfhack .internal .setClipboardTextCp437Multiline (text )
134+ end
131135end
132136
133137function TextAreaContent :copy ()
@@ -151,7 +155,7 @@ function TextAreaContent:copy()
151155 self :lineStartOffset (),
152156 self :lineEndOffset ()
153157 )
154- if curr_line :sub (- 1 ,- 1 ) ~= NEWLINE then
158+ if not self . one_line_mode and curr_line :sub (- 1 ,- 1 ) ~= NEWLINE then
155159 curr_line = curr_line .. NEWLINE
156160 end
157161
@@ -170,8 +174,9 @@ function TextAreaContent:cut()
170174end
171175
172176function TextAreaContent :paste ()
173- local clipboard_lines = dfhack .internal .getClipboardTextCp437Multiline ()
174- local clipboard = table.concat (clipboard_lines , ' \n ' )
177+ local clipboard = self .one_line_mode and
178+ dfhack .internal .getClipboardTextCp437 () or
179+ table.concat (dfhack .internal .getClipboardTextCp437Multiline (), ' \n ' )
175180 if clipboard then
176181 if self .clipboard_mode == CLIPBOARD_MODE .LINE and not self :hasSelection () then
177182 local origin_offset = self .cursor
You can’t perform that action at this time.
0 commit comments