mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-250551 [markdown] don't ignore "Keep line breaks inside text blocks" option
GitOrigin-RevId: 9de834d5dce52ea3210947bbc05cad428cf4d71a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5ee5cb7baf
commit
97029563dc
+1
-1
@@ -83,7 +83,7 @@ internal object MarkdownSpacingBuilder {
|
||||
.apply {
|
||||
val spaces = if (markdown.FORCE_ONE_SPACE_BETWEEN_WORDS) 1 else Integer.MAX_VALUE
|
||||
between(MarkdownTokenTypes.TEXT, MarkdownTokenTypes.TEXT)
|
||||
.spacing(1, spaces, 0, markdown.KEEP_LINE_BREAKS_INSIDE_TEXT_BLOCKS && !markdown.WRAP_TEXT_IF_LONG, 0)
|
||||
.spacing(1, spaces, 0, markdown.KEEP_LINE_BREAKS_INSIDE_TEXT_BLOCKS, 0)
|
||||
between(MarkdownTokenTypes.TEXT, MarkdownElementTypes.STRONG).spacing(1, spaces, 0, false, 0)
|
||||
between(MarkdownTokenTypes.TEXT, MarkdownElementTypes.EMPH).spacing(1, spaces, 0, false, 0)
|
||||
between(MarkdownTokenTypes.TEXT, MarkdownElementTypes.STRIKETHROUGH).spacing(1, spaces, 0, false, 0)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non dignissim tellus, sed feugiat ante.
|
||||
In bibendum orci quis ultricies lobortis. Curabitur ac sapien efficitur quam ullamcorper varius.
|
||||
@@ -0,0 +1,2 @@
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur non dignissim tellus, sed feugiat ante.
|
||||
In bibendum orci quis ultricies lobortis. Curabitur ac sapien efficitur quam ullamcorper varius.
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
- **Logic:** Iterate through slides. For each slide, identify the Title shape and the content shapes
|
||||
(Body). Process paragraphs within these shapes to maintain the hierarchical structure
|
||||
(indentation).
|
||||
+1
@@ -0,0 +1 @@
|
||||
- **Logic:** Iterate through slides. For each slide, identify the Title shape and the content shapes (Body). Process paragraphs within these shapes to maintain the hierarchical structure (indentation).
|
||||
+29
-3
@@ -59,11 +59,37 @@ class MarkdownFormatterTest: LightPlatformCodeInsightTestCase() {
|
||||
|
||||
fun `test reflow no extra new lines`() = doTest(rightMargin = 80)
|
||||
|
||||
fun `test reflow no extra new lines keep line breaks margin 80`() = doTest(rightMargin = 80, keepLineBreaks = true)
|
||||
fun `test reflow no extra new lines keep line breaks margin 60`() = doTest(rightMargin = 60)
|
||||
|
||||
fun `test reflow no extra new lines keep line breaks margin 60`() = doTest(rightMargin = 60, keepLineBreaks = true)
|
||||
fun `test reflow no extra new lines keep line breaks margin 40`() = doTest(rightMargin = 40)
|
||||
|
||||
fun `test reflow no extra new lines keep line breaks margin 40`() = doTest(rightMargin = 40, keepLineBreaks = true)
|
||||
fun `test keep line breaks inside text block`() = doTest(rightMargin = 120, keepLineBreaks = true)
|
||||
|
||||
// IJPL-241496: a single long line wrapped at 100 and then reformatted at 80 must reflow cleanly,
|
||||
// not accumulate extra line breaks, when "keep line breaks inside text blocks" is disabled.
|
||||
fun `test text block reflow after decreasing margin`() {
|
||||
runWithTemporaryStyleSettings(project) { settings ->
|
||||
settings.apply {
|
||||
WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true
|
||||
getCustomSettings(MarkdownCustomCodeStyleSettings::class.java).apply {
|
||||
FORMAT_TABLES = false
|
||||
WRAP_TEXT_IF_LONG = true
|
||||
KEEP_LINE_BREAKS_INSIDE_TEXT_BLOCKS = false
|
||||
}
|
||||
}
|
||||
val common = settings.getCommonSettings(MarkdownLanguage.INSTANCE)
|
||||
val after = getTestName(true) + "_after.md"
|
||||
configureByFile(getTestName(true) + "_before.md")
|
||||
common.RIGHT_MARGIN = 100
|
||||
performReformatting(project, file)
|
||||
common.RIGHT_MARGIN = 80
|
||||
performReformatting(project, file)
|
||||
checkResultByFile(after)
|
||||
// reformatting again at 80 must stay stable
|
||||
performReformatting(project, file)
|
||||
checkResultByFile(after)
|
||||
}
|
||||
}
|
||||
|
||||
fun `test emphasis`() = doTest()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user