File 2629-shell-Fix-expression-formatting-using-erl_pp.patch of Package erlang
From 1236c439ea69d75e8f098bd0493731409de00555 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 4 Jan 2024 09:58:16 +0100
Subject: [PATCH 09/11] shell: Fix expression formatting using erl_pp
When formatting expressions using erl_scan:tokens the string
is expected to have a newline at the end, so we add one so that
it is always there.
---
lib/stdlib/src/shell.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index 1e2f8d0d31..5164023290 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -1884,7 +1884,7 @@ erl_pp_format_func(String) ->
%% If you add return_comments to the option list,
%% parsing will fail, and we will end up with the original string.
Options = [text,{reserved_word_fun,fun erl_scan:reserved_word/1}],
- case erl_scan:tokens([], String, {1,1}, Options) of
+ case erl_scan:tokens([], string:trim(String) ++ "\n", {1,1}, Options) of
{done, {ok, Toks, _}, _} ->
try
case erl_parse:parse_form(Toks) of
--
2.35.3