clink

Bash's powerful command line editing in cmd.exe

GPL-3.0 License

Stars
3.5K
clink - v1.2.32

Published by chrisant996 about 3 years ago

  • Added rl_buffer:setargument() function for a "luafunc:" macro to be able to set Readline's numeric argument.
  • Added os.getclipboardtext() and os.setclipboardtext() functions.
  • Added extra defense against antivirus interference (if it interferes when Clink inspects the target process, but permits Clink to inject into the target process).
  • Fixed cooperation between "luafunc:" macros and CUA selection commands (e.g. Shift+End).
  • Fixed rl_buffer:getcursor() and the return value from rl_buffer:setcursor(); both returned one less than the actual cursor position.
  • Fixed #162; clink completion shows script error (regression introduced in v1.2.31).
clink - v1.2.31

Published by chrisant996 about 3 years ago

  • Added clink uninstallscripts --all to clear all script paths installed by clink installscripts.
  • Added os.touch() function to set the access and modified times for a file.
  • Added more fields in os.globdir() and os.globfiles() when extrainfo is requested.
  • Potential Breaking Change: Fixed os.globdir() and os.globfiles() to only return extra info when actually requested (regression introduced in v1.1.8).
    • This unfortunately changes the scheme and may break some scripts if they requested no extra info, but used the extra info anyway.
  • Fixed crash in clink-select-complete when a match display filter returns nil.
  • Fixed ondisplaymatches() which was receiving one fewer matches than it should (related to #124).
  • Fixed ondisplaymatches() which was not using the word break info correctly (from generators' :getwordbreakinfo() functions).
  • Fixed word_classifications:applycolor(); the input line didn't necessarily refresh correctly after a custom classifier applied custom colors.
  • Fixed potential stray inaccurate colorations when coloring the input for clink set color.something some_value.
  • Fixed #161; clink installscripts garbles previously-installed script paths when installing a new one.
  • Fixed #155; settings.set() doesn't update the settings file.
clink - v1.2.30

Published by chrisant996 about 3 years ago

  • Replaced the built-in Lua implementation of os.clock() so it doesn't stop working after the program has been running for more than 24 days (which caused asychronous prompt filtering to stop working). As a side effect, the new os.clock() has microsecond precision instead of millisecond precision.
  • Fixed coroutine throttling. It was meant to prevent running more than once per 5 seconds, but accidentally forced running every 5 seconds, even if the coroutine was registered to run less often.
clink - v1.2.29

Published by chrisant996 about 3 years ago

  • Added prompt.transient Clink setting which can collapse prior prompts to a condensed form. The new %CLINK_TRANSIENT_PROMPT% and %CLINK_TRANSIENT_RPROMPT% environment variables supply the initial prompt strings, and prompt filters can define :transientfilter() and :transientrightfilter() functions to filter the transient prompt.
  • Added clink.logo Clink setting to globally control what startup logo is shown (full copyright logo by default, or a short version logo, or no startup logo).
  • Added console.readinput() function which waits for one key input, and returns the key sequence string for the key.
  • Added console.reload() function which reloads Lua scripts and the Readline config file at the next prompt.
  • Added logging for more possible failure points while injecting Clink into the host process.
  • Added default key bindings for Ctrl+Up and Ctrl+Down to scroll the screen one line, like conhost normally does.
  • Now clink set cl* lists all settings that begin with cl (the star wildcard is only supported at the end of the string).
  • Documentation includes a link to the new clink-flex-prompt.
  • Fixed the Lua debugger to support printing UTF8 text, and to escape string variable contents to avoid escape code side effects.
  • Fixed #154; crash when `settings.set("some_setting", false) is used.
  • Fixed #153; ESC key problem. Clink migrated the old esc_clears_line setting backwards, causing Esc to behave opposite from what was expected.
  • Fixed #152; LUA debugger breaks on the wrong line, and fails to execute expressions.
clink - v1.2.28

Published by chrisant996 about 3 years ago

  • Added rl.getpromptinfo() function.
  • Fixed loading .inputrc so that only one is loaded (regression introduced in v1.0.0a0 by the fix for mridgers #258). If similar behavior is still desired, consider using the $include directive in the Readline init file, to load additional files.
  • Fixed clink-select-complete to respect when mark-directories in .inputrc file if off.
  • Fixed crash in console.findline() when no attributes are passed. Callers using v1.2.27 and earlier can work around the crash by passing {} for attributes.
  • Fixed an off-by-1 bug in console.scroll("absolute", top). This will fix edge case malfunctions in some callers, but some callers could experience this as a breaking change.
clink - v1.2.27

Published by chrisant996 about 3 years ago

  • The cmd.get_errorlevel Clink setting is now enabled by default.
  • Clink now expands $ codes in %CLINK_RPROMPT% before running prompt filters.
  • Fixed parsing 2>&1 style redirection symbols, so the & doesn't get treated as a command separator.
  • Fixed argmatchers to generate file matches for redirection arguments; app.exe > should generate file matches for the > symbol, not matches for the app argmatcher's first argument.
clink - v1.2.26

Published by chrisant996 about 3 years ago

  • Fixed input line coloring for doskey aliases that don't have an argmatcher (regression introduced in v1.2.16).
  • Fixed Space during clink-select-complete when there were already opening and closing quotes present.
  • Fixed redrawing multiple lines of input after certain commands such as clink-show-help Alt+H (regression introduced in v1.1.20).
  • Fixed the completion-auto-query-items config variable to account for multiple lines of input, if present.
  • Fixed potential race condition if multiple Clink instances try to get the last errorlevel at the same time.
clink - v1.2.25

Published by chrisant996 about 3 years ago

  • Added cua-select-all command to select the entire input line.
  • Added edit-and-execute-command command to invoke an editor on the current input line and then execute the results (Ctrl+X,Ctrl+E). This attempts to invoke %VISUAL%, %EDITOR%, or notepad.exe as the editor, in that order.
  • Added some new expansion commands:
    • clink-expand-history performs history expansion on the current input line (Alt+^).
    • clink-expand-history-and-alias performs history and doskey alias expansion on the current input line.
    • clink-expand-line performs history, doskey alias, and environment variable expansion on the current input line (Ctrl+Alt+E).
  • Added some new completion commands:
    • glob-complete-word performs wildcard completion on the text before the cursor point, with a * implicitly appended (Alt+G).
    • glob-expand-word inserts all the wildcard completions that glob-list-expansions would list (Ctrl+X,*).
    • glob-list-expansions lists the possible wildcard completions of the text before the cursor point (Ctrl+X,g).
  • Added some command name synonyms for increased .inputrc file portability with bash:
    • alias-expand-line is a synonym for clink-expand-doskey-alias.
    • history-expand-line is a synonym for clink-expand-history.
    • history-and-alias-expand-line is a synonym for clink-expand-history-and-alias.
    • insert-last-argument is a synonym for yank-last-arg.
    • shell-expand-line is a synonym for clink-expand-line.
  • Added a match.expand_envvars Clink setting to expand environment variables in a word before performing completion (for mridgers #476).
  • Changed the match.wild Clink setting to apply to all completion commands.
  • Changed default key binding Ctrl+Alt+E to the clink-expand-line command (not the key binding expands everything, instead of only the env var at the cursor).
  • Removed default key binding Alt+Shift+H for the clink-show-help-raw command (it has only niche usefulness).
  • Removed unintended VI mode key binding Alt+Ctrl+H.
  • Fixed Ctrl+Shift+2 and Ctrl+Shift+6 (regression introduced in v1.1.39).
  • Fixed More? continuation prompt when pasting multiple lines.
  • Fixed /flag: and /flag= handling quirks, especially when trying to complete an environment variable in /flag:%env.
  • Fixed quirks about environment variable expansion in the clink-expand-env-var command and the os.expandenv() function.
clink - v1.2.24

Published by chrisant996 about 3 years ago

  • Added support for %CLINK_RPROMPT% to show a right side prompt, and for prompt filters to define a :rightfilter() function to filter the right side prompt.
  • Fixed clink-select-complete to not append a space after a flag that ends with : or = (e.g. /x:).
clink - v1.2.23

Published by chrisant996 over 3 years ago

This includes all of the planned features I had when I started updating Clink ten months ago. So there will be less frequent updates now, and I anticipate they will mostly be minor bug updates.

(Sorry, there were 2 minor bugs in v1.2.22 that I figured I may as well fix before Cmder picks up a next Clink version.)

What's new in v1.2.23:

  • Fixed PgUp and PgDn in the clink-select-complete command, under certain conditions where they don't navigate in the intended manner.
  • Cosmetic change: better key names for Enter vs Ctrl+M, and Alt+Bkspc vs Alt+Ctrl+H, depending on the terminal.differentiate_keys setting.
clink - v1.2.22

Published by chrisant996 over 3 years ago

This includes all of the planned features I had when I started updating Clink ten months ago. So there will be less frequent updates now, and I anticipate they will mostly be minor bug updates.

What's new in v1.2.22:

  • Added clink-what-is command bound by default to Alt+?, which shows the key binding for the next key sequence that is input.
  • Added rl.getargument() function to get the accumulated Readline numeric argument, if any. For use in "luafunc:" macros.
  • The clink-show-help command now categorizes key bindings and shows a description for the commands. Using a numeric argument can control whether categorization and descriptions are used.
  • Fixed invoking clink-select-complete while it is already active, so that it doesn't lose quotes around the current match if it has quotes.
  • Fixed clink-show-help to list "Enter" instead of "C-m" for the Enter key. Otherwise there's no way to differentiate between Enter and Ctrl+M when the terminal.differentiate_keys setting is enabled.
  • Fixed the insert-comment command, which accidentally fell back to inserting # after the first prompt (that's what bash inserts, and shouldn't be used in Clink).
  • Fixed the dump-functions command, which accidentally didn't list UTF8 key sequences correctly.
clink - v1.2.21

Published by chrisant996 over 3 years ago

  • Fixed backwards exit codes from clink autorun commands.
  • Fixed alert message text on startup when debug.log_terminal is set to true.
  • Fixed #143; crash on start when terminal.raw_esc is true (regression introduced in v1.2.19).
clink - v1.2.20

Published by chrisant996 over 3 years ago

  • Added os.debugprint() function to print debug text via the OS OutputDebugString() API.
  • Enabled match completion coloring even when using match display filtering.
  • Fixed input of slash and backslash in non-directory completions when using the clink-select-complete command.
  • Fixed match display filtering in the clink-select-complete command.
  • Fixed match display filtering in the clink-popup-complete command.
  • Fixed quirk from Readline where it sometimes displays one fewer columns of matches than actually fit on the screen.
clink - v1.2.19

Published by chrisant996 over 3 years ago

  • Added clink-select-complete command which shows an interactive list of possible completions.
  • Added terminal emulation for CGI G, CSI s, and CSI u sequences.
  • Fixed column alignment for match display filtering when some characters take more than one cell to display.
clink - v1.2.18

Published by chrisant996 over 3 years ago

v1.2.18

  • Added completions for clink installscripts and clink uninstallscripts.
  • Added support for Readline's coloring and marking of symlinks.
  • Fixed clink installscripts --help.
  • Fixed clink-popup-directories for directories with spaces.

⚠ Windows Defender is falsely detecting malware in the Clink installer; it has been reported to Windows Defender. ⚠

Workaround: in the meantime, try downloading the .zip file, as Windows Defender is happy with the Clink files themselves, just not with the installer program.

Note

Clink is nearing a point where it will switch to only bug-fix updates for a while.
There are only two remaining known upcoming changes:

  • Adding a clink-select-complete command that behaves similar to Ctrl+Space in Powershell (which will close #52).
  • Possibly a change to resolve #137 (cmd.auto_answer not working in German), depending on troubleshooting response.
clink - v1.2.17

Published by chrisant996 over 3 years ago

  • Added clink-popup-show-help command to show popup list with searchable list of key bindings and invoke the selected key binding.
  • Added clink.popuplist() function to show a popup list. Only usable from inside a "luafunc:" key binding.
  • Incremental search in the popup list window now centers the found item so items above and below it are visible.
  • Fixed potential internal error when a doskey alias starts with $ (regression introduced in v1.2.16).
  • Fixed potential infinite loop when the cmd.auto_answer setting is enabled but an error occurs while retrieving a language string (might be related to #137).
clink - v1.2.16

Published by chrisant996 over 3 years ago

  • Breaking Change: The clink.onendedit() Lua event has been split into two separate events:
    • clink.onendedit() registers a function to be called when the edit prompt ends.
    • clink.onfilterinput() registers a function to be called after the edit prompt ends (and after the onendedit event is sent), and the function can replace the input text.
  • Added rl.getkeybindings() function to get a table containing key bindings. The bindings can be invoked via rl.invokecommand(). For example, a "luafunc:" macro could use this to get key bindings, show an interactive list, and then invoke the selected key binding.
  • Fixed #134; print() can stop working. Issue #93 can potentially happen any time redirection is used, so the fix must be applied repeatedly (not just after Clink injection).
  • Fixed #119; reuse registered parsers for doskey macros.
clink - v1.2.15

Published by chrisant996 over 3 years ago

  • Fixed #132; multiline prompt gets overwritten when resizing the terminal width (regression introduced in v1.2.14).
clink - v1.2.14

Published by chrisant996 over 3 years ago

  • Automatically runs clink_start.cmd from the binaries directory and/or the profile directory when Clink is injected.
  • Clink is able to retrieve the last exit code for use by Lua scripts.
    • The new cmd.get_errorlevel setting is off by default, but when enabled it retrieves the last exit code from CMD before running Lua scripts.
    • The new os.geterrorlevel() function gets the last exit code (or 0 if the setting is off).
    • It works by running a hidden command line between each interactive prompt (as if you typed echo %errorlevel% yourself every second command you type). If you experience problems with this, turn it off.
  • Improved refreshing the input line when resizing the terminal window. It's better than before, but there's no way to make it work perfectly because Windows can resize the terminal further while a program is already trying to respond to the terminal having been resized previously.
  • Fixed #130; doskey alias completions stop working when there are many aliases.
clink - v1.2.13

Published by chrisant996 over 3 years ago

  • Added support for linking a parser to flags ending with : or =; now completion works for the flag's argument.