From 8990d731a46738d673f0ad62c018d8f559177179 Mon Sep 17 00:00:00 2001 From: Fabian Zickgraf Date: Wed, 26 May 2021 17:48:22 +0200 Subject: [PATCH] Introduce SetGlobalLineWrappingStatus --- src/gap.c | 18 ++++++++++++++++++ src/io.c | 8 ++++---- src/sysopt.h | 7 +++++++ src/system.c | 7 +++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/gap.c b/src/gap.c index b1836a4d19..498188cade 100644 --- a/src/gap.c +++ b/src/gap.c @@ -558,6 +558,23 @@ static Obj FuncSizeScreen(Obj self, Obj args) } +/**************************************************************************** +** +*F FuncSetGlobalLineWrappingStatus( , ) . . . . internal function 'SetGlobalLineWrappingStatus' +** +*/ +static Obj FuncSetGlobalLineWrappingStatus(Obj self, Obj val) +{ + + RequireTrueOrFalse(SELF_NAME, val); + + SyLineWrappingDisabled = (val == False); + + return 0; + +} + + /**************************************************************************** ** *F FuncWindowCmd( , ) . . . . . . . . execute a window command @@ -1280,6 +1297,7 @@ static Obj FuncAssertionLevel(Obj self) static StructGVarFunc GVarFuncs[] = { GVAR_FUNC(SizeScreen, -1, "args"), + GVAR_FUNC_1ARGS(SetGlobalLineWrappingStatus, val), GVAR_FUNC_1ARGS(ID_FUNC, object), GVAR_FUNC(RETURN_FIRST, -2, "first, rest"), GVAR_FUNC(RETURN_NOTHING, -1, "object"), diff --git a/src/io.c b/src/io.c index 9efc646ee1..a51ed28d39 100644 --- a/src/io.c +++ b/src/io.c @@ -1285,12 +1285,12 @@ static void PutChrTo(TypOutputFile * stream, Char ch) /* if we are going to split at the end of the line, and we are formatting discard blanks */ - if ( stream->format && spos == stream->pos && ch == ' ' ) { + if ( !SyLineWrappingDisabled && stream->format && spos == stream->pos && ch == ' ' ) { ; } /* full line, acceptable split position */ - else if ( stream->format && spos != 0 ) { + else if ( !SyLineWrappingDisabled && stream->format && spos != 0 ) { /* add character to the line, terminate it */ stream->line[ stream->pos++ ] = ch; @@ -1329,7 +1329,7 @@ static void PutChrTo(TypOutputFile * stream, Char ch) /* full line, no split position */ else { - if (stream->format) + if ( !SyLineWrappingDisabled && stream->format ) { /* append a '\',*/ stream->line[ stream->pos++ ] = '\\'; @@ -1343,7 +1343,7 @@ static void PutChrTo(TypOutputFile * stream, Char ch) stream->pos = 0; stream->line[ stream->pos++ ] = ch; - if (stream->format) + if ( !SyLineWrappingDisabled && stream->format ) stream->hints[0] = -1; } diff --git a/src/sysopt.h b/src/sysopt.h index 89008343f2..20c241278c 100644 --- a/src/sysopt.h +++ b/src/sysopt.h @@ -105,6 +105,13 @@ extern UInt SyNrRows; extern UInt SyNrRowsLocked; +/**************************************************************************** +** +*V SyLineWrappingDisabled . . . . . . . . . do not wrap lines when printing +** +*/ +extern UInt SyLineWrappingDisabled; + /**************************************************************************** ** *V SyQuiet . . . . . . . . . . . . . . . . . . . . . . . . . surpress prompt diff --git a/src/system.c b/src/system.c index 853ce8d3e9..57a0cd5856 100644 --- a/src/system.c +++ b/src/system.c @@ -157,6 +157,12 @@ UInt SyNrColsLocked; UInt SyNrRows; UInt SyNrRowsLocked; +/**************************************************************************** +** +*V SyLineWrappingDisabled . . . . . . . . . do not wrap lines when printing +*/ +UInt SyLineWrappingDisabled; + /**************************************************************************** ** *V SyQuiet . . . . . . . . . . . . . . . . . . . . . . . . . suppress prompt @@ -705,6 +711,7 @@ void InitSystem ( SyNrColsLocked = 0; SyNrRows = 0; SyNrRowsLocked = 0; + SyLineWrappingDisabled = 0; SyQuiet = 0; SyInitializing = 0;