add capability to remember page breaks generated by, e.g. pdftotext, and use them to start an external viewer on a match page
This commit is contained in:
@@ -86,7 +86,7 @@ public:
|
||||
for (i = 0; i < strlen(wild); i++)
|
||||
charclasses[int(wild[i])] = WILD;
|
||||
|
||||
char special[] = ".@+-,#'_\n\r";
|
||||
char special[] = ".@+-,#'_\n\r\f";
|
||||
for (i = 0; i < strlen(special); i++)
|
||||
charclasses[int(special[i])] = special[i];
|
||||
|
||||
@@ -316,6 +316,7 @@ bool TextSplit::text_to_words(const string &in)
|
||||
m_inNumber = false;
|
||||
m_wordStart = m_wordLen = m_prevpos = m_prevlen = m_wordpos = m_spanpos = 0;
|
||||
int curspanglue = 0;
|
||||
bool pagepending = false;
|
||||
|
||||
// Running count of non-alphanum chars. Reset when we see one;
|
||||
int nonalnumcnt = 0;
|
||||
@@ -369,6 +370,10 @@ bool TextSplit::text_to_words(const string &in)
|
||||
return false;
|
||||
m_inNumber = false;
|
||||
}
|
||||
if (pagepending) {
|
||||
pagepending = false;
|
||||
newpage(m_wordpos);
|
||||
}
|
||||
break;
|
||||
|
||||
case WILD:
|
||||
@@ -521,7 +526,10 @@ bool TextSplit::text_to_words(const string &in)
|
||||
goto SPACE;
|
||||
}
|
||||
break;
|
||||
|
||||
case '\f':
|
||||
pagepending = true;
|
||||
goto SPACE;
|
||||
break;
|
||||
#ifdef RCL_SPLIT_CAMELCASE
|
||||
// Camelcase handling.
|
||||
// If we get uppercase ascii after lowercase ascii, emit word.
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
using std::string;
|
||||
using std::vector;
|
||||
#endif
|
||||
|
||||
class Utf8Iter;
|
||||
|
||||
@@ -78,6 +76,12 @@ public:
|
||||
int bte // byte offset of first char after term
|
||||
) = 0;
|
||||
|
||||
/** Called when we encounter formfeed \f 0x0c. Override to use the event.
|
||||
* Mostly or exclusively used with pdftoxx output. Other filters mostly
|
||||
* just don't know about pages. */
|
||||
virtual void newpage(int /*pos*/)
|
||||
{
|
||||
}
|
||||
|
||||
// Static utility functions:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user