diff --git a/src/gui/aboutdialog.cpp b/src/gui/aboutdialog.cpp index 34d85ee..417d15d 100644 --- a/src/gui/aboutdialog.cpp +++ b/src/gui/aboutdialog.cpp @@ -28,7 +28,7 @@ void AboutDialog::init() void AboutDialog::initGui() { - plabel_version_ = new QLabel(tr("Version: 1.10.2")); + plabel_version_ = new QLabel(tr("Version: 1.10.3")); plabel_email_ = new QLabel(tr("Email: jmengxy@gmail.com")); plabel_github_ = createLinkLabel("Lunar on Github", "https://github.com/jie-meng/Lunar"); plabel_wiki_ = createLinkLabel("Lunar Wiki", "https://github.com/jie-meng/Lunar/wiki"); diff --git a/src/gui/docview.cpp b/src/gui/docview.cpp index 0348e38..3d6239c 100644 --- a/src/gui/docview.cpp +++ b/src/gui/docview.cpp @@ -955,11 +955,8 @@ void DocView::codeTemplate() int end = 0; if (Extension::getInstance().templateFileInfo(it->second, index - (end_pos - start_pos), template_content, begin, end)) { - int offset = 0; - if (platformInfo() == kPlatformWindows) { - //On windows start_pos is not same as Unix, might caused by end of line '\r\n' not '\n'. - offset = line; - } + //On windows start_pos is not same as Unix, might caused by end of line '\r\n' not '\n'. + int offset = platformInfo() == kPlatformWindows ? line : 0; ptext_edit_->replaceSelectedText(StdStringToQString(template_content)); ptext_edit_->setSelection(0, start_pos - offset + begin, 0, start_pos - offset + end); diff --git a/src/lunarcommon.cpp b/src/lunarcommon.cpp index c39665b..c1192dc 100644 --- a/src/lunarcommon.cpp +++ b/src/lunarcommon.cpp @@ -49,8 +49,12 @@ QString qtReadFile(const QString& filename, const char* codec) QTextStream in(&f); in.setCodec(codec); QString str; + + //On windows start_pos is not same as Unix, might caused by end of line '\r\n' not '\n'. + QString lineSep = platformInfo() == kPlatformWindows ? "\r\n" : "\n"; + while(!in.atEnd()) - str.append(in.readLine() + "\n"); + str.append(in.readLine() + lineSep); return str; } @@ -276,7 +280,7 @@ void LunarGlobal::readCfg(bool read_all) extension_func_is_legal_file_ = text_cfg.getValue("Extension.Func.IsLegalFile", "isLegalFile"); extension_func_find_files_ = text_cfg.getValue("Extension.Func.FindFiles", "findFiles"); - if (read_all) + if (read_all) { //These files can be changed in App string font_type = text_cfg.getValue("Font.Type", string("Monaco"));