Skip to content

Commit c34eb73

Browse files
authored
Merge pull request #2452 from daxgames/1.3.18
1.3.18
2 parents a66b8b3 + f7df79a commit c34eb73

File tree

8 files changed

+83
-151
lines changed

8 files changed

+83
-151
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
# Change Log
22

3-
## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23)
3+
## [1.3.18](https://github.com/cmderdev/cmder/tree/v1.3.18) (2021-3-26)
4+
5+
### Changes
46

7+
- Update to Clink 1.1.45 to fix #2451, #2465, and #2473
8+
- Update to ConEmu v21.03.04
9+
- `init.bat` auto migrates the history alias to use `clink history` if required.
10+
- Remove Tilde match from clink.lua in favor of builtin Clink capability.
11+
12+
## [1.3.17](https://github.com/cmderdev/cmder/tree/v1.3.17) (2020-12-23)
513
### Fixes
614

715
- [bug] Running `alias ..=cd ..` removes other aliases #2394

vendor/bin/alias.cmd

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ set alias_name=!alias_name:~1!
8181
:: trailing quotes added while validating
8282
set alias_value=!alias_value:~0,-1!
8383

84-
:: '.' escaped
85-
set alias_name_esc=!alias_name:.=\.!
86-
8784
::remove spaces
8885
set _temp=%alias_name: =%
8986

@@ -94,7 +91,7 @@ if not ["%_temp%"] == ["%alias_name%"] (
9491
)
9592

9693
:: replace already defined alias
97-
%WINDIR%\System32\findstr /v /i "^%alias_name_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
94+
%WINDIR%\System32\findstr /b /l /v /i "%alias_name%=" "%ALIASES%" >> "%ALIASES%.tmp"
9895
echo %alias_name%=%alias_value% >> "%ALIASES%.tmp" && type "%ALIASES%.tmp" > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
9996
doskey /macrofile="%ALIASES%"
10097
endlocal
@@ -103,10 +100,7 @@ exit /b
103100
:p_del
104101
set del_alias=%~1
105102

106-
:: '.' escaped
107-
set del_alias_esc=!del_alias:.=\.!
108-
109-
%WINDIR%\System32\findstr /v /i "^%del_alias_esc%=" "%ALIASES%" >> "%ALIASES%.tmp"
103+
%WINDIR%\System32\findstr /b /l /v /i "%del_alias%=" "%ALIASES%" >> "%ALIASES%.tmp"
110104
type "%ALIASES%".tmp > "%ALIASES%" & @del /f /q "%ALIASES%.tmp"
111105
doskey %del_alias%=
112106
doskey /macrofile="%ALIASES%"

vendor/clink.lua

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -406,24 +406,7 @@ local function svn_prompt_filter()
406406
return false
407407
end
408408

409-
local function tilde_match (text, f, l)
410-
if text == '~' then
411-
clink.add_match(clink.get_env('userprofile'))
412-
clink.matches_are_files()
413-
return true
414-
end
415-
416-
if text:sub(1, 1) == '~' then
417-
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1))
418-
-- second match prevents adding a space so we can look for more matches
419-
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+')
420-
clink.matches_are_files()
421-
return true
422-
end
423-
end
424-
425409
-- insert the set_prompt at the very beginning so that it runs first
426-
clink.register_match_generator(tilde_match, 1)
427410
clink.prompt.register_filter(set_prompt_filter, 1)
428411
clink.prompt.register_filter(hg_prompt_filter, 50)
429412
clink.prompt.register_filter(git_prompt_filter, 50)

vendor/clink_settings.default

Lines changed: 13 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,19 @@
1-
# name: Pressing Ctrl-D exits session
2-
# type: bool
3-
# Ctrl-D exits cmd.exe when it is pressed on an empty line.
4-
ctrld_exits = 1
5-
6-
# name: Toggle if pressing Esc clears line
7-
# type: bool
8-
# Clink clears the current line when Esc is pressed (unless Readline's Vi mode
9-
# is enabled).
10-
esc_clears_line = 1
11-
12-
# name: Match display colour
13-
# type: int
14-
# Colour to use when displaying matches. A value less than 0 will be the
15-
# opposite brightness of the default colour.
16-
match_colour = -1
17-
18-
# name: Executable match style
19-
# type: enum
20-
# 0 = PATH only
21-
# 1 = PATH and CWD
22-
# 2 = PATH, CWD, and directories
23-
# Changes how Clink will match executables when there is no path separator on
24-
# the line. 0 = PATH only, 1 = PATH and CWD, 2 = PATH, CWD, and directories. In
25-
# all cases both executables and directories are matched when there is a path
26-
# separator present. A value of -1 will disable executable matching completely.
27-
exec_match_style = 2
28-
29-
# name: Whitespace prefix matches files
30-
# type: bool
31-
# If the line begins with whitespace then Clink bypasses executable matching and
32-
# will match all files and directories instead.
33-
space_prefix_match_files = 1
34-
35-
# name: Colour of the prompt
36-
# type: int
37-
# Surrounds the prompt in ANSI escape codes to set the prompt's colour. Disabled
38-
# when the value is less than 0.
39-
prompt_colour = -1
40-
41-
# name: Auto-answer terminate prompt
42-
# type: enum
43-
# 0 = Disabled
44-
# 1 = Answer 'Y'
45-
# 2 = Answer 'N'
46-
# Automatically answers cmd.exe's 'Terminate batch job (Y/N)?' prompts. 0 =
47-
# disabled, 1 = answer 'Y', 2 = answer 'N'.
48-
terminate_autoanswer = 0
49-
50-
# name: Lines of history saved to disk
51-
# type: int
52-
# When set to a positive integer this is the number of lines of history that
53-
# will persist when Clink saves the command history to disk. Use 0 for infinite
54-
# lines and <0 to disable history persistence.
55-
history_file_lines = 10000
56-
57-
# name: Skip adding lines prefixed with whitespace
58-
# type: bool
59-
# Ignore lines that begin with whitespace when adding lines in to the history.
60-
history_ignore_space = 0
61-
62-
# name: Controls how duplicate entries are handled
63-
# type: enum
64-
# 0 = Always add
65-
# 1 = Ignore
66-
# 2 = Erase previous
67-
# If a line is a duplicate of an existing history entry Clink will erase the
68-
# duplicate when this is set 2. A value of 1 will not add duplicates to the
69-
# history and a value of 0 will always add lines. Note that history is not
70-
# deduplicated when reading/writing to disk.
71-
history_dupe_mode = 2
72-
73-
# name: Read/write history file each line edited
74-
# type: bool
75-
# When non-zero the history will be read from disk before editing a new line and
76-
# written to disk afterwards.
77-
history_io = 1
1+
# For explanation of these and other settings see:
2+
# https://chrisant996.github.io/clink/clink.html
783

794
# name: Sets how command history expansion is applied
805
# type: enum
81-
# 0 = Off
82-
# 1 = On
83-
# 2 = Not in single quotes
84-
# 3 = Not in double quote
85-
# 4 = Not in any quotes
86-
# The '!' character in an entered line can be interpreted to introduce words
87-
# from the history. This can be enabled and disable by setting this value to 1
88-
# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double,
89-
# or both quotes respectively.
90-
history_expand_mode = 3
91-
92-
# name: Support Windows' Ctrl-Alt substitute for AltGr
93-
# type: bool
94-
# Windows provides Ctrl-Alt as a substitute for AltGr, historically to support
95-
# keyboards with no AltGr key. This may collide with some of Readline's
96-
# bindings.
97-
use_altgr_substitute = 1
6+
# options: off,on,not_squoted,not_dquoted,not_quoted
7+
history.expand_mode = not_dquoted
988

99-
# name: Strips CR and LF chars on paste
100-
# type: enum
101-
# 0 = Paste unchanged
102-
# 1 = Strip
103-
# 2 = As space
104-
# Setting this to a value >0 will make Clink strip CR and LF characters from
105-
# text pasted into the current line. Set this to 1 to strip all newline
106-
# characters and 2 to replace them with a space.
107-
strip_crlf_on_paste = 2
9+
# name: Skip adding lines prefixed with whitespace
10+
# type: boolean
11+
history.ignore_space = False
10812

109-
# name: Enables basic ANSI escape code support
110-
# type: bool
111-
# When printing the prompt, Clink has basic built-in support for SGR ANSI escape
112-
# codes to control the text colours. This is automatically disabled if a third
113-
# party tool is detected that also provides this facility. It can also be
114-
# disabled by setting this to 0.
115-
ansi_code_support = 1
13+
# name: The number of history lines to save
14+
# type: integer
15+
history.max_lines = 10000
11616

17+
# name: Share history between instances
18+
# type: boolean
19+
history.shared = True

vendor/init.bat

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,39 @@ if "%CMDER_CLINK%" == "1" (
148148

149149
:: Run clink
150150
if defined CMDER_USER_CONFIG (
151-
if not exist "%CMDER_USER_CONFIG%\settings" (
152-
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
153-
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings"
154-
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
151+
if not exist "%CMDER_USER_CONFIG%\settings" if not exist "%CMDER_USER_CONFIG%\clink_settings" (
152+
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\clink_settings"
153+
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\clink_settings"
154+
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.
155+
)
156+
157+
REM Cleanup lagacy Clink Settings file
158+
if exist "%CMDER_USER_CONFIG%\settings" if exist "%CMDER_USER_CONFIG%\clink_settings" (
159+
del "%CMDER_USER_CONFIG%\settings"
160+
)
161+
162+
REM Cleanup legacy CLink history file
163+
if exist "%CMDER_USER_CONFIG%\.history" if exist "%CMDER_USER_CONFIG%\clink_history" (
164+
del "%CMDER_USER_CONFIG%\.history"
155165
)
156166
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
157167
) else (
158-
if not exist "%CMDER_ROOT%\config\settings" (
159-
echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
160-
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings"
168+
if not exist "%CMDER_ROOT%\config\settings" if not exist "%CMDER_ROOT%\config\clink_settings" (
169+
echo Generating clink initial settings in "%CMDER_ROOT%\config\clink_settings"
170+
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\clink_settings"
161171
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
162172
)
173+
174+
REM Cleanup lagacy Clink Settings file
175+
if exist "%CMDER_ROOT%\config\settings" if exist "%CMDER_ROOT%\config\clink_settings" (
176+
del "%CMDER_ROOT%\config\settings"
177+
)
178+
179+
REM Cleanup legacy Clink history file
180+
if exist "%CMDER_ROOT%\config\.history" if exist "%CMDER_ROOT%\config\clink_history" (
181+
del "%CMDER_ROOT%\config\.history"
182+
)
183+
163184
"%CMDER_ROOT%\vendor\clink\clink_%clink_architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
164185
)
165186
) else (
@@ -346,6 +367,13 @@ if "%CMDER_ALIASES%" == "1" (
346367
)
347368

348369
:: Add aliases to the environment
370+
type "%user_aliases%" | findstr /b /l /i "history=cat " >nul
371+
if "%ERRORLEVEL%" == "0" (
372+
echo Migrating alias 'history' to new Clink 1.x.x...
373+
call "%CMDER_ROOT%\vendor\bin\alias.cmd" /d history
374+
echo Restart the session to activate changes!
375+
)
376+
349377
call "%user_aliases%"
350378

351379
if "%CMDER_CONFIGURED%" gtr "1" goto CMDER_CONFIGURED

vendor/lib/lib_path.cmd

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,30 @@ exit /b
112112

113113
:end_enhance_path
114114
set "PATH=%PATH:;;=;%"
115-
if NOT "%OLD_PATH%" == "%PATH%" (
115+
116+
REM echo %path%|"C:\Users\dgames\cmder - dev\vendor\git-for-windows\usr\bin\wc" -c
117+
if "%fast_init%" == "1" exit /b
118+
119+
if not "%OLD_PATH:~0,3000%" == "%OLD_PATH:~0,3001%" goto :toolong
120+
if not "%OLD_PATH%" == "%PATH%" goto :changed
121+
exit /b
122+
123+
:toolong
124+
echo %OLD_PATH%>tempfileA
125+
echo %PATH%>tempfileB
126+
fc /b tempfileA tempfileB 2>nul 1>nul
127+
if errorlevel 1 ( del tempfileA & del tempfileB & goto :changed )
128+
del tempfileA & del tempfileB
129+
exit /b
130+
131+
:changed
116132
%print_debug% :enhance_path "END Env Var - PATH=%path%"
117133
%print_debug% :enhance_path "Env Var %find_query% - found=%found%"
118-
)
119-
set "position="
134+
exit /b
135+
120136
exit /b
121137

138+
122139
:set_found
123140
if "%ERRORLEVEL%" == "0" (
124141
set found=1

vendor/sources.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
},
77
{
88
"name": "clink",
9-
"version": "1.1.10",
10-
"url": "https://github.com/chrisant996/clink/releases/download/v1.1.10/clink.1.1.10.125c9f.zip"
9+
"version": "1.1.45",
10+
"url": "https://github.com/chrisant996/clink/releases/download/v1.1.45/clink.1.1.45.1c3985.zip"
1111
},
1212
{
1313
"name": "conemu-maximus5",
14-
"version": "191012",
15-
"url": "https://github.com/Maximus5/ConEmu/releases/download/v19.10.12/ConEmuPack.191012.7z"
14+
"version": "210304",
15+
"url": "https://github.com/Maximus5/ConEmu/releases/download/v21.03.04/ConEmuPack.210304.7z"
1616
},
1717
{
1818
"name": "clink-completions",

vendor/user_aliases.cmd.default

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ gl=git log --oneline --all --graph --decorate $*
99
ls=ls --show-control-chars -F --color $*
1010
pwd=cd
1111
clear=cls
12-
history=cat -n "%CMDER_ROOT%\config\.history"
1312
unalias=alias /d $1
1413
vi=vim $*
1514
cmderr=cd /d "%CMDER_ROOT%"

0 commit comments

Comments
 (0)