Skip to content

Commit

Permalink
Fix window codeTemplate postion incorrect bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jie-meng committed Apr 17, 2018
1 parent b10aa07 commit 513218a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gui/aboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void AboutDialog::init()

void AboutDialog::initGui()
{
plabel_version_ = new QLabel(tr("Version: 1.10.1"));
plabel_version_ = new QLabel(tr("Version: 1.10.2"));
plabel_email_ = new QLabel(tr("Email: [email protected]"));
plabel_github_ = createLinkLabel("Lunar on Github", "https://github.com/jie-meng/Lunar");
plabel_wiki_ = createLinkLabel("Lunar Wiki", "https://github.com/jie-meng/Lunar/wiki");
Expand Down
8 changes: 7 additions & 1 deletion src/gui/docview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,14 @@ 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;
}

ptext_edit_->replaceSelectedText(StdStringToQString(template_content));
ptext_edit_->setSelection(0, start_pos + begin, 0, start_pos + end);
ptext_edit_->setSelection(0, start_pos - offset + begin, 0, start_pos - offset + end);
}
}
}
Expand Down

0 comments on commit 513218a

Please sign in to comment.