Well the first "issue" can be found in CodeViewEditor.cpp here if anyone wants to play with that, they could simply check for a |<tag> here and allow that even if "considered in tag".
Code:
QString CodeViewEditor::SplitSection()
{
QString text = toPlainText();
int split_position = textCursor().position();
// Abort splitting the section if user is within a tag - MainWindow will display a status message
if (IsPositionInTag(split_position, text)) {
return QString();
}
I do not see that error message "Cannot split since it may not be an HTML file" anywhere in CodeViewEditor though. But in MainWindow.cpp that error message comes here:
Code:
void MainWindow::CreateSectionBreakOldTab(QString content, HTMLResource *originating_resource)
{
if (content.isEmpty()) {
QMessageBox::warning(this, tr("Sigil"), tr("File cannot be split at this position."));
return;
}
// XXX: This should be using the mime type not the extension.
if (!TEXT_EXTENSIONS.contains(QFileInfo(originating_resource->Filename()).suffix().toLower())) {
QMessageBox::warning(this, tr("Sigil"), tr("Cannot split since it may not be an HTML file."));
return;
}
But by this point the "damage" has been done and the original file is now doomed.
It seems SplitAtCursor is handled inside CodeView where it takes the bottom half of the file and uses the current file name for it and then the piece above under a new name. All of this was designed before SplitAtSplitMarkers was done.
Hmm....