forked from qt-creator/qt-creator
Lua: Expose first and last visible block number
Change-Id: I69b6437dad21269e7623db528a5881d036e3dc87 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -466,6 +466,20 @@ void setupTextEditorModule()
|
|||||||
textEditor && textEditor->editorWidget(),
|
textEditor && textEditor->editorWidget(),
|
||||||
throw sol::error("TextEditor is not valid"));
|
throw sol::error("TextEditor is not valid"));
|
||||||
return textEditor->editorWidget()->hasFocus();
|
return textEditor->editorWidget()->hasFocus();
|
||||||
|
},
|
||||||
|
"firstVisibleBlockNumber",
|
||||||
|
[](const TextEditorPtr &textEditor) -> int {
|
||||||
|
QTC_ASSERT(
|
||||||
|
textEditor && textEditor->editorWidget(),
|
||||||
|
throw sol::error("TextEditor is not valid"));
|
||||||
|
return textEditor->editorWidget()->firstVisibleBlockNumber();
|
||||||
|
},
|
||||||
|
"lastVisibleBlockNumber",
|
||||||
|
[](const TextEditorPtr &textEditor) -> int {
|
||||||
|
QTC_ASSERT(
|
||||||
|
textEditor && textEditor->editorWidget(),
|
||||||
|
throw sol::error("TextEditor is not valid"));
|
||||||
|
return textEditor->editorWidget()->lastVisibleBlockNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
result["Side"] = lua.create_table_with(
|
result["Side"] = lua.create_table_with(
|
||||||
|
@@ -237,6 +237,14 @@ function TextEditor:insertText(text) end
|
|||||||
---@return boolean hasFocus True if the editor widget has focus, false otherwise.
|
---@return boolean hasFocus True if the editor widget has focus, false otherwise.
|
||||||
function TextEditor:hasFocus() end
|
function TextEditor:hasFocus() end
|
||||||
|
|
||||||
|
---Returns the block number of the first visible line in the text editor.
|
||||||
|
---@return integer blockNumber The block number of the first visible line.
|
||||||
|
function TextEditor:firstVisibleBlockNumber() end
|
||||||
|
|
||||||
|
---Returns the block number of the last visible line in the text editor.
|
||||||
|
---@return integer blockNumber The block number of the last visible line.
|
||||||
|
function TextEditor:lastVisibleBlockNumber() end
|
||||||
|
|
||||||
---Returns the current editor or nil.
|
---Returns the current editor or nil.
|
||||||
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
||||||
function textEditor.currentEditor() end
|
function textEditor.currentEditor() end
|
||||||
|
Reference in New Issue
Block a user