From 4fa5942332c229adb6c42f840985452284df759e Mon Sep 17 00:00:00 2001
From: dudua99 <99@9900.co.il>
Date: Thu, 26 Nov 2026 12:34:55 +0000
Subject: [PATCH 1/3] =?UTF-8?q?=D7=91=D7=93=D7=99=D7=A7=D7=AA=20=D7=90?=
=?UTF-8?q?=D7=99=D7=9E=D7=95=D7=AA:=20=D7=9B=D7=95=D7=AA=D7=A8=D7=AA=20?=
=?UTF-8?q?=D7=91=D7=A9=D7=95=D7=A8=D7=94=20=D7=A0=D7=A4=D7=A8=D7=93=D7=AA?=
=?UTF-8?q?=20=D7=A0=D7=93=D7=91=D7=A7=D7=AA=20=D7=9C=D7=98=D7=A7=D7=A1?=
=?UTF-8?q?=D7=98=20=D7=9B=D7=A9=D7=A2=D7=A8=D7=95=D7=A5=20=D7=94=D7=94?=
=?UTF-8?q?=D7=A2=D7=AA=D7=A7=D7=94=20=D7=9E=D7=A1=D7=AA=D7=99=D7=A8=20?=
=?UTF-8?q?=D7=A4=D7=99=D7=A1=D7=95=D7=A7=20(issue=20#5463)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../selection/selected_text_copy_test.dart | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/test/text_book/view/selection/selected_text_copy_test.dart b/test/text_book/view/selection/selected_text_copy_test.dart
index 7a07e1b6f5..1e00bc0204 100644
--- a/test/text_book/view/selection/selected_text_copy_test.dart
+++ b/test/text_book/view/selection/selected_text_copy_test.dart
@@ -481,6 +481,67 @@ void main() {
);
expect(copied, isNull);
});
+
+ group('כותרת בשורה נפרדת כשערוץ ההעתקה מסתיר פיסוק (#5463)', () {
+ // פסוק כפי שהוא בספר בראשית; הכותרת "פרק א" אינה מסתיימת בנקודה.
+ const verse =
+ '(א) בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃';
+ const plainVerse =
+ '(א) בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃';
+ const header = 'ספר בדיקה, פרק א';
+
+ Future<({String plainText, String htmlText})> copyVerse(
+ String format,
+ ) async {
+ final state = _state(
+ verse,
+ link,
+ const TextDisplayPatch(punctuation: MarkVisibility.hide),
+ ).copyWith(content: const ['
פרק א
', verse]);
+ final copied = await buildSelectedTextCopy(
+ plainText: plainVerse,
+ selectedIndex: 1,
+ sourceContent: state.content,
+ textBookState: state,
+ settingsState: SettingsState.initial().copyWith(
+ copyWithHeaders: 'book_and_path',
+ copyHeaderFormat: format,
+ ),
+ copyTarget: TextTarget.body,
+ );
+ return copied!;
+ }
+
+ test('כותרת לפני הטקסט', () async {
+ final copied = await copyVerse('separate_line_before');
+ expect(copied.plainText, '$header\n$plainVerse');
+ expect(
+ CopyUtils.buildStyledHtml(
+ htmlText: copied.htmlText,
+ fontFamily: 'Arial',
+ fontSize: 16,
+ ),
+ allOf(
+ startsWith('$header
$verse'),
+ ),
+ );
+ });
+
+ test('כותרת אחרי הטקסט', () async {
+ final copied = await copyVerse('separate_line_after');
+ expect(copied.plainText, '$plainVerse\n$header');
+ expect(
+ CopyUtils.buildStyledHtml(
+ htmlText: copied.htmlText,
+ fontFamily: 'Arial',
+ fontSize: 16,
+ ),
+ allOf(contains('>$verse'), endsWith('>$header')),
+ );
+ });
+ });
});
}
From d04322b3c8c56b2179d8d571623ff39b7974a10b Mon Sep 17 00:00:00 2001
From: dudua99 <99@9900.co.il>
Date: Thu, 26 Nov 2026 12:40:06 +0000
Subject: [PATCH 2/3] =?UTF-8?q?=D7=AA=D7=99=D7=A7=D7=95=D7=9F=20issue=20#5?=
=?UTF-8?q?463=20=E2=80=94=20=D7=9B=D7=95=D7=AA=D7=A8=D7=AA=20=D7=91=D7=A9?=
=?UTF-8?q?=D7=95=D7=A8=D7=94=20=D7=A0=D7=A4=D7=A8=D7=93=D7=AA=20=D7=A0?=
=?UTF-8?q?=D7=93=D7=91=D7=A7=D7=AA=20=D7=9C=D7=98=D7=A7=D7=A1=D7=98=20?=
=?UTF-8?q?=D7=9B=D7=A9=D7=A2=D7=A8=D7=95=D7=A5=20=D7=94=D7=94=D7=A2=D7=AA?=
=?UTF-8?q?=D7=A7=D7=94=20=D7=9E=D7=A1=D7=AA=D7=99=D7=A8=20=D7=A4=D7=99?=
=?UTF-8?q?=D7=A1=D7=95=D7=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
buildSelectedTextCopy הוסיף את הכותרות לטקסט ורק אחר כך העביר את הכול דרך
פרופיל ערוץ ההעתקה. כשהפרופיל מסתיר פיסוק, removePunctuation מחבר שורה שאינה
מסתיימת ב-"." או ":" לשורה הבאה ברווח — ולכן "בראשית, פרק א" נדבק לפסוק,
ובגמרא ("ברכות, דף ב.") זה עבד. השורש: a8885cf9b (#1859), שהחיל את ערוץ
ההעתקה על "העתק" ועל Ctrl+C.
עכשיו הפרופיל חל על הטקסט שנבחר בלבד, והכותרות נוספות אחריו — כמו
ב-buildParagraphCopyText (העתקת פסקה).
---
.../view/selection/selected_text_copy.dart | 21 ++++++++++++-------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/lib/text_book/view/selection/selected_text_copy.dart b/lib/text_book/view/selection/selected_text_copy.dart
index c658dd007b..a40d8b9cec 100644
--- a/lib/text_book/view/selection/selected_text_copy.dart
+++ b/lib/text_book/view/selection/selected_text_copy.dart
@@ -201,6 +201,18 @@ Future<({String plainText, String htmlText})?> buildSelectedTextCopy({
selectionLineEnd: selectionLineEnd,
divineNames: showsSubstitutedNames ? textBookState.divineNames : null,
);
+ // הפרופיל חל על הטקסט לפני הכותרות — הסרת פיסוק מחברת שורה שאינה
+ // מסתיימת בנקודה לבאה, ו"כותרת בשורה נפרדת" נדבקה לטקסט (#5463).
+ final copy = CopyUtils.applyCopyPreferencesForClipboard(
+ plainText: plainText,
+ htmlText: htmlContentToUse,
+ replaceHolyNames: settingsState.replaceHolyNames,
+ holyNameStyle: settingsState.holyNameStyle,
+ removeNikud: removeNikud,
+ profile: profile,
+ );
+ plainText = copy.plainText;
+ htmlContentToUse = copy.htmlText;
var finalPlainText = plainText;
final headerBook = headerBookOverride ?? textBookState?.book;
@@ -236,12 +248,5 @@ Future<({String plainText, String htmlText})?> buildSelectedTextCopy({
);
}
- return CopyUtils.applyCopyPreferencesForClipboard(
- plainText: finalPlainText,
- htmlText: htmlContentToUse,
- replaceHolyNames: settingsState.replaceHolyNames,
- holyNameStyle: settingsState.holyNameStyle,
- removeNikud: removeNikud,
- profile: profile,
- );
+ return (plainText: finalPlainText, htmlText: htmlContentToUse);
}
From a53a9c89bd8407641861053776f2ef54cbe0b47a Mon Sep 17 00:00:00 2001
From: ypl <7353755@gmail.com>
Date: Fri, 27 Nov 2026 02:18:19 +0200
Subject: [PATCH 3/3] =?UTF-8?q?=D7=A9=D7=9E=D7=95=D7=A8=20=D7=A2=D7=9C=20?=
=?UTF-8?q?=D7=A1=D7=99=D7=A0=D7=95=D7=9F=20=D7=9B=D7=95=D7=AA=D7=A8=D7=95?=
=?UTF-8?q?=D7=AA=20=D7=91=D7=94=D7=A2=D7=AA=D7=A7=D7=AA=20=D7=98=D7=A7?=
=?UTF-8?q?=D7=A1=D7=98=20=D7=A0=D7=91=D7=97=D7=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../view/selection/selected_text_copy.dart | 35 +++++++++++++------
.../selection/selected_text_copy_test.dart | 35 +++++++++++++++++--
2 files changed, 57 insertions(+), 13 deletions(-)
diff --git a/lib/text_book/view/selection/selected_text_copy.dart b/lib/text_book/view/selection/selected_text_copy.dart
index a40d8b9cec..a09f4d8b95 100644
--- a/lib/text_book/view/selection/selected_text_copy.dart
+++ b/lib/text_book/view/selection/selected_text_copy.dart
@@ -201,26 +201,26 @@ Future<({String plainText, String htmlText})?> buildSelectedTextCopy({
selectionLineEnd: selectionLineEnd,
divineNames: showsSubstitutedNames ? textBookState.divineNames : null,
);
- // הפרופיל חל על הטקסט לפני הכותרות — הסרת פיסוק מחברת שורה שאינה
- // מסתיימת בנקודה לבאה, ו"כותרת בשורה נפרדת" נדבקה לטקסט (#5463).
- final copy = CopyUtils.applyCopyPreferencesForClipboard(
- plainText: plainText,
- htmlText: htmlContentToUse,
+ ({String plainText, String htmlText}) applyPreferences(
+ String plain,
+ String html,
+ ) => CopyUtils.applyCopyPreferencesForClipboard(
+ plainText: plain,
+ htmlText: html,
replaceHolyNames: settingsState.replaceHolyNames,
holyNameStyle: settingsState.holyNameStyle,
removeNikud: removeNikud,
profile: profile,
);
- plainText = copy.plainText;
- htmlContentToUse = copy.htmlText;
var finalPlainText = plainText;
final headerBook = headerBookOverride ?? textBookState?.book;
+ var processedSeparately = false;
if (settingsState.copyWithHeaders != 'none' && headerBook != null) {
- final bookName = CopyUtils.extractBookName(headerBook);
+ var bookName = CopyUtils.extractBookName(headerBook);
final currentIndex = headerIndexOverride ?? selectedIndex ?? 0;
final headerContent = headerContentOverride ?? sourceContent;
- final currentPath = await CopyUtils.extractCurrentPath(
+ var currentPath = await CopyUtils.extractCurrentPath(
headerBook,
currentIndex,
bookContent: headerContent,
@@ -231,6 +231,19 @@ Future<({String plainText, String htmlText})?> buildSelectedTextCopy({
: null,
);
+ // מסננים לפני הצירוף כדי שהסרת פיסוק לא תחבר את הכותרת לגוף.
+ final format = settingsState.copyHeaderFormat;
+ if (profile != null &&
+ profile.removePunctuation &&
+ (format == 'separate_line_before' || format == 'separate_line_after')) {
+ final copy = applyPreferences(plainText, htmlContentToUse);
+ plainText = copy.plainText;
+ htmlContentToUse = copy.htmlText;
+ bookName = applyTextDisplayProfile(bookName, profile);
+ currentPath = applyTextDisplayProfile(currentPath, profile);
+ processedSeparately = true;
+ }
+
finalPlainText = CopyUtils.formatTextWithHeaders(
originalText: plainText,
copyWithHeaders: settingsState.copyWithHeaders,
@@ -248,5 +261,7 @@ Future<({String plainText, String htmlText})?> buildSelectedTextCopy({
);
}
- return (plainText: finalPlainText, htmlText: htmlContentToUse);
+ return processedSeparately
+ ? (plainText: finalPlainText, htmlText: htmlContentToUse)
+ : applyPreferences(finalPlainText, htmlContentToUse);
}
diff --git a/test/text_book/view/selection/selected_text_copy_test.dart b/test/text_book/view/selection/selected_text_copy_test.dart
index 1e00bc0204..56b00e9005 100644
--- a/test/text_book/view/selection/selected_text_copy_test.dart
+++ b/test/text_book/view/selection/selected_text_copy_test.dart
@@ -491,13 +491,15 @@ void main() {
const header = 'ספר בדיקה, פרק א';
Future<({String plainText, String htmlText})> copyVerse(
- String format,
- ) async {
+ String format, {
+ String heading = 'פרק א',
+ bool removeNikud = false,
+ }) async {
final state = _state(
verse,
link,
const TextDisplayPatch(punctuation: MarkVisibility.hide),
- ).copyWith(content: const ['פרק א
', verse]);
+ ).copyWith(content: ['$heading
', verse]);
final copied = await buildSelectedTextCopy(
plainText: plainVerse,
selectedIndex: 1,
@@ -508,6 +510,7 @@ void main() {
copyHeaderFormat: format,
),
copyTarget: TextTarget.body,
+ removeNikud: removeNikud,
);
return copied!;
}
@@ -541,6 +544,32 @@ void main() {
allOf(contains('>$verse'), endsWith('>$header')),
);
});
+
+ test('העתק בלי ניקוד מסיר ניקוד וטעמים גם מכותרת נפרדת', () async {
+ final copied = await copyVerse(
+ 'separate_line_before',
+ heading: 'פֶּ֖רֶק א',
+ removeNikud: true,
+ );
+ const unmarked = '(א) בראשית ברא אלהים את השמים ואת הארץ';
+ const htmlUnmarked =
+ '(א) בראשית ברא אלהים את השמים ואת הארץ';
+ expect(copied.plainText, '$header\n$unmarked');
+ expect(copied.htmlText, '$header\n$htmlUnmarked');
+ });
+
+ for (final entry in const {
+ 'same_line_after_brackets': '$plainVerse (ספר בדיקה פרק א)',
+ 'same_line_after_no_brackets': '$plainVerse ספר בדיקה פרק א',
+ 'same_line_before_brackets': '(ספר בדיקה פרק א) $plainVerse',
+ 'same_line_before_no_brackets': 'ספר בדיקה פרק א $plainVerse',
+ }.entries) {
+ test('סינון כותרת נשמר בתבנית ${entry.key}', () async {
+ final copied = await copyVerse(entry.key);
+ expect(copied.plainText, entry.value);
+ expect(copied.htmlText, entry.value.replaceFirst(plainVerse, verse));
+ });
+ }
});
});
}