Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce SetGlobalLineWrappingStatus #4511

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,23 @@ static Obj FuncSizeScreen(Obj self, Obj args)
}


/****************************************************************************
**
*F FuncSetGlobalLineWrappingStatus( <self>, <args> ) . . . . internal function 'SetGlobalLineWrappingStatus'
**
*/
static Obj FuncSetGlobalLineWrappingStatus(Obj self, Obj val)
{

RequireTrueOrFalse(SELF_NAME, val);

SyLineWrappingDisabled = (val == False);

return 0;

}


/****************************************************************************
**
*F FuncWindowCmd( <self>, <args> ) . . . . . . . . execute a window command
Expand Down Expand Up @@ -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"),
Expand Down
8 changes: 4 additions & 4 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++ ] = '\\';
Expand All @@ -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;
}

Expand Down
7 changes: 7 additions & 0 deletions src/sysopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ UInt SyNrColsLocked;
UInt SyNrRows;
UInt SyNrRowsLocked;

/****************************************************************************
**
*V SyLineWrappingDisabled . . . . . . . . . do not wrap lines when printing
*/
UInt SyLineWrappingDisabled;

/****************************************************************************
**
*V SyQuiet . . . . . . . . . . . . . . . . . . . . . . . . . suppress prompt
Expand Down Expand Up @@ -705,6 +711,7 @@ void InitSystem (
SyNrColsLocked = 0;
SyNrRows = 0;
SyNrRowsLocked = 0;
SyLineWrappingDisabled = 0;
SyQuiet = 0;
SyInitializing = 0;

Expand Down