- change: enable copy as HTML by default

- fix: unneeded empty lines when copy as HTML
This commit is contained in:
royqh1979@gmail.com 2021-10-10 22:19:48 +08:00
parent b3fb9e223b
commit 3a81281f7d
6 changed files with 19 additions and 6 deletions

View File

@ -2,6 +2,8 @@ Version 0.6.4
- fix: code completion popup not show after '->' inputted - fix: code completion popup not show after '->' inputted
- fix: font styles in the color scheme settings not in effect - fix: font styles in the color scheme settings not in effect
- fix: editor's font style shouldn't affect gutter's font style - fix: editor's font style shouldn't affect gutter's font style
- change: enable copy as HTML by default
- fix: unneeded empty lines when copy as HTML
Version 0.6.3 Version 0.6.3
- fix: should use c++ syntax to check ".h" files - fix: should use c++ syntax to check ".h" files

View File

@ -99,7 +99,8 @@ void SynExporter::ExportRange(PSynEditStringList ALines, BufferCoord Start, Buff
FormatToken(Token); FormatToken(Token);
mHighlighter->next(); mHighlighter->next();
} }
FormatNewLine(); if (i!=Stop.Line)
FormatNewLine();
} }
if (!mFirstAttribute) if (!mFirstAttribute)
FormatAfterLastAttribute(); FormatAfterLastAttribute();

View File

@ -126,7 +126,7 @@ void SynHTMLExporter::FormatNewLine()
QString SynHTMLExporter::GetFooter() QString SynHTMLExporter::GetFooter()
{ {
QString Result = ""; QString Result = "";
Result = "</span>" + lineBreak() + "</code></pre>" + lineBreak(); Result = "</span></code></pre>" + lineBreak();
if (mCreateHTMLFragment) if (mCreateHTMLFragment)
Result += "<!--EndFragment-->"; Result += "<!--EndFragment-->";
Result += "</body>"+lineBreak()+ "</html>"; Result += "</body>"+lineBreak()+ "</html>";
@ -172,7 +172,7 @@ QString SynHTMLExporter::GetHeader()
if (mCreateHTMLFragment) { if (mCreateHTMLFragment) {
Result += "<!--StartFragment-->"; Result += "<!--StartFragment-->";
} }
Result += QString("<pre>"+lineBreak()+"<code><span style=\"font: %1pt %2;\">") Result += QString("<pre><code><span style=\"font: %1pt %2;\">")
.arg(mFont.pointSize()) .arg(mFont.pointSize())
.arg(mFont.family()); .arg(mFont.family());

View File

@ -1108,12 +1108,12 @@ void Settings::Editor::doLoad()
mCopySizeLimit = boolValue("copy_limit",true); mCopySizeLimit = boolValue("copy_limit",true);
mCopyCharLimits = intValue("copy_char_limits",100); mCopyCharLimits = intValue("copy_char_limits",100);
mCopyLineLimits = intValue("copy_line_limits",100000); mCopyLineLimits = intValue("copy_line_limits",100000);
mCopyWithFormatAs = intValue("copy_with_format_as",0); mCopyWithFormatAs = intValue("copy_with_format_as",1);
mCopyRTFUseBackground = boolValue("copy_rtf_use_background",false); mCopyRTFUseBackground = boolValue("copy_rtf_use_background",false);
mCopyRTFUseEditorColor = boolValue("copy_rtf_use_editor_color_scheme",true); mCopyRTFUseEditorColor = boolValue("copy_rtf_use_editor_color_scheme",false);
mCopyRTFColorScheme = stringValue("copy_rtf_color_scheme","Intellij Classic"); mCopyRTFColorScheme = stringValue("copy_rtf_color_scheme","Intellij Classic");
mCopyHTMLUseBackground = boolValue("copy_html_use_background",false); mCopyHTMLUseBackground = boolValue("copy_html_use_background",false);
mCopyHTMLUseEditorColor = boolValue("copy_html_use_editor_color_scheme",true); mCopyHTMLUseEditorColor = boolValue("copy_html_use_editor_color_scheme",false);
mCopyHTMLColorScheme = stringValue("copy_html_color_scheme","Intellij Classic"); mCopyHTMLColorScheme = stringValue("copy_html_color_scheme","Intellij Classic");
//color //color

View File

@ -820,3 +820,12 @@ void executeFile(const QString &fileName, const QString &params, const QString &
SW_SHOW SW_SHOW
); );
} }
void StringToFile(const QString &str, const QString &fileName)
{
QFile file(fileName);
if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
QTextStream stream(&file);
stream<<str;
}
}

View File

@ -155,6 +155,7 @@ QStringList ReadFileToLines(const QString& fileName, QTextCodec* codec);
QStringList ReadFileToLines(const QString& fileName); QStringList ReadFileToLines(const QString& fileName);
void ReadFileToLines(const QString& fileName, QTextCodec* codec, LineProcessFunc lineFunc); void ReadFileToLines(const QString& fileName, QTextCodec* codec, LineProcessFunc lineFunc);
void StringsToFile(const QStringList& list, const QString& fileName); void StringsToFile(const QStringList& list, const QString& fileName);
void StringToFile(const QString& str, const QString& fileName);
void decodeKey(int combinedKey, int& key, Qt::KeyboardModifiers& modifiers); void decodeKey(int combinedKey, int& key, Qt::KeyboardModifiers& modifiers);
void inflateRect(QRect& rect, int delta); void inflateRect(QRect& rect, int delta);