detect and preserve utf-8 in status line. Make sure special indexing choice of retrying failed files has effect. Try harder to recover indexing fail reason.

This commit is contained in:
Jean-Francois Dockes 2019-03-12 16:09:14 +01:00
parent 00cb2ad827
commit 113b7db12e

View File

@ -72,8 +72,11 @@ void RclMain::updateIdxStatus()
} }
string mf;int ecnt = 0; string mf;int ecnt = 0;
string fcharset = theconfig->getDefCharset(true); string fcharset = theconfig->getDefCharset(true);
if (!transcode(status.fn, mf, fcharset, "UTF-8", &ecnt) || ecnt) { // If already UTF-8 let it be, else try to transcode, or url-encode
mf = url_encode(status.fn, 0); if (!transcode(status.fn, mf, "UTF-8", "UTF-8", &ecnt) || ecnt) {
if (!transcode(status.fn, mf, fcharset, "UTF-8", &ecnt) || ecnt) {
mf = url_encode(status.fn, 0);
}
} }
msg += QString::fromUtf8(mf.c_str()); msg += QString::fromUtf8(mf.c_str());
statusBar()->showMessage(msg, 4000); statusBar()->showMessage(msg, 4000);
@ -331,6 +334,12 @@ static void delay(int millisecondsWait)
void RclMain::rebuildIndex() void RclMain::rebuildIndex()
{ {
if (!m_idxreasontmp || !m_idxreasontmp->ok()) {
// We just store the pointer and let the tempfile cleaner deal
// with delete on exiting
TempFile temp(".txt");
m_idxreasontmp = rememberTempFile(temp);
}
if (m_indexerState == IXST_UNKNOWN) { if (m_indexerState == IXST_UNKNOWN) {
delay(1500); delay(1500);
} }
@ -448,6 +457,12 @@ static string execToString(const string& cmd, const vector<string>& args)
void RclMain::specialIndex() void RclMain::specialIndex()
{ {
LOGDEB("RclMain::specialIndex\n" ); LOGDEB("RclMain::specialIndex\n" );
if (!m_idxreasontmp || !m_idxreasontmp->ok()) {
// We just store the pointer and let the tempfile cleaner deal
// with delete on exiting
TempFile temp(".txt");
m_idxreasontmp = rememberTempFile(temp);
}
switch (m_indexerState) { switch (m_indexerState) {
case IXST_UNKNOWN: case IXST_UNKNOWN:
case IXST_RUNNINGMINE: case IXST_RUNNINGMINE:
@ -483,15 +498,10 @@ void RclMain::specialIndex()
} }
} }
// The default for retrying differ depending if -r is set if (!specidx->noRetryFailed()) {
if (top.empty()) { args.push_back("-k");
if (!specidx->noRetryFailed()) {
args.push_back("-k");
}
} else { } else {
if (specidx->noRetryFailed()) { args.push_back("-K");
args.push_back("-K");
}
} }
vector<string> selpats = specidx->selpatterns(); vector<string> selpats = specidx->selpatterns();