From 768f08eda50d45c3c87457228a6dbf5ebc3fe1c2 Mon Sep 17 00:00:00 2001 From: "Flora (opencode)" Date: Mon, 17 Aug 2026 16:24:28 +0300 Subject: [PATCH] =?UTF-8?q?Fix:=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=D0=B0=20b?= =?UTF-8?q?inding=20text:=20pane.editorContent=20=D0=B8=D0=B7=20TextArea?= =?UTF-8?q?=20=E2=80=94=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20=D1=8F?= =?UTF-8?q?=D0=B2=D0=BD=D0=BE=D0=B5=20=D0=BF=D1=80=D0=B8=D1=81=D0=B2=D0=BE?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20loa?= =?UTF-8?q?dContent()=20(onDocIndexChanged=20+=20Timer=2050ms=20+=20Connec?= =?UTF-8?q?tions.activeIndexChanged).=20=D0=9A=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B4=D0=B0=D1=80=D1=8C:=20cal.currentMonth=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BA=20=D1=8F=D0=B2=D0=BD=D0=B0=D1=8F=20=D0=B7=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D1=8C=20=D0=B2=20has?= =?UTF-8?q?Note.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/panels/EditorPane.qml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/qml/panels/EditorPane.qml b/qml/panels/EditorPane.qml index fb9a105..fa8008b 100644 --- a/qml/panels/EditorPane.qml +++ b/qml/panels/EditorPane.qml @@ -224,7 +224,6 @@ Item { id: editor anchors.fill: parent visible: pane.editMode - text: pane.editorContent onTextEdited: documentManager.updateContent(pane.docIndex, text) selectByMouse: true font.family: "Menlo, Consolas, 'DejaVu Sans Mono', monospace" @@ -251,6 +250,17 @@ Item { } // ---------- Просмотр (режим просмотра) ---------- + function loadContent() { + if (pane.docIndex >= 0) { + const c = documentManager.contentAt(pane.docIndex) + editor.text = c + pane.editorContent = c + console.log("loadContent docIndex=" + pane.docIndex + " len=" + c.length) + } else { + editor.text = "" + pane.editorContent = "" + } + } function pathDir(p) { const idx = p.lastIndexOf("/") return idx >= 0 ? p.substring(0, idx) : p @@ -304,9 +314,12 @@ Item { // Просмотр обновляется при изменении контента Connections { target: documentManager + function onActiveIndexChanged() { + pane.loadContent() + } function onContentChanged(i) { if (i === pane.docIndex) { - pane.editorContent = documentManager.contentAt(i) + pane.loadContent() if (!pane.editMode) pane.renderView() } @@ -316,22 +329,14 @@ Item { onDocIndexChanged: { pane.refreshHeader() pane.renderView() + pane.loadContent() loadTimer.start() } - // Таймер для надёжной загрузки контента (обходит тайминг layout/QML) Timer { id: loadTimer - interval: 30 - onTriggered: { - if (pane.docIndex >= 0) { - pane.editorContent = documentManager.contentAt(pane.docIndex) - if (pane.editMode) - editor.forceActiveFocus() - } else { - pane.editorContent = "" - } - } + interval: 50 + onTriggered: pane.loadContent() } onEditModeChanged: { if (!pane.editMode)