mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fixup 71623b88
: change semantics of "delete" LFUNs again
Instead of specifying "force" to disable the deletion protection mechanism, invert the default so that "confirm" is needed to activate it. The idea is to keep the lfun reasonable for scripting and add a special argument for interactive use. Document in release notes. Update LFUN.lyx documentation Update bind files. Add conversion step to prefs2prefs_lfun.py.
This commit is contained in:
parent
7b5a5e524b
commit
ff1ddf6251
@ -178,6 +178,16 @@
|
||||
|
||||
* branch-sync-all: Open/close all insets of selected branch (depending on its activation status).
|
||||
|
||||
* word-delete-forward, word-delete-backward, char-delete-forward,
|
||||
char-delete-backward
|
||||
|
||||
The 2.4 behavior of these functions is almost equivalent to the
|
||||
pre-2.3 behavior: without argument, it just deletes the
|
||||
next/previous element; with the "confirm" argument however, big
|
||||
insets are selected on the first call and deleted only on the
|
||||
second. This new behavior allow scripts to work intuitively and
|
||||
require the argument only for interactive use.
|
||||
|
||||
|
||||
!!!The following LyX functions have been removed in 2.4:
|
||||
|
||||
|
@ -226,8 +226,8 @@ Format 5
|
||||
# Edit group
|
||||
#
|
||||
|
||||
\bind "C-Delete" "word-delete-forward"
|
||||
\bind "C-BackSpace" "word-delete-backward"
|
||||
\bind "C-Delete" "word-delete-forward confirm"
|
||||
\bind "C-BackSpace" "word-delete-backward confirm"
|
||||
\bind "M-Return" "paragraph-break inverse"
|
||||
\bind "C-Return" "newline-insert newline"
|
||||
\bind "C-S-Return" "newline-insert linebreak"
|
||||
|
@ -31,7 +31,7 @@ Format 5
|
||||
\bind "C-a" "line-begin"
|
||||
\bind "C-b" "char-backward"
|
||||
#bind "C-c" "------" // used as users prefix
|
||||
\bind "C-d" "char-delete-forward"
|
||||
\bind "C-d" "char-delete-forward confirm"
|
||||
\bind "C-e" "line-end"
|
||||
\bind "C-f" "char-forward"
|
||||
\bind "C-g" "cancel"
|
||||
@ -225,9 +225,9 @@ Format 5
|
||||
# Edit group
|
||||
#
|
||||
|
||||
\bind "C-Delete" "word-delete-forward"
|
||||
\bind "M-d" "word-delete-forward"
|
||||
\bind "C-BackSpace" "word-delete-backward"
|
||||
\bind "C-Delete" "word-delete-forward confirm"
|
||||
\bind "M-d" "word-delete-forward confirm"
|
||||
\bind "C-BackSpace" "word-delete-backward confirm"
|
||||
\bind "M-Return" "paragraph-break inverse"
|
||||
\bind "C-Return" "newline-insert newline"
|
||||
\bind "C-S-Return" "newline-insert linebreak"
|
||||
|
@ -53,13 +53,13 @@ Format 5
|
||||
# +: "Control-B" # Move one character backward
|
||||
\bind "M-b" "char-backward"
|
||||
# +: "Control-D" # Delete the character in front of the cursor
|
||||
\bind "M-d" "char-delete-forward"
|
||||
\bind "M-d" "char-delete-forward confirm"
|
||||
# +: "Control-E" # Move to end of line/paragraph
|
||||
\bind "M-e" "line-end"
|
||||
# +: "Control-F" # Move one character forward
|
||||
\bind "M-f" "char-forward"
|
||||
# +: "Control-H" # Delete the character behind the cursor
|
||||
\bind "M-h" "char-delete-backward"
|
||||
\bind "M-h" "char-delete-backward confirm"
|
||||
# -: "Control-K" # Delete from the character in front of the cursor to the end of the line/paragraph
|
||||
# used by menu.bind - keymap
|
||||
# +: "Control-L" # Center the cursor/selection in the visible area
|
||||
@ -83,7 +83,7 @@ Format 5
|
||||
\bind "M-S-BackTab" "buffer-previous"
|
||||
\bind "A-S-BackTab" "buffer-previous"
|
||||
# +: "fn-Delete" # Forward Delete (on portable Macs' built-in keyboard)
|
||||
\bind "Delete" "char-delete-forward"
|
||||
\bind "Delete" "char-delete-forward confirm"
|
||||
# ?: "Control-F1" # Toggle full keyboard access on or off
|
||||
# +: "Control-F2" # Move focus to the menu bar
|
||||
# +: "Control-F3" # Move focus to the Dock
|
||||
@ -348,8 +348,8 @@ Format 5
|
||||
# Additional Edit group
|
||||
#
|
||||
|
||||
\bind "A-Delete" "word-delete-forward"
|
||||
\bind "A-BackSpace" "word-delete-backward"
|
||||
\bind "A-Delete" "word-delete-forward confirm"
|
||||
\bind "A-BackSpace" "word-delete-backward confirm"
|
||||
\bind "M-Return" "paragraph-break inverse"
|
||||
\bind "C-Return" "newline-insert newline"
|
||||
\bind "C-S-Return" "newline-insert linebreak"
|
||||
|
@ -38,8 +38,8 @@ Format 5
|
||||
\bind "Prior" "screen-up"
|
||||
\bind "Next" "screen-down"
|
||||
\bind "Return" "paragraph-break"
|
||||
\bind "Delete" "char-delete-forward"
|
||||
\bind "BackSpace" "char-delete-backward"
|
||||
\bind "Delete" "char-delete-forward confirm"
|
||||
\bind "BackSpace" "char-delete-backward confirm"
|
||||
|
||||
\bind "KP_Enter" "paragraph-break"
|
||||
\bind "KP_Right" "char-right"
|
||||
|
@ -152,4 +152,4 @@ Format 5
|
||||
#
|
||||
|
||||
\unbind "M-u" "word-upcase partial"
|
||||
\unbind "M-d" "word-delete-forward"
|
||||
\unbind "M-d" "word-delete-forward confirm"
|
||||
|
@ -33,7 +33,7 @@ Format 5
|
||||
\bind "C-a" "line-begin"
|
||||
\bind "C-b" "char-backward"
|
||||
#bind "C-c" "------" # see end of file
|
||||
\bind "C-d" "char-delete-forward"
|
||||
\bind "C-d" "char-delete-forward confirm"
|
||||
\bind "C-e" "line-end"
|
||||
\bind "C-f" "char-forward"
|
||||
\bind "C-g" "cancel"
|
||||
@ -220,10 +220,10 @@ Format 5
|
||||
# Edit group
|
||||
#
|
||||
|
||||
\bind "M-Delete" "word-delete-backward"
|
||||
\bind "C-Delete" "word-delete-forward"
|
||||
\bind "M-d" "word-delete-forward"
|
||||
\bind "C-BackSpace" "word-delete-backward"
|
||||
\bind "M-Delete" "word-delete-backward confirm"
|
||||
\bind "C-Delete" "word-delete-forward confirm"
|
||||
\bind "M-d" "word-delete-forward confirm"
|
||||
\bind "C-BackSpace" "word-delete-backward confirm"
|
||||
\bind "M-Return" "paragraph-break inverse"
|
||||
\bind "C-Return" "newline-insert newline"
|
||||
\bind "C-S-Return" "newline-insert linebreak"
|
||||
|
1338
lib/doc/LFUNs.lyx
1338
lib/doc/LFUNs.lyx
File diff suppressed because it is too large
Load Diff
@ -221,6 +221,27 @@ def remove_date_insert(line):
|
||||
return simple_remove(line, "date-insert")
|
||||
|
||||
|
||||
re_delete_force = re.compile(r"((char|word)-delete-(for|back)ward)(\s+force)?")
|
||||
def delete_force(line):
|
||||
# we change as follows:
|
||||
# char-delete-forward -> char-delete-forward confirm
|
||||
# but:
|
||||
# char-delete-forward force -> char-delete-forward
|
||||
#
|
||||
def change(match):
|
||||
if match.group(4):
|
||||
return match.group(1)
|
||||
else:
|
||||
return match.group(1) + " confirm"
|
||||
|
||||
result = re_delete_force.subn(change, line)
|
||||
if result[1]:
|
||||
return (True, result[0])
|
||||
else:
|
||||
return no_match
|
||||
|
||||
|
||||
|
||||
#
|
||||
###########################################################
|
||||
|
||||
@ -258,6 +279,7 @@ conversions = [
|
||||
info_rename_vcstime,
|
||||
info_rename_vcsrevision,
|
||||
info_rename_vcstreerevision,
|
||||
remove_date_insert
|
||||
remove_date_insert,
|
||||
delete_force
|
||||
]]
|
||||
]
|
||||
|
@ -1150,8 +1150,8 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_CHAR_DELETE_BACKWARD
|
||||
* \li Action: Deletes one character in the backward direction (usually the "BackSpace" key).
|
||||
* \li Syntax: char-delete-backward [force]
|
||||
* \li Params: force: Delete big insets, do not only select them.
|
||||
* \li Syntax: char-delete-backward [confirm]
|
||||
* \li Params: confirm: Select big insets, do not directly delete them.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_CHAR_DELETE_BACKWARD, "char-delete-backward", SingleParUpdate, Edit },
|
||||
@ -1159,8 +1159,8 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_CHAR_DELETE_FORWARD
|
||||
* \li Action: Deletes one character in the backward direction (usually the "Delete" key).
|
||||
* \li Syntax: char-delete-forward [force]
|
||||
* \li Params: force: Delete big insets, do not only select them.
|
||||
* \li Syntax: char-delete-forward [confirm]
|
||||
* \li Params: confirm: Select big insets, do not directly delete them.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_CHAR_DELETE_FORWARD, "char-delete-forward", SingleParUpdate, Edit },
|
||||
@ -2190,7 +2190,7 @@ void LyXAction::init()
|
||||
matches all note insets, while "Note:Note" only matches LyX
|
||||
yellow note insets.
|
||||
* \li Sample: Remove all index insets: \n
|
||||
inset-forall Index char-delete-forward force \n
|
||||
inset-forall Index char-delete-forward \n
|
||||
Close all Notes: \n
|
||||
inset-forall Note inset-toggle close \n
|
||||
Open all branch insets of branch "myBranch": \n
|
||||
@ -4417,8 +4417,8 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_WORD_DELETE_BACKWARD
|
||||
* \li Action: Deletes characters to the beginning of the word (usually the "C+BackSpace" key).
|
||||
* \li Syntax: word-delete-backward [force]
|
||||
* \li Params: force: Delete big insets, do not only select them.
|
||||
* \li Syntax: word-delete-backward [confirm]
|
||||
* \li Params: confirm: Select big insets, do not directly delete them.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_WORD_DELETE_BACKWARD, "word-delete-backward", Noop, Edit },
|
||||
@ -4426,8 +4426,8 @@ void LyXAction::init()
|
||||
/*!
|
||||
* \var lyx::FuncCode lyx::LFUN_WORD_DELETE_FORWARD
|
||||
* \li Action: Deletes characters to the end of the word (usually the "C+Delete" key).
|
||||
* \li Syntax: word-delete-forward [force]
|
||||
* \li Params: force: Delete big insets, do not only select them.
|
||||
* \li Syntax: word-delete-forward [confirm]
|
||||
* \li Params: confirm: Select big insets, do not directly delete them.
|
||||
* \endvar
|
||||
*/
|
||||
{ LFUN_WORD_DELETE_FORWARD, "word-delete-forward", Noop, Edit },
|
||||
|
@ -750,7 +750,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (cur.selection())
|
||||
cutSelection(cur, false);
|
||||
else
|
||||
deleteWordForward(cur, cmd.getArg(0) == "force");
|
||||
deleteWordForward(cur, cmd.getArg(0) != "confirm");
|
||||
finishChange(cur, false);
|
||||
break;
|
||||
|
||||
@ -758,7 +758,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (cur.selection())
|
||||
cutSelection(cur, false);
|
||||
else
|
||||
deleteWordBackward(cur, cmd.getArg(0) == "force");
|
||||
deleteWordBackward(cur, cmd.getArg(0) != "confirm");
|
||||
finishChange(cur, false);
|
||||
break;
|
||||
|
||||
@ -1225,7 +1225,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
if (cur.pos() == cur.paragraph().size())
|
||||
// Par boundary, force full-screen update
|
||||
singleParUpdate = false;
|
||||
else if (cmd.getArg(0) != "force" && cur.confirmDeletion()) {
|
||||
else if (cmd.getArg(0) == "confirm" && cur.confirmDeletion()) {
|
||||
cur.resetAnchor();
|
||||
cur.selection(true);
|
||||
cur.posForward();
|
||||
@ -1250,7 +1250,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
// Par boundary, full-screen update
|
||||
if (par_boundary)
|
||||
singleParUpdate = false;
|
||||
else if (cmd.getArg(0) != "force" && cur.confirmDeletion(true)) {
|
||||
else if (cmd.getArg(0) == "confirm" && cur.confirmDeletion(true)) {
|
||||
cur.resetAnchor();
|
||||
cur.selection(true);
|
||||
cur.posBackward();
|
||||
|
@ -827,8 +827,8 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
else if (!cur.inMacroMode())
|
||||
cur.recordUndoSelection();
|
||||
// if the inset can not be removed from within, delete it
|
||||
if (!cur.backspace(cmd.getArg(0) == "force")) {
|
||||
FuncRequest newcmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD, "force");
|
||||
if (!cur.backspace(cmd.getArg(0) != "confirm")) {
|
||||
FuncRequest newcmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD);
|
||||
cur.innerText()->dispatch(cur, newcmd);
|
||||
}
|
||||
break;
|
||||
@ -841,8 +841,8 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
else
|
||||
cur.recordUndoSelection();
|
||||
// if the inset can not be removed from within, delete it
|
||||
if (!cur.erase(cmd.getArg(0) == "force")) {
|
||||
FuncRequest newcmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD, "force");
|
||||
if (!cur.erase(cmd.getArg(0) != "confirm")) {
|
||||
FuncRequest newcmd = FuncRequest(LFUN_CHAR_DELETE_FORWARD);
|
||||
cur.innerText()->dispatch(cur, newcmd);
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user