mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Only use the LaTeX indent service for when inserting a line break (#21530)
GitOrigin-RevId: 15c5e5afdee59badc833fe2deb13a80b3c409862
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
SelectionRange,
|
||||
} from '@codemirror/state'
|
||||
import {
|
||||
getIndentation,
|
||||
getIndentUnit,
|
||||
IndentContext,
|
||||
indentString,
|
||||
@@ -38,7 +37,7 @@ const wrapRangeInList = (
|
||||
prefix = ''
|
||||
) => {
|
||||
const cx = new IndentContext(state)
|
||||
const columns = getIndentation(cx, range.from) ?? 0
|
||||
const columns = cx.lineIndent(range.from)
|
||||
const unit = getIndentUnit(state)
|
||||
const indent = indentString(state, columns)
|
||||
const itemIndent = indentString(state, columns + unit)
|
||||
@@ -113,7 +112,7 @@ const unwrapRangeFromList = (
|
||||
const listToLine = state.doc.lineAt(list.to)
|
||||
|
||||
const cx = new IndentContext(state)
|
||||
const columns = getIndentation(cx, range.from) ?? 0
|
||||
const columns = cx.lineIndent(range.from)
|
||||
const unit = getIndentUnit(state)
|
||||
const indent = indentString(state, columns - unit) // decrease indent depth
|
||||
|
||||
@@ -270,7 +269,8 @@ const toggleListForRange = (
|
||||
|
||||
// if the line before the command is empty, remove one unit of indentation
|
||||
if (lineBeforeCommand.trim().length === 0) {
|
||||
const indentation = getIndentation(view.state, itemNode.from)
|
||||
const cx = new IndentContext(view.state)
|
||||
const indentation = cx.lineIndent(itemNode.from)
|
||||
change.from -= Math.min(indentation ?? 0, indentUnit)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user