Make continuous spellcheck the default.

Convert old preferences to preserve previous setting, as well.
This commit is contained in:
Richard Kimberly Heck 2021-02-15 11:02:58 -05:00
parent 93e7ab1f3e
commit 01dc665a25
5 changed files with 45 additions and 12 deletions

View File

@ -1944,7 +1944,7 @@ if __name__ == '__main__':
lyx_check_config = True
lyx_kpsewhich = True
outfile = 'lyxrc.defaults'
lyxrc_fileformat = 34
lyxrc_fileformat = 36
rc_entries = ''
lyx_keep_temps = False
version_suffix = ''

View File

@ -163,6 +163,11 @@ def main(argv):
abort("Something is wrong with the conversion chain.")
for c in convert:
try:
# first see if the routine will accept a list of lines
c(lines)
except:
# if not, it wants individual lines
for i in range(len(lines)):
(update, newline) = c(lines[i])
if update:

View File

@ -10,10 +10,26 @@
# This file houses conversion information for the preferences file.
# The converter functions take a line as argument and return a list:
# There are two kinds of converter functions.
#
# Most of them take a line as argument and return a list:
# (Bool, NewLine),
# where the Bool says if we've modified anything and the NewLine is
# the new line, if so, which will be used to replace the old line.
# This can be used to erase lines (return (True, "")) or to modify
# existing preference lines.
#
# It is also possible for conversion routines to accept the whole
# list of lines and process that. This is useful (as in the change
# to format 35) when you need to add a preference if it's not already
# there.
######################################################################
#
# FORMAT CHANGES
#
######################################################################
# Incremented to format 2, r39670 by jrioux
# Support for multiple file extensions per format.
@ -141,8 +157,13 @@
# \set_color now takes three arguments
# \set_color lyxname x11hexname x11darkhexname
# Incremented to format 36, by rkh
# Set spellcheck_continuously to FALSE if it is not otherwise set
# (the new default is true, so this keeps behavior the same for
# existing users)
# NOTE: The format should also be updated in LYXRC.cpp and
# in configure.py.
# in configure.py (search for lyxrc_fileformat).
import re
@ -465,6 +486,12 @@ def add_dark_color(line):
line += " " + m.group(2)
return (True, line)
def add_spellcheck_default(lines):
for l in lines:
if l.startswith("\\spellcheck_continuously"):
return
lines.append("\\spellcheck_continuously false")
# End conversions for LyX 2.3 to 2.4
####################################
@ -514,5 +541,6 @@ conversions = [
[ 32, []],
[ 33, []],
[ 34, [rename_cyrillic_kmap_files]],
[ 35, [add_dark_color]]
[ 35, [add_dark_color]],
[ 36, [add_spellcheck_default]]
]

View File

@ -60,7 +60,7 @@ namespace {
// The format should also be updated in configure.py, and conversion code
// should be added to prefs2prefs_prefs.py.
static unsigned int const LYXRC_FILEFORMAT = 35; // spitz: dark mode colors
static unsigned int const LYXRC_FILEFORMAT = 36; // rkh: spellcheck_continuously default
// when adding something to this array keep it sorted!
LexerKeyword lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },

View File

@ -370,7 +370,7 @@ public:
/// Accept compound words in spellchecker?
bool spellchecker_accept_compound = false;
/// spellcheck continuously?
bool spellcheck_continuously = false;
bool spellcheck_continuously = true;
/// spellcheck notes and comments?
bool spellcheck_notes = true;
///