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:
58
58
59
59
## Fixes
60
60
- `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
61
62
62
63
## Misc Improvements
63
64
Original file line number Diff line number Diff line change @@ -127,7 +127,11 @@ function TextAreaContent:eraseSelection()
127
127
end
128
128
129
129
function 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
131
135
end
132
136
133
137
function TextAreaContent :copy ()
@@ -151,7 +155,7 @@ function TextAreaContent:copy()
151
155
self :lineStartOffset (),
152
156
self :lineEndOffset ()
153
157
)
154
- if curr_line :sub (- 1 ,- 1 ) ~= NEWLINE then
158
+ if not self . one_line_mode and curr_line :sub (- 1 ,- 1 ) ~= NEWLINE then
155
159
curr_line = curr_line .. NEWLINE
156
160
end
157
161
@@ -170,8 +174,9 @@ function TextAreaContent:cut()
170
174
end
171
175
172
176
function 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 ' )
175
180
if clipboard then
176
181
if self .clipboard_mode == CLIPBOARD_MODE .LINE and not self :hasSelection () then
177
182
local origin_offset = self .cursor
You can’t perform that action at this time.
0 commit comments