In current version of vim, when a new terminal instance is started, the cwd will be set to ~. On Linux, when there is the change of current working directory, the shell will notify the terminal by the OSC 7; command. Use this feature to chdir buffer's cwd to the shell's working directory.
https://github.com/vim/vim/pull/6290
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
This pull request introduces 1 alert when merging f012d10 into 3d9207a - view on LGTM.com
new alerts:
Merging #6290 (991d775) into master (52c124d) will decrease coverage by
0.09%.
The diff coverage is73.07%.
@@ Coverage Diff @@ ## master #6290 +/- ## ========================================== - Coverage 88.96% 88.87% -0.10% ========================================== Files 148 148 Lines 163329 161309 -2020 ========================================== - Hits 145302 143357 -1945 + Misses 18027 17952 -75
| Flag | Coverage Δ | |
|---|---|---|
| huge-clang-none | 86.10% <ø> (-1.89%) |
⬇️ |
| huge-gcc-none | 88.38% <73.07%> (+<0.01%) |
⬆️ |
| huge-gcc-testgui | 86.82% <73.07%> (-0.01%) |
⬇️ |
| huge-gcc-unittests | 2.49% <0.00%> (-0.01%) |
⬇️ |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/terminal.c | 90.69% <73.07%> (-0.26%) |
⬇️ |
| src/help.c | 89.76% <0.00%> (-1.08%) |
⬇️ |
| src/textobject.c | 91.69% <0.00%> (-0.71%) |
⬇️ |
| src/gui.c | 61.62% <0.00%> (-0.58%) |
⬇️ |
| src/ops.c | 91.80% <0.00%> (-0.57%) |
⬇️ |
| src/ex_cmds2.c | 90.68% <0.00%> (-0.54%) |
⬇️ |
| src/move.c | 93.58% <0.00%> (-0.54%) |
⬇️ |
| src/bufwrite.c | 76.47% <0.00%> (-0.53%) |
⬇️ |
| src/drawline.c | 84.49% <0.00%> (-0.47%) |
⬇️ |
| src/getchar.c | 85.72% <0.00%> (-0.46%) |
⬇️ |
| ... and 97 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered by Codecov. Last update 52c124d...991d775. Read the comment docs.
I do not see a change to the help files - what will the user experience?
Changing directories can have side effects. Perhaps it should be possible to disable this feature?
Or it should be disabled by default and only used when the user wants it?
I do not see a change to the help files - what will the user experience?
Changing directories can have side effects. Perhaps it should be possible to disable this feature?
Or it should be disabled by default and only used when the user wants it?
Thank you for the suggestion! Change applied.
@brammool glib provides g_filename_from_uri to convert a file URI to a path which is exactly what I need. Since vim (vim-tiny) isn't supposed to depend on glib, now I have two choices,
Which one do you prefer?
@k-takata commented on this pull request.
> @@ -4836,7 +4842,7 @@ A jump table for the options with a short description can be found at |Q_op|. The cursor is displayed at the start of the space a Tab character occupies, not at the end as usual in Normal mode. To get this cursor position while displaying Tabs with spaces, use: > - :set list lcs=tab:\ \ + :set list lcs=tab:\ \
The last space is intentional. Should not be removed.
> @@ -6802,7 +6808,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} String to put at the start of lines that have been wrapped. Useful values are "> " or "+++ ": > - :set showbreak=>\ + :set showbreak=>\
Same as above.
@coiby commented on this pull request.
> @@ -6802,7 +6808,7 @@ A jump table for the options with a short description can be found at |Q_op|. feature} String to put at the start of lines that have been wrapped. Useful values are "> " or "+++ ": > - :set showbreak=>\ + :set showbreak=>\
Thank you for spotting this issue! I removed it unintentionally because I set up vim to automatically remove trailing spaces. I''l send another patch to revert this change.
@coiby pushed 4 commits.
—
You are receiving this because you are subscribed to this thread.
@brammool It turns out we needn't to deal with all the corner cases listed in http://web.mit.edu/barnowl/src/glib/glib-2.16.3/tests/uri-test.c since we can assume the emitted OSC 7 escape sequence is correctly uri-encoded. If there's something wrong, whoever emits the OSC 7 escape sequence should take the responsibility. So the license issues have been resolved.
I've also fixed the test failure for FreeBSD. But there is one failed test on macos (huge, clang). Unfortunately, I don't have a Mac system to test on.
@LemonBoy commented on this pull request.
In src/terminal.c:
> +{
+ int offset = 7; // len of "file://" is 7
+ char *pos = (char *)frag->str + offset;
+
+ // remove HOSTNAME to get PWD
+ while (*pos != '/' && offset < frag->len) {
+ offset += 1;
+ pos += 1;
+ }
+
+ if (offset >= frag->len) {
+ semsg("Failed to extract PWD from %s, please check your shell's config related OSC 7", frag->str);
+ return;
+ }
+
+ char_u *new_dir = malloc(frag->len - offset + 1);
This variable should be declared at the top of the file, that'd fix the C2275 error on Appveyor.
@coiby commented on this pull request.
In src/terminal.c:
> +{
+ int offset = 7; // len of "file://" is 7
+ char *pos = (char *)frag->str + offset;
+
+ // remove HOSTNAME to get PWD
+ while (*pos != '/' && offset < frag->len) {
+ offset += 1;
+ pos += 1;
+ }
+
+ if (offset >= frag->len) {
+ semsg("Failed to extract PWD from %s, please check your shell's config related OSC 7", frag->str);
+ return;
+ }
+
+ char_u *new_dir = malloc(frag->len - offset + 1);
Thanks for providing the fix!
The name 'autochdirsh' is hard to read. How about making it 'autoshelldir' ?
Please use the Vim usual C code formatting. E.g. "} else {" is written in three lines.
"char buffer[3] = {src[i+1], src[i+2], 0};" I'm not sure all C90 compilers accept this.
You can use the hexhex2nr() function.
syn_cwd() should be renamed to sync_shell_dir().
The test should probably CheckNotBSD now.
@coiby pushed 6 commits.
—
You are receiving this because you are subscribed to this thread.
—
You are receiving this because you are subscribed to this thread.
For the change in parse_osc(), we should perhaps always recognize the code, but ignore it when p_asd is not set.
Or is the code dropped anyway when we don't recognize it?
For the change in parse_osc(), we should perhaps always recognize the code, but ignore it when p_asd is not set.
Or is the code dropped anyway when we don't recognize it?
Thank you for spotting this issue. Yes, to be consistent with OSC 52, it seems we should return 1 as long as osc 7 is recognized regardless of p_asd being set or not.
But at least right now, what's returned doesn't matter because string_fragment doesn't check what's returned according to https://github.com/vim/vim/blob/fa79be6b10e1d34fd697a56e85f6c0ce101f3d62/src/libvterm/src/parser.c#L76
static void string_fragment(VTerm *vt, const char *str, size_t len, int final) { ... switch(vt->parser.state) { case OSC: if(vt->parser.callbacks && vt->parser.callbacks->osc) (*vt->parser.callbacks->osc)(vt->parser.v.osc.command, frag, vt->parser.cbdata); break;
You need to adjust the #ifdef for hexhex2nr(). See test failures.
You need to adjust the #ifdef for hexhex2nr(). See test failures.
Thanks. I have used FEAT_AUTOSHELLDIR to enable hexhex2nr to fix this kind of test failures.
commit 4355894 ("patch 8.2.2627: no need to check for BSD after checking for not root") removed CheckNotBSD. What can I do to skip the tests for BSD (CheckNotRoot doesn't work)?
—
You are receiving this because you are subscribed to this thread.
Looks OK now. We don't need a feature for this, just check that the 'autoshelldir' option works.
—
You are receiving this because you are subscribed to this thread.
8b9abfd#r48888218
// should not recover to default value later?
not sure (or not understand) the user case of this change too much,
but the doc of this change mentioned to source '/etc/profile.d/vte.sh' (ubuntu20.04 is vte-2.91.sh), BTW: be careful to do this, this looks had bug or flaw, PROMPT_COMMAND="__vte_prompt_command" may overwrite your previous 'PROMOT_COMMAND', and if it was not login shell then maynot find '__vte_prompt_command', note the order or timing of/to 'source'......
8b9abfd#r48888218
// should not recover to default value later?
Do you mean there should be an "set noacd" after finishing the test?
not sure (or not understand) the user case of this change too much,
but the doc of this change mentioned to source '/etc/profile.d/vte.sh' (ubuntu20.04 is vte-2.91.sh), BTW: be careful to do this, this looks had bug or flaw,PROMPT_COMMAND="__vte_prompt_command"may overwrite your previous 'PROMOT_COMMAND', and if it was not login shell then maynot find '__vte_prompt_command', note the order or timing of/to 'source'......
Thanks! It seems I should have mentioned this issue in the doc which according to https://gitlab.gnome.org/GNOME/vte/-/issues/37 is still not resolved.
Looks OK now. We don't need a feature for this, just check that the 'autoshelldir' option works.
Thanks! I'm not sure I understand you correctly. Do you mean FEAT_AUTOSHELLDIR is not needed?