[PATCH] Fix Cyrillic keyboard map files

Yuriy Skalko yuriy.skalko at gmail.com
Thu Sep 17 12:35:55 UTC 2020


> Since the map file names changed, I wonder whether this doesn't need a
> pref format update and prefs2prefs handling.
> 
> For instance, should people's preferences, if they have have koi8-
> r.kmap selected in preferences be updated to point to russian.kmap?
> 
> Jürgen

Here is the patch.

Yuriy
-------------- next part --------------
From 4601210754a7774f03f183e3ee22f90e2a1e3d25 Mon Sep 17 00:00:00 2001
From: Yuriy Skalko <yuriy.skalko at gmail.com>
Date: Thu, 17 Sep 2020 15:32:43 +0300
Subject: [PATCH] Increment preferences format to 34: rename Cyrillic *.kmap
 files

---
 lib/configure.py                 |  2 +-
 lib/scripts/prefs2prefs_prefs.py | 15 ++++++++++++++-
 src/LyXRC.cpp                    |  2 +-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/configure.py b/lib/configure.py
index 1547000b37..9f3c0325ee 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -1876,7 +1876,7 @@ if __name__ == '__main__':
     lyx_check_config = True
     lyx_kpsewhich = True
     outfile = 'lyxrc.defaults'
-    lyxrc_fileformat = 33
+    lyxrc_fileformat = 34
     rc_entries = ''
     lyx_keep_temps = False
     version_suffix = ''
diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py
index 322990add5..35f92d5cb4 100644
--- a/lib/scripts/prefs2prefs_prefs.py
+++ b/lib/scripts/prefs2prefs_prefs.py
@@ -134,6 +134,8 @@
 #   and \citation_search_view.
 #   No conversion necessary.
 
+# Incremented to format 34, by yuriy
+#   Rename *.kmap files for Cyrillic languages
 
 # NOTE: The format should also be updated in LYXRC.cpp and
 # in configure.py.
@@ -439,6 +441,16 @@ def remove_use_pixmap_cache(line):
 		return no_match
 	return (True, "")
 
+def rename_cyrillic_kmap_files(line):
+	line = line.lower()
+	if not (line.startswith("\\kbmap_primary ")
+			or line.startswith("\\kbmap_secondary ")):
+		return no_match
+	line = line.replace("bg-bds-1251", "bulgarian")
+	line = line.replace("koi8-r", "russian")
+	line = line.replace("koi8-u", "ukrainian")
+	return (True, line)
+
 # End conversions for LyX 2.3 to 2.4
 ####################################
 
@@ -486,5 +498,6 @@ conversions = [
 	[ 30, []],
 	[ 31, []],
 	[ 32, []],
-	[ 33, []]
+	[ 33, []],
+	[ 34, [rename_cyrillic_kmap_files]]
 ]
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 323881d564..59bdc70a58 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -65,7 +65,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 = 33; // sanda: add \citation_search_view
+static unsigned int const LYXRC_FILEFORMAT = 34; // yuriy: rename kmap files
 // when adding something to this array keep it sorted!
 LexerKeyword lyxrcTags[] = {
 	{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
-- 
2.28.0.windows.1



More information about the lyx-devel mailing list