mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
bug-fix: move cursor to the end after creating new note
focusWidget() is NULL in Linux.
This commit is contained in:
parent
7fd2273aad
commit
84d1648fe4
@ -11,6 +11,7 @@
|
|||||||
#include "vfile.h"
|
#include "vfile.h"
|
||||||
#include "vconfigmanager.h"
|
#include "vconfigmanager.h"
|
||||||
#include "vmdedit.h"
|
#include "vmdedit.h"
|
||||||
|
#include "vmdtab.h"
|
||||||
|
|
||||||
extern VConfigManager *g_config;
|
extern VConfigManager *g_config;
|
||||||
extern VNote *g_vnote;
|
extern VNote *g_vnote;
|
||||||
@ -318,12 +319,14 @@ void VFileList::newFile()
|
|||||||
|
|
||||||
// Move cursor down if content has been inserted.
|
// Move cursor down if content has been inserted.
|
||||||
if (contentInserted) {
|
if (contentInserted) {
|
||||||
QWidget *wid = QApplication::focusWidget();
|
const VMdTab *tab = dynamic_cast<VMdTab *>(editArea->currentEditTab());
|
||||||
VMdEdit *edit = dynamic_cast<VMdEdit *>(wid);
|
if (tab) {
|
||||||
if (edit && edit->getFile() == file) {
|
VMdEdit *edit = dynamic_cast<VMdEdit *>(tab->getEditor());
|
||||||
QTextCursor cursor = edit->textCursor();
|
if (edit && edit->getFile() == file) {
|
||||||
cursor.movePosition(QTextCursor::End);
|
QTextCursor cursor = edit->textCursor();
|
||||||
edit->setTextCursor(cursor);
|
cursor.movePosition(QTextCursor::End);
|
||||||
|
edit->setTextCursor(cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ public:
|
|||||||
|
|
||||||
VWebView *getWebViewer() const;
|
VWebView *getWebViewer() const;
|
||||||
|
|
||||||
|
VEdit *getEditor() const;
|
||||||
|
|
||||||
MarkdownConverterType getMarkdownConverterType() const;
|
MarkdownConverterType getMarkdownConverterType() const;
|
||||||
|
|
||||||
void requestUpdateVimStatus() Q_DECL_OVERRIDE;
|
void requestUpdateVimStatus() Q_DECL_OVERRIDE;
|
||||||
@ -150,4 +152,9 @@ inline VEdit *VMdTab::getEditor()
|
|||||||
return m_editor;
|
return m_editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline VEdit *VMdTab::getEditor() const
|
||||||
|
{
|
||||||
|
return m_editor;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // VMDTAB_H
|
#endif // VMDTAB_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user