aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2003-05-11 03:00:30 +0000
committernyamatongwe <unknown>2003-05-11 03:00:30 +0000
commit9cf0b639730575de294b2f28d3df84468b98dce4 (patch)
treefa5745a47e8981e2cbe171cb7973ed6cc6c999f0 /src
parent40abd164fea420d6f2aa30639f8bb517904b7bae (diff)
downloadscintilla-mirror-9cf0b639730575de294b2f28d3df84468b98dce4.tar.gz
Ensure text copied to clipboard is terminated at correct length.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 75139e19f..190bcab1b 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -3888,13 +3888,8 @@ int Editor::KeyCommand(unsigned int iMessage) {
}
break;
case SCI_LINECUT: {
- int lineStart = pdoc->LineFromPosition(currentPos);
- int lineEnd = pdoc->LineFromPosition(anchor);
- if (lineStart > lineEnd) {
- int t = lineEnd;
- lineEnd = lineStart;
- lineStart = t;
- }
+ int lineStart = pdoc->LineFromPosition(SelectionStart());
+ int lineEnd = pdoc->LineFromPosition(SelectionEnd());
int start = pdoc->LineStart(lineStart);
int end = pdoc->LineStart(lineEnd + 1);
SetSelection(start, end);
@@ -4197,7 +4192,7 @@ char *Editor::CopyRange(int start, int end) {
}
void Editor::CopySelectionFromRange(SelectionText *ss, int start, int end) {
- ss->Set(CopyRange(start, end), end - start, false);
+ ss->Set(CopyRange(start, end), end - start + 1, false);
}
void Editor::CopySelectionRange(SelectionText *ss) {
@@ -4228,7 +4223,7 @@ void Editor::CopySelectionRange(SelectionText *ss) {
text[size] = '\0';
}
}
- ss->Set(text, size, true);
+ ss->Set(text, size + 1, true);
} else {
CopySelectionFromRange(ss, SelectionStart(), SelectionEnd());
}
@@ -4236,7 +4231,7 @@ void Editor::CopySelectionRange(SelectionText *ss) {
void Editor::CopyRangeToClipboard(int start, int end) {
SelectionText selectedText;
- selectedText.Set(CopyRange(start, end), end - start);
+ selectedText.Set(CopyRange(start, end), end - start + 1);
CopyToClipboard(selectedText);
}