mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 14:29:54 +08:00
bug-fix
- Set proper defalut focus of VInsertLinkDialog; - Fix bug in snippet when selection mark is empty; - Focus editor after double-click applying a snippet;
This commit is contained in:
parent
4ffd6a5ef4
commit
8ab8b3d83a
@ -130,3 +130,12 @@ QString VInsertLinkDialog::getLinkUrl() const
|
|||||||
{
|
{
|
||||||
return m_linkUrlEdit->text();
|
return m_linkUrlEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VInsertLinkDialog::showEvent(QShowEvent *p_event)
|
||||||
|
{
|
||||||
|
QDialog::showEvent(p_event);
|
||||||
|
|
||||||
|
if (!m_linkTextEdit->text().isEmpty() && m_linkUrlEdit->text().isEmpty()) {
|
||||||
|
m_linkUrlEdit->setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
class VLineEdit;
|
class VLineEdit;
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
|
class QShowEvent;
|
||||||
|
|
||||||
class VInsertLinkDialog : public QDialog
|
class VInsertLinkDialog : public QDialog
|
||||||
{
|
{
|
||||||
@ -23,6 +24,9 @@ public:
|
|||||||
|
|
||||||
QString getLinkUrl() const;
|
QString getLinkUrl() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent *p_event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleInputChanged();
|
void handleInputChanged();
|
||||||
|
|
||||||
|
@ -782,6 +782,8 @@ void VMdTab::applySnippet(const VSnippet *p_snippet)
|
|||||||
m_editor->setVimMode(VimMode::Insert);
|
m_editor->setVimMode(VimMode::Insert);
|
||||||
|
|
||||||
g_mainWin->showStatusMessage(tr("Snippet applied"));
|
g_mainWin->showStatusMessage(tr("Snippet applied"));
|
||||||
|
|
||||||
|
focusTab();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_mainWin->showStatusMessage(tr("Snippet %1 is not applicable").arg(p_snippet->getName()));
|
g_mainWin->showStatusMessage(tr("Snippet %1 is not applicable").arg(p_snippet->getName()));
|
||||||
|
@ -189,9 +189,10 @@ bool VSnippet::apply(QTextCursor &p_cursor) const
|
|||||||
|
|
||||||
if (!m_selectionMark.isEmpty() && !secondPart.isEmpty()) {
|
if (!m_selectionMark.isEmpty() && !secondPart.isEmpty()) {
|
||||||
secondPart.replace(m_selectionMark, selection);
|
secondPart.replace(m_selectionMark, selection);
|
||||||
content += secondPart;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content += secondPart;
|
||||||
|
|
||||||
// Insert it.
|
// Insert it.
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case Type::Html:
|
case Type::Html:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user