Skip to content

Commit

Permalink
v1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill-Stewart committed Jul 13, 2020
1 parent 4905095 commit 592798e
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 22 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ The line editor supports the following keystroke commands:
| `Ctrl+C` | Cancel input
| `Enter` or `Ctrl+M` | Enter input

* There is no visual indication of insert vs. overtype mode.

* **editenv** does not work from the PowerShell ISE.

## EXIT CODES

| Description | Exit Code
Expand Down Expand Up @@ -83,6 +79,22 @@ The line editor supports the following keystroke commands:

* The `--maskinput` parameter is not encrypted or secure.

* There is no visual indication of insert vs. overtype mode.

* **editenv** does not work from the PowerShell ISE.

## VERSION HISTORY

1.1.0.0 (2020-07-13)

* Build using FPC 3.2.0.

* Minor documentation corrections.

1.0.0.0 (2020-03-17)

* Initial version.

## EXAMPLES

1. Edit the `Path` environment variable for the current console:
Expand Down
13 changes: 6 additions & 7 deletions editenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
var
ProcessID: DWORD;
CommandLine: TCommandLine;
VarValue, NewValue: String;
VarValue, NewValue: string;
Editor: TLineEditor;
Canceled, TimedOut: boolean;

Expand Down Expand Up @@ -109,9 +109,6 @@ procedure Usage();
WriteLn('Ctrl+C Cancel input');
WriteLn('Enter or Ctrl+M Enter input');
WriteLn();
WriteLn('* There is no visual indication of insert vs. overtype mode.');
WriteLn('* editenv does not work from the PowerShell ISE.');
WriteLn();
WriteLn('EXIT CODES');
WriteLn();
WriteLn('Description Exit Code');
Expand All @@ -136,6 +133,8 @@ procedure Usage();
WriteLn('* The environment variable''s value is limited to ', MAX_ENVVAR_VALUE_LENGTH, ' characters.');
WriteLn('* The --timeout parameter does not use a high-precision timer.');
WriteLn('* The --maskinput parameter is not encrypted or secure.');
WriteLn('* There is no visual indication of insert vs. overtype mode.');
WriteLn('* editenv does not work from the PowerShell ISE.');
end;

// Returns N as a string
Expand Down Expand Up @@ -379,7 +378,7 @@ function IsOSVersionNewEnough(): boolean;
var
OVI: OSVERSIONINFO;
begin
result := False;
result := false;
OVI.dwOSVersionInfoSize := SizeOf(OSVERSIONINFO);
if GetVersionEx(OVI) then
result := (OVI.dwPlatformId = VER_PLATFORM_WIN32_NT) and (OVI.dwMajorVersion >= 5);
Expand Down Expand Up @@ -490,13 +489,13 @@ function IsOSVersionNewEnough(): boolean;
// Destroy instance
Editor.Destroy();

If Canceled then
if Canceled then
begin
ExitCode := ERROR_CANCELLED;
exit();
end;

If TimedOut then
if TimedOut then
begin
ExitCode := WAIT_TIMEOUT;
exit();
Expand Down
8 changes: 4 additions & 4 deletions editenv.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,0
FILEOS 0x4
FILETYPE 1
{
Expand All @@ -10,12 +10,12 @@ FILETYPE 1
{
VALUE "CompanyName", "Bill Stewart (bstewart at iname.com)"
VALUE "FileDescription", "editenv.exe"
VALUE "FileVersion", "1.0.0.0"
VALUE "FileVersion", "1.1.0.0"
VALUE "InternalName", "editenv.exe"
VALUE "LegalCopyright", "(C) 2020 by Bill Stewart (bstewart at iname.com)"
VALUE "OriginalFilename", "editenv.exe"
VALUE "ProductName", "editenv.exe"
VALUE "ProductVersion", "1.0.0.0"
VALUE "ProductVersion", "1.1.0.0"
}
}

Expand Down
2 changes: 1 addition & 1 deletion wsWinConsole.pp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ procedure InitializeUnit();
CONOUT := CreateFile('CONOUT$', // LPCTSTR lpFileName
Access, // DWORD dwDesiredAccess
FILE_SHARE_READ, // DWORD dwShareMode
Nil, // LPSECURITY_ATTRIBUTES lpSecurityAttributes
nil, // LPSECURITY_ATTRIBUTES lpSecurityAttributes
OPEN_EXISTING, // DWORD dwCreationDisposition
0, // DWORD dwFlagsAndAttributes
0); // HANDLE hTemplateFile
Expand Down
2 changes: 1 addition & 1 deletion wsWinEnvVar.pp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function SetEnvVarInProcess(const ProcessID: DWORD; const Name, Value: string):
SYNCHRONIZE;
// Open process
hProcess := OpenProcess(ProcessAccess, // DWORD dwDesiredAccess
True, // BOOL bInheritHandle
true, // BOOL bInheritHandle
ProcessID); // DWORD dwProcessId
if hProcess <> 0 then
begin
Expand Down
6 changes: 3 additions & 3 deletions wsWinLineEditor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TLineEditor = class
DisallowedCharSet: TCharSet; // characters disallowed for input
WordDelims: TCharSet; // word delimiter characters
IsCanceled: boolean; // true if Ctrl+C pressed
IsTimedOut: Boolean; // true if timeout elapsed
IsTimedOut: boolean; // true if timeout elapsed
TimeoutSecs: word; // times out after this many seconds
MaxLen: word; // maximum allowed # of characters
CurrMaxLen: word; // grows as line length increases
Expand Down Expand Up @@ -223,7 +223,7 @@ procedure TLineEditor.EndLine();
end;
end;

Procedure TLineEditor.ShowLine();
procedure TLineEditor.ShowLine();
var
Part: string;
begin
Expand Down Expand Up @@ -435,7 +435,7 @@ function TLineEditor.EditLine(const Text: string): string;
Key := TranslateKeyEvent(GetKeyEvent());
if IsFunctionKey(Key) then
begin
KeyString := LowerCase(KeyEventToString(Key));
KeyString := Lowercase(KeyEventToString(Key));
case KeyString of
'insert': ToggleInsert();
'left': EditCursorLeft(1);
Expand Down
2 changes: 1 addition & 1 deletion wsWinMessage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function GetWindowsMessage(const MessageId: DWORD; const Module: string; const A

function GetWindowsMessage(const MessageId: DWORD; const Module: string; const AddId: boolean; const Args: array of string): string;

Implementation
implementation

function FormatMessageFromSystem(const MessageId: DWORD; const AddId: boolean = false; const Module: string = ''): string;
var
Expand Down
2 changes: 1 addition & 1 deletion wsWinString.pp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function UnicodeToBase64String(const S: unicodestring): string;
pResult: pointer;
begin
result := '';
Flags := CRYPT_STRING_BASE64 Or CRYPT_STRING_NOCRLF;
Flags := CRYPT_STRING_BASE64 or CRYPT_STRING_NOCRLF;
if CryptBinaryToStringW(pointer(S), // PBYTE pbBinary
Length(S) * SizeOf(widechar), // DWORD cbBinary
Flags, // DWORD dwflags
Expand Down

0 comments on commit 592798e

Please sign in to comment.