A focused Docker Compose management web application.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: auto indentation

Brooke def62777 39744b20

+8 -7
+8 -7
packages/panel/src/lib/component/ComposeEditor.svelte
··· 25 25 const enterHandler = (view: view.EditorView) => { 26 26 const { state } = view; 27 27 const { from } = state.selection.main; 28 - const line = state.doc.lineAt(from).text; 28 + const line = state.doc.lineAt(from); 29 29 30 - // Get the current indentation 31 - const currentIndent = line.match(/^(\s*)/)?.[0] ?? ""; 32 - const unit = state.facet(language.indentUnit); 30 + const change = line.text.substring(0, from - line.from).trim() !== ""; 33 31 34 32 let result = "\n"; 35 33 34 + // Get the current indentation 35 + const currentIndent = line.text.match(/^(\s*)/)?.[0] ?? ""; 36 + const unit = state.facet(language.indentUnit); 37 + 36 38 // Check if line ends with a colon 37 - if (/:\s*(?:#.*)?$/.test(line)) { 39 + if (change && /:\s*(?:#.*)?$/.test(line.text)) { 38 40 result += currentIndent + unit; // Increase indent for new line 39 41 } 40 42 41 43 // Check if line starts starts with a dash 42 - else if (/^\s*-/.test(line)) { 44 + else if (change && /^\s*-/.test(line.text)) { 43 45 result += currentIndent + "- "; // Inset a dash on new line 44 46 } 45 47 ··· 212 214 213 215 // padding: 0 10px; 214 216 border-radius: 5px; 215 - overflow: hidden; 216 217 217 218 border: 1px solid var(--subtext0); 218 219