From 1103be3d857aa3a286a67de4f2fd1e6e5463df75 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 6 Jan 2007 15:33:07 +0000 Subject: [PATCH] Fix thinko: default paste method for plain text * src/lyxtext.h * src/text3.C (pasteString): Change argument to bool * src/text3.C (LyXText::dispatch): (LFUN_PASTE): Paste plain text as paragraphs, not as lines (LyXText::dispatch): Adjust to pasteString change * lib/bind/cua.bind: * lib/bind/sciword.bind: * lib/bind/mac.bind: Move shortcuts from "clipboard-paste paragraph" and "primary-selection-paste paragraph" to "primary-selection-paste" and "clipboard-paste", since the "paragaph" versions are used in LFUN_PASTE and middle-mouse-button paste. Now "primary-selection-paste" has the same shortcut it always had, and "clipboard-paste" has the shortcut that was originally assigned to "primary-selection-paste paragraph". git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16553 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/bind/cua.bind | 4 ++-- lib/bind/mac.bind | 4 ++-- lib/bind/sciword.bind | 4 ++-- src/lyxtext.h | 6 +++--- src/text3.C | 12 +++++++----- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/bind/cua.bind b/lib/bind/cua.bind index fc8825357d..78498fd7d2 100644 --- a/lib/bind/cua.bind +++ b/lib/bind/cua.bind @@ -68,8 +68,8 @@ \bind "C-c" "copy" \bind "C-x" "cut" \bind "C-v" "paste" -\bind "C-M-v" "clipboard-paste paragraph" -\bind "C-S-v" "primary-selection-paste paragraph" +\bind "C-S-v" "clipboard-paste" +\bind "C-M-v" "primary-selection-paste" \bind "C-z" "undo" \bind "C-y" "redo" diff --git a/lib/bind/mac.bind b/lib/bind/mac.bind index 8ed0dc038a..9781eff770 100644 --- a/lib/bind/mac.bind +++ b/lib/bind/mac.bind @@ -58,8 +58,8 @@ \bind "C-c" "copy" \bind "C-x" "cut" \bind "C-v" "paste" -\bind "C-M-v" "clipboard-paste paragraph" -\bind "C-S-v" "primary-selection-paste paragraph" +\bind "C-S-v" "clipboard-paste" +\bind "C-M-v" "primary-selection-paste" \bind "C-z" "undo" \bind "C-S-Z" "redo" diff --git a/lib/bind/sciword.bind b/lib/bind/sciword.bind index 00e403c9d3..0cf131d490 100644 --- a/lib/bind/sciword.bind +++ b/lib/bind/sciword.bind @@ -105,8 +105,8 @@ \bind "C-u" "font-underline" \bind "C-v" "paste" -\bind "C-M-v" "clipboard-paste paragraph" -\bind "C-S-v" "primary-selection-paste paragraph" +\bind "C-S-v" "clipboard-paste" +\bind "C-M-v" "primary-selection-paste" \bind "C-w" "buffer-close" \bind "C-x" "cut" \bind "C-z" "undo" diff --git a/src/lyxtext.h b/src/lyxtext.h index 34de738380..9a03033cf9 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -387,11 +387,11 @@ private: /// set 'number' font property void number(LCursor & cur); - /// paste string at current cursor. + /// paste plain text at current cursor. /// \param str string to paste - /// \param argument method for parsing ("paragraph" is special) + /// \param asParagraphs whether to paste as paragraphs or as lines void pasteString(LCursor & cur, docstring const & str, - docstring const & argument); + bool asParagraphs); }; } // namespace lyx diff --git a/src/text3.C b/src/text3.C index 038354ea04..f448e414bc 100644 --- a/src/text3.C +++ b/src/text3.C @@ -759,7 +759,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) cur.message(_("Paste")); cap::replaceSelection(cur); if (cmd.argument().empty() && !theClipboard().isInternal()) - pasteString(cur, theClipboard().get(), docstring()); + pasteString(cur, theClipboard().get(), true); else { string const arg(to_utf8(cmd.argument())); pasteSelection(cur, bv->buffer()->errorList("Paste"), @@ -866,11 +866,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) } case LFUN_CLIPBOARD_PASTE: - pasteString(cur, theClipboard().get(), cmd.argument()); + pasteString(cur, theClipboard().get(), + cmd.argument() == "paragraph"); break; case LFUN_PRIMARY_SELECTION_PASTE: - pasteString(cur, theSelection().get(), cmd.argument()); + pasteString(cur, theSelection().get(), + cmd.argument() == "paragraph"); break; case LFUN_UNICODE_INSERT: { @@ -1890,12 +1892,12 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, void LyXText::pasteString(LCursor & cur, docstring const & clip, - docstring const & argument) + bool asParagraphs) { cur.clearSelection(); if (!clip.empty()) { recordUndo(cur); - if (argument == "paragraph") + if (asParagraphs) insertStringAsParagraphs(cur, clip); else insertStringAsLines(cur, clip); -- 2.39.2