Add config variable to process backslashes as letters

This commit is contained in:
Jean-Francois Dockes 2019-01-29 18:32:19 +01:00
parent 0aa6e3ca75
commit bdc8d3eb38
3 changed files with 18 additions and 2 deletions

View File

@ -394,6 +394,7 @@ bool RclConfig::updateMainConfig()
setKeyDir(cstr_null); setKeyDir(cstr_null);
// Texsplit customization
bool bvalue = false; bool bvalue = false;
if (getConfParam("nocjk", &bvalue) && bvalue == true) { if (getConfParam("nocjk", &bvalue) && bvalue == true) {
TextSplit::cjkProcessing(false); TextSplit::cjkProcessing(false);
@ -405,16 +406,18 @@ bool RclConfig::updateMainConfig()
TextSplit::cjkProcessing(true); TextSplit::cjkProcessing(true);
} }
} }
bvalue = false; bvalue = false;
if (getConfParam("nonumbers", &bvalue) && bvalue == true) { if (getConfParam("nonumbers", &bvalue) && bvalue == true) {
TextSplit::noNumbers(); TextSplit::noNumbers();
} }
bvalue = false; bvalue = false;
if (getConfParam("dehyphenate", &bvalue)) { if (getConfParam("dehyphenate", &bvalue)) {
TextSplit::deHyphenate(bvalue); TextSplit::deHyphenate(bvalue);
} }
bvalue = false;
if (getConfParam("backslashasletter", &bvalue)) {
TextSplit::backslashAsLetter(bvalue);
}
bvalue = true; bvalue = true;
if (getConfParam("skippedPathsFnmPathname", &bvalue) && bvalue == false) { if (getConfParam("skippedPathsFnmPathname", &bvalue) && bvalue == false) {

View File

@ -137,6 +137,14 @@ public:
}; };
static const CharClassInit charClassInitInstance; static const CharClassInit charClassInitInstance;
void TextSplit::backslashAsLetter(bool on) {
if (on) {
charclasses[int('\\')] = A_LLETTER;
} else {
charclasses[int('\\')] = SPACE;
}
}
static inline int whatcc(unsigned int c) static inline int whatcc(unsigned int c)
{ {
if (c <= 127) { if (c <= 127) {

View File

@ -59,6 +59,11 @@ public:
o_deHyphenate = on; o_deHyphenate = on;
} }
// Process backslashes as letters? Default is off, but it may be
// useful for searching for tex commands. Config variable:
// backslashasletter
static void backslashAsLetter(bool on);
enum Flags { enum Flags {
// Default: will return spans and words (a_b, a, b) // Default: will return spans and words (a_b, a, b)
TXTS_NONE = 0, TXTS_NONE = 0,