Add ANSICON_WRAP for programs that expect wrap
Some programs (notably less) rely on the right margin performing the wrap. Add such programs to the ANSICON_WRAP environment variable to stop ANSICON suppressing the newline.
This commit is contained in:
parent
a2c3595477
commit
af2c31c466
14
ANSI.c
14
ANSI.c
@ -187,6 +187,9 @@
|
||||
fix CRM with all partial RM sequences;
|
||||
check for the empty buffer within the critical section;
|
||||
palette improvements.
|
||||
|
||||
v1.82-wip, 12 February, 2018:
|
||||
add ANSICON_WRAP environment variable for programs that expect the wrap.
|
||||
*/
|
||||
|
||||
#include "ansicon.h"
|
||||
@ -233,6 +236,7 @@ int es_argv[MAX_ARG]; // escape sequence args
|
||||
TCHAR Pt_arg[4096]; // text parameter for Operating System Command
|
||||
int Pt_len;
|
||||
BOOL shifted, G0_special, SaveG0;
|
||||
BOOL wm = FALSE; // does program detect wrap itself?
|
||||
BOOL awm = TRUE; // autowrap mode
|
||||
BOOL im; // insert mode
|
||||
int screen_top = -1; // initial window top when cleared
|
||||
@ -662,7 +666,7 @@ void FlushBuffer( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if (!awm && !im)
|
||||
if ((wm || !awm) && !im && !pState->tb_margins)
|
||||
{
|
||||
if (pState->crm)
|
||||
{
|
||||
@ -867,6 +871,11 @@ void PushBuffer( WCHAR c )
|
||||
if (pState->crm)
|
||||
ChBuffer[nCharInBuffer++] = c;
|
||||
FlushBuffer();
|
||||
if (wm)
|
||||
{
|
||||
MoveDown( TRUE );
|
||||
return;
|
||||
}
|
||||
// Avoid writing the newline if wrap has already occurred.
|
||||
GetConsoleScreenBufferInfo( hConOut, &Info );
|
||||
if (pState->crm)
|
||||
@ -3841,6 +3850,9 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved )
|
||||
bResult = HookAPIAllMod( Hooks, FALSE, FALSE );
|
||||
OriginalAttr( lpReserved );
|
||||
|
||||
if (search_env( L"ANSICON_WRAP", prog ))
|
||||
wm = TRUE;
|
||||
|
||||
NtQueryInformationThread = (PNTQIT)GetProcAddress(
|
||||
GetModuleHandle( L"ntdll.dll" ), "NtQueryInformationThread" );
|
||||
if (NtQueryInformationThread == NULL)
|
||||
|
@ -91,7 +91,7 @@
|
||||
use -pu to unload from the parent.
|
||||
*/
|
||||
|
||||
#define PDATE L"28 December, 2017"
|
||||
#define PDATE L"12 February, 2018"
|
||||
|
||||
#include "ansicon.h"
|
||||
#include "version.h"
|
||||
|
12
readme.txt
12
readme.txt
@ -3,7 +3,7 @@
|
||||
|
||||
Copyright 2005-2017 Jason Hood
|
||||
|
||||
Version 1.80. Freeware
|
||||
Version 1.82-wip. Freeware
|
||||
|
||||
|
||||
Description
|
||||
@ -135,6 +135,11 @@ Usage
|
||||
rent attributes. The shift state and insert mode are always reset for a
|
||||
new process.
|
||||
|
||||
ANSICON will detect when a line wraps at the right margin and suppress a
|
||||
following newline. Some programs detect the wrap themselves and so the
|
||||
following newline is actually for a blank line; use the ANSICON_WRAP
|
||||
variable to indicate as such (see ANSICON_API below).
|
||||
|
||||
My version of WriteConsoleA will always set the number of characters writt-
|
||||
en, not the number of bytes. This means writing a double-byte character as
|
||||
two bytes will set 0 the first write (nothing was written) and 1 the second
|
||||
@ -334,6 +339,9 @@ Version History
|
||||
|
||||
Legend: + added, - bug-fixed, * changed.
|
||||
|
||||
1.82-wip - 12 February, 2018:
|
||||
- add ANSICON_WRAP for programs that expect the wrap at right margin.
|
||||
|
||||
1.81 - 28 December, 2017:
|
||||
- fix multiple CRs before LF (including preventing an immediate flush);
|
||||
- fix CR, BS and partial RM during CRM;
|
||||
@ -600,4 +608,4 @@ Distribution
|
||||
|
||||
|
||||
==============================
|
||||
Jason Hood, 28 December, 2017.
|
||||
Jason Hood, 12 February, 2018.
|
||||
|
10
version.h
10
version.h
@ -2,11 +2,11 @@
|
||||
version.h - Version defines.
|
||||
*/
|
||||
|
||||
#define PVERS L"1.81" // wide string
|
||||
#define PVERSA "1.81" // ANSI string (windres 2.16.91 didn't like L)
|
||||
#define PVERE L"181" // wide environment string
|
||||
#define PVEREA "181" // ANSI environment string
|
||||
#define PVERB 1,8,1,0 // binary (resource)
|
||||
#define PVERS L"1.82-wip" // wide string
|
||||
#define PVERSA "1.82-wip" // ANSI string (windres 2.16.91 didn't like L)
|
||||
#define PVERE L"182" // wide environment string
|
||||
#define PVEREA "182" // ANSI environment string
|
||||
#define PVERB 1,8,2,0 // binary (resource)
|
||||
|
||||
#ifdef _WIN64
|
||||
# define BITS L"64"
|
||||
|
Loading…
x
Reference in New Issue
Block a user