A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/23c3f7f572d3a1f3816a9a9ae1b3632c53856923 below:

use changedir_func() in nvim_set_current_dir() · neovim/neovim@23c3f7f · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+28

-3

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+28

-3

lines changed Original file line number Diff line number Diff line change

@@ -31,6 +31,7 @@

31 31

#include "nvim/file_search.h"

32 32

#include "nvim/fileio.h"

33 33

#include "nvim/getchar.h"

34 +

#include "nvim/globals.h"

34 35

#include "nvim/highlight.h"

35 36

#include "nvim/highlight_defs.h"

36 37

#include "nvim/lua/executor.h"

@@ -545,20 +546,19 @@ void nvim_set_current_dir(String dir, Error *err)

545 546

return;

546 547

}

547 548 548 -

char string[MAXPATHL];

549 +

char_u string[MAXPATHL];

549 550

memcpy(string, dir.data, dir.size);

550 551

string[dir.size] = NUL;

551 552 552 553

try_start();

553 554 554 -

if (vim_chdir((char_u *)string)) {

555 +

if (!changedir_func(string, kCdScopeGlobal)) {

555 556

if (!try_end(err)) {

556 557

api_set_error(err, kErrorTypeException, "Failed to change directory");

557 558

}

558 559

return;

559 560

}

560 561 561 -

post_chdir(kCdScopeGlobal, true);

562 562

try_end(err);

563 563

}

564 564 Original file line number Diff line number Diff line change

@@ -536,6 +536,31 @@ describe('API', function()

536 536

end)

537 537

end)

538 538 539 +

describe('nvim_set_current_dir', function()

540 +

local start_dir

541 + 542 +

before_each(function()

543 +

clear()

544 +

funcs.mkdir("Xtestdir")

545 +

start_dir = funcs.getcwd()

546 +

end)

547 + 548 +

after_each(function()

549 +

helpers.rmdir("Xtestdir")

550 +

end)

551 + 552 +

it('works', function()

553 +

meths.set_current_dir("Xtestdir")

554 +

eq(funcs.getcwd(), start_dir .. helpers.get_pathsep() .. "Xtestdir")

555 +

end)

556 + 557 +

it('sets previous directory', function()

558 +

meths.set_current_dir("Xtestdir")

559 +

meths.exec('cd -', false)

560 +

eq(funcs.getcwd(), start_dir)

561 +

end)

562 +

end)

563 + 539 564

describe('nvim_exec_lua', function()

540 565

it('works', function()

541 566

meths.exec_lua('vim.api.nvim_set_var("test", 3)', {})

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4