On Mac, moving down a paragraph should place the cursor at the end of the current paragraph

(unless it's already there, in which case it should move to the end of the next paragraph).
Change the preference setting name (mac_like_word_movement to mac_like_cursor_movement)
to better reflect its function.

Patch and description from Bennett Helm
This commit is contained in:
Stephan Witt 2013-05-25 18:02:21 +02:00
parent 427aeff90f
commit 75c631df7f
8 changed files with 38 additions and 26 deletions

View File

@ -28,7 +28,7 @@
\screen_font_sans "Helvetica"
\screen_font_typewriter "Courier"
\open_buffers_in_tabs false
\mac_like_word_movement true
\mac_like_cursor_movement true
\scroll_wheel_zoom "off"

View File

@ -57,6 +57,9 @@
# Add option to use the system's theme icons
# No conversion necessary.
# Incremented to format 13, by bh
# Rename mac_like_word_movement to mac_like_cursor_movement
import re
###########################################################
@ -290,6 +293,8 @@ def remove_default_language(line):
return no_match
return (True, "")
def mac_cursor_movement(line):
return simple_renaming(line, "\\mac_like_word_movement", "\\mac_like_cursor_movement")
# End conversions for LyX 2.0 to 2.1
####################################
@ -313,5 +318,6 @@ conversions = [
[ 9, [ remove_default_language ]],
[ 10, []],
[ 11, [split_pdf_format]],
[ 12, []]
[ 12, []],
[ 13, [mac_cursor_movement]]
]

View File

@ -55,7 +55,7 @@ namespace os = support::os;
namespace {
static unsigned int const LYXRC_FILEFORMAT = 12; // vfr: System theme's icons
static unsigned int const LYXRC_FILEFORMAT = 13; // vfr: System theme's icons
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
@ -134,7 +134,7 @@ LexerKeyword lyxrcTags[] = {
{ "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
{ "\\load_session", LyXRC::RC_LOADSESSION },
{ "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
{ "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
{ "\\mac_like_cursor_movement", LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT },
{ "\\macro_edit_style", LyXRC::RC_MACRO_EDIT_STYLE },
{ "\\make_backup", LyXRC::RC_MAKE_BACKUP },
{ "\\mark_foreign_language", LyXRC::RC_MARK_FOREIGN_LANGUAGE },
@ -331,7 +331,7 @@ void LyXRC::setDefaults()
scroll_wheel_zoom = SCROLL_WHEEL_ZOOM_CTRL;
paragraph_markers = false;
mac_dontswap_ctrl_meta = false;
mac_like_word_movement = false;
mac_like_cursor_movement = false;
macro_edit_style = MACRO_EDIT_INLINE_BOX;
dialogs_iconify_with_main = false;
preview = PREVIEW_OFF;
@ -931,8 +931,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
lexrc >> mac_dontswap_ctrl_meta;
break;
case RC_MAC_LIKE_WORD_MOVEMENT:
lexrc >> mac_like_word_movement;
case RC_MAC_LIKE_CURSOR_MOVEMENT:
lexrc >> mac_like_cursor_movement;
break;
case RC_MACRO_EDIT_STYLE:
@ -1784,12 +1784,12 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
}
if (tag != RC_LAST)
break;
case RC_MAC_LIKE_WORD_MOVEMENT:
case RC_MAC_LIKE_CURSOR_MOVEMENT:
if (ignore_system_lyxrc ||
mac_like_word_movement
!= system_lyxrc.mac_like_word_movement) {
os << "\\mac_like_word_movement "
<< convert<string>(mac_like_word_movement) << '\n';
mac_like_cursor_movement
!= system_lyxrc.mac_like_cursor_movement) {
os << "\\mac_like_cursor_movement "
<< convert<string>(mac_like_cursor_movement) << '\n';
}
if (tag != RC_LAST)
break;
@ -2967,7 +2967,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
case LyXRC::RC_LYXRCFORMAT:
case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
case LyXRC::RC_MAC_LIKE_CURSOR_MOVEMENT:
case LyXRC::RC_MACRO_EDIT_STYLE:
case LyXRC::RC_MAKE_BACKUP:
case LyXRC::RC_MARK_FOREIGN_LANGUAGE:
@ -3145,8 +3145,8 @@ string const LyXRC::getDescription(LyXRCTags tag)
str = _("Make Apple key act as Meta and Control key as Ctrl.");
break;
case RC_MAC_LIKE_WORD_MOVEMENT:
str = _("Use the Mac OS X conventions for the word-level cursor movement");
case RC_MAC_LIKE_CURSOR_MOVEMENT:
str = _("Use the Mac OS X conventions for cursor movement");
break;
case RC_SHOW_MACRO_LABEL:

View File

@ -114,7 +114,7 @@ public:
RC_LYXRCFORMAT,
RC_MACRO_EDIT_STYLE,
RC_MAC_DONTSWAP_CTRL_META,
RC_MAC_LIKE_WORD_MOVEMENT,
RC_MAC_LIKE_CURSOR_MOVEMENT,
RC_MAKE_BACKUP,
RC_MARK_FOREIGN_LANGUAGE,
RC_MOUSE_WHEEL_SPEED,
@ -428,7 +428,7 @@ public:
///
bool mac_dontswap_ctrl_meta;
///
bool mac_like_word_movement;
bool mac_like_cursor_movement;
///
bool cursor_follows_scrollbar;
///

View File

@ -1057,7 +1057,7 @@ bool Text::cursorForwardOneWord(Cursor & cur)
return false;
}
if (lyxrc.mac_like_word_movement) {
if (lyxrc.mac_like_cursor_movement) {
// Skip through trailing punctuation and spaces.
while (pos != lastpos && (par.isChar(pos) || par.isSpace(pos)))
++pos;
@ -1099,7 +1099,7 @@ bool Text::cursorBackwardOneWord(Cursor & cur)
if (pos == 0 && pit != 0)
return setCursor(cur, pit - 1, getPar(pit - 1).size());
if (lyxrc.mac_like_word_movement) {
if (lyxrc.mac_like_cursor_movement) {
// Skip through punctuation and spaces.
while (pos != 0 && (par.isChar(pos - 1) || par.isSpace(pos - 1)))
--pos;

View File

@ -773,7 +773,13 @@ bool Text::cursorDownParagraph(Cursor & cur)
{
bool updated = false;
if (cur.pit() != cur.lastpit())
updated = setCursor(cur, cur.pit() + 1, 0);
if (lyxrc.mac_like_cursor_movement)
if (cur.pos() == cur.lastpos())
updated = setCursor(cur, cur.pit() + 1, getPar(cur.pit() + 1).size());
else
updated = setCursor(cur, cur.pit(), cur.lastpos());
else
updated = setCursor(cur, cur.pit() + 1, 0);
else
updated = setCursor(cur, cur.pit(), cur.lastpos());
return updated;

View File

@ -2683,7 +2683,7 @@ PrefEdit::PrefEdit(GuiPreferences * form)
this, SIGNAL(changed()));
connect(scrollBelowCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(macLikeWordMovementCB, SIGNAL(clicked()),
connect(macLikeCursorMovementCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(sortEnvironmentsCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
@ -2712,7 +2712,7 @@ void PrefEdit::apply(LyXRC & rc) const
{
rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked();
rc.scroll_below_document = scrollBelowCB->isChecked();
rc.mac_like_word_movement = macLikeWordMovementCB->isChecked();
rc.mac_like_cursor_movement = macLikeCursorMovementCB->isChecked();
rc.sort_layouts = sortEnvironmentsCB->isChecked();
rc.group_layouts = groupEnvironmentsCB->isChecked();
switch (macroEditStyleCO->currentIndex()) {
@ -2734,7 +2734,7 @@ void PrefEdit::update(LyXRC const & rc)
{
cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar);
scrollBelowCB->setChecked(rc.scroll_below_document);
macLikeWordMovementCB->setChecked(rc.mac_like_word_movement);
macLikeCursorMovementCB->setChecked(rc.mac_like_cursor_movement);
sortEnvironmentsCB->setChecked(rc.sort_layouts);
groupEnvironmentsCB->setChecked(rc.group_layouts);
macroEditStyleCO->setCurrentIndex(rc.macro_edit_style);

View File

@ -92,12 +92,12 @@
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="macLikeWordMovementCB">
<widget class="QCheckBox" name="macLikeCursorMovementCB">
<property name="toolTip">
<string>Skip trailing non-word characters</string>
</property>
<property name="text">
<string>Use Mac-style for cursor moving between &amp;words</string>
<string>Use M&amp;ac-style cursor movement</string>
</property>
</widget>
</item>
@ -273,7 +273,7 @@
<tabstop>cursorFollowsCB</tabstop>
<tabstop>cursorWidthSB</tabstop>
<tabstop>scrollBelowCB</tabstop>
<tabstop>macLikeWordMovementCB</tabstop>
<tabstop>macLikeCursorMovementCB</tabstop>
<tabstop>sortEnvironmentsCB</tabstop>
<tabstop>groupEnvironmentsCB</tabstop>
<tabstop>macroEditStyleCO</tabstop>