Skip to content

Commit 6128596

Browse files
Fixed an issue in the query tool where, when multiple cursors were used to copy, only the first line was being copied. #8691
1 parent 58715da commit 6128596

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

web/pgadmin/static/js/components/ReactCodeMirror/CustomEditorView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ export default class CustomEditorView extends EditorView {
201201
}
202202

203203
getSelection() {
204-
return this.state.selection.ranges.map((range)=>this.state.sliceDoc(range.from, range.to)).join('') ?? '';
204+
const lineSep = this.state.facet(eol);
205+
return this.state.selection.ranges.map((range)=>this.state.sliceDoc(range.from, range.to)).join(lineSep) ?? '';
205206
}
206207

207208
replaceSelection(newValue) {

web/pgadmin/static/js/components/ReactCodeMirror/components/Editor.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,8 @@ const defaultExtensions = [
158158
autoCompleteCompartment.of([]),
159159
EditorView.clipboardOutputFilter.of((text, state)=>{
160160
const lineSep = state.facet(eol);
161-
// Fetch the primary selection from the editor's current state.
162-
const selection = state.selection.main;
163-
return state.doc.sliceString(selection.from, selection.to, lineSep);
161+
// Fetch the selection range from the editor's current state.
162+
return state.selection.ranges.map((range)=>state.sliceDoc(range.from, range.to)).join(lineSep) ?? '';
164163
})
165164
];
166165

0 commit comments

Comments
 (0)