UX: handles 12px хит-зона по всей высоте, календарь шире, Enter починен
- SplitView handle: implicit 12 (было 1/6), Rectangle fill parent + hit 16, cursor SplitH/VCursor, для файлового дерева/живого просмотра/графа-календаря — теперь легко попасть по всей высоте - MonthCalendar: header 28x28 radius 14, month Label fill 70-110 + year 42/38, font 11, elide, spacing 4 — 'сентябрь 2026' не налезает, кнопки 28 круглые opaque (surface/hover/selected) - RightPanel: удалён дубль 'Сегодня' ☷ из calBox header (оставлен только ⌂ в MonthCalendar) - EditorPanel: Enter через Keys.onReturnPressed/onEnterPressed handleEnter() (сохранение indent), убран дубль в onPressed — теперь новая строка работает
This commit is contained in:
+29
-34
@@ -242,9 +242,8 @@ Item {
|
||||
anchors.bottom: toolbar.top
|
||||
orientation: Qt.Horizontal
|
||||
handle: Rectangle {
|
||||
implicitWidth: viewMode === "live" ? 6 : 0
|
||||
implicitHeight: viewMode === "live" ? 6 : 0
|
||||
color: Theme.divider
|
||||
implicitWidth: viewMode === "live" ? 12 : 0
|
||||
color: "transparent"
|
||||
visible: viewMode === "live"
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
@@ -253,8 +252,7 @@ Item {
|
||||
visible: parent.visible
|
||||
}
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: 16; height: parent.height
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
visible: parent.visible
|
||||
MouseArea {
|
||||
@@ -351,8 +349,33 @@ Item {
|
||||
if (viewMode === "live") liveDebounce.restart()
|
||||
}
|
||||
function insertText(t) { insert(cursorPosition, t) }
|
||||
function handleEnter() {
|
||||
const pos = cursorPosition
|
||||
let lineStart = text.lastIndexOf("\n", pos-1) + 1
|
||||
let line = text.substring(lineStart, pos)
|
||||
let indent = ""
|
||||
const m = line.match(/^(\s+)/)
|
||||
if (m) indent = m[1]
|
||||
const trimmed = line.trimEnd()
|
||||
if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) {
|
||||
indent += " "
|
||||
}
|
||||
let extra = ""
|
||||
if (pos < text.length) {
|
||||
const next = text[pos]
|
||||
if (next === "}" || next === "]" || next === ")") {
|
||||
extra = "\n" + indent.substring(0, Math.max(0, indent.length-4))
|
||||
}
|
||||
}
|
||||
const ins = "\n" + indent + extra
|
||||
insert(pos, ins)
|
||||
cursorPosition = pos + 1 + indent.length
|
||||
if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text)
|
||||
}
|
||||
|
||||
// Авто-отступ и скобки
|
||||
Keys.onReturnPressed: handleEnter()
|
||||
Keys.onEnterPressed: handleEnter()
|
||||
Keys.onPressed: (event) => {
|
||||
// Tab — 4 пробела, Shift+Tab — снять отступ
|
||||
if (event.key === Qt.Key_Tab) {
|
||||
@@ -408,35 +431,7 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Enter — сохранить отступ
|
||||
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
event.accepted = true
|
||||
const pos = cursorPosition
|
||||
let lineStart = text.lastIndexOf("\n", pos-1) + 1
|
||||
let line = text.substring(lineStart, pos)
|
||||
let indent = ""
|
||||
const m = line.match(/^(\s+)/)
|
||||
if (m) indent = m[1]
|
||||
// Если предыдущая строка заканчивается на { [ ( или : — добавить отступ
|
||||
const trimmed = line.trimEnd()
|
||||
if (trimmed.endsWith("{") || trimmed.endsWith("[") || trimmed.endsWith("(") || trimmed.endsWith(":") || trimmed.endsWith(">")) {
|
||||
// проверим не закрыта ли скобка сразу
|
||||
indent += " "
|
||||
}
|
||||
// Если мы внутри скобок {} — добавить перенос и отступ для закрывающей
|
||||
let extra = ""
|
||||
if (pos < text.length) {
|
||||
const next = text[pos]
|
||||
if (next === "}" || next === "]" || next === ")") {
|
||||
extra = "\n" + indent.substring(0, Math.max(0, indent.length-4))
|
||||
}
|
||||
}
|
||||
const insertText = "\n" + indent + extra
|
||||
insert(pos, insertText)
|
||||
cursorPosition = pos + 1 + indent.length
|
||||
if (documentManager.activeIndex >=0) documentManager.updateContent(documentManager.activeIndex, text)
|
||||
return
|
||||
}
|
||||
|
||||
// Тег автозакрытие при вводе > — ДО проверки перепрыгивания, чтобы вставить </tag>
|
||||
if (event.text === ">") {
|
||||
const pos = cursorPosition
|
||||
|
||||
Reference in New Issue
Block a user