-
Notifications
You must be signed in to change notification settings - Fork 9
Major fixes, among them windows file handling #44
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,11 +178,11 @@ def on_stderr(job_id, err_msg): | |
pickle.dump(arguments, f) | ||
|
||
if sudo: | ||
Vim.AsyncRun('sudo {} {} {}'.format(self.ServerCmd, cmd, fname), | ||
Vim.AsyncRun('sudo {} {} {}'.format(self.ServerCmd, cmd, fname).replace('\\','\\\\'), | ||
on_exit=on_exit, | ||
term=True) | ||
else: | ||
Vim.AsyncRun('{} {} {}'.format(self.ServerCmd, cmd, fname), | ||
Vim.AsyncRun('{} {} {}'.format(self.ServerCmd, cmd, fname).replace('\\','\\\\'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
on_stderr=on_stderr, | ||
on_exit=on_exit) | ||
|
||
|
@@ -197,6 +197,7 @@ def mv(self, src_arr, dst, sudo=False, on_exit=None): | |
|
||
@classmethod | ||
def cp(self, src_arr, dst, sudo=False, on_exit=None): | ||
print("uuu",src_arr,dst) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove. |
||
self.exec_server_cmd('cp', | ||
on_exit, { | ||
'src': src_arr, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,6 +406,8 @@ def abbrev_cwd(self, width): | |
if len(res) <= width: | ||
return res.ljust(width) | ||
|
||
res=res.replace('\\','/') #windows | ||
|
||
sp = res.split('/') | ||
szm1 = len(sp) - 1 | ||
total = 2 * (szm1) + len(sp[-1]) | ||
|
@@ -418,6 +420,7 @@ def abbrev_cwd(self, width): | |
return '/'.join(sp).ljust(width) | ||
else: | ||
total += len(sp[i]) - 1 | ||
return res[-1 * width:] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suppose we never reach this point. Did you encounter any issue or did you see lsp warning? If it's the later, maybe it's ok to just return res? |
||
|
||
def redraw_header_content(self): | ||
self._header_node.name = self.abbrev_cwd(self.winwidth).strip() | ||
|
@@ -856,16 +859,16 @@ def _close_last_previewee(self): | |
return | ||
|
||
if is_DIR: | ||
Vim.command(f'{win_nr}hide') | ||
Vim.command(f'silent! {win_nr}hide') | ||
else: | ||
if Vim.eval(f'getbufvar({bufnr}, "&buftype")') == 'terminal': | ||
Vim.command(f'bwipeout! {bufnr}') | ||
Vim.command(f'silent! bwipeout! {bufnr}') | ||
elif Vim.eval(f'getbufvar({bufnr}, "&modified")') == '1': | ||
Vim.command(f'{win_nr}hide') | ||
Vim.command(f'silent! {win_nr}hide') | ||
elif len(Vim.eval(f'win_findbuf({bufnr})')) > 1: | ||
Vim.command(f'{win_nr}hide') | ||
Vim.command(f'silent! {win_nr}hide') | ||
else: | ||
Vim.command(f'bwipeout! {bufnr}') | ||
Vim.command(f'silent! bwipeout! {bufnr}') | ||
|
||
def preview_on(self): | ||
""" Turn preview panel on. """ | ||
|
@@ -1091,9 +1094,33 @@ class Netranger(object): | |
1. BufEnter: on_bufenter. create/update NetRangerBuf. | ||
2. CursorMoved: on_cursormoved. update node highlighting and some othe stuff. | ||
""" | ||
def generate_and_ret_buf(self): | ||
bufname = Vim.current.buffer.name | ||
if len(bufname) > 0 and bufname[-1] == '~': | ||
bufname = os.path.expanduser('~') | ||
if not os.path.isdir(bufname): | ||
return | ||
if os.path.islink(bufname): | ||
bufname = os.path.join(os.path.dirname(bufname), | ||
os.readlink(bufname)) | ||
bufname = os.path.abspath(bufname) | ||
|
||
# if self.buf_existed(bufname): | ||
# self._bufs[Vim.current.buffer.number] = self._wd2bufnum[bufname] | ||
# else: | ||
self.gen_new_buf(bufname) | ||
|
||
return self._bufs[Vim.current.buffer.number] | ||
|
||
|
||
|
||
|
||
@property | ||
def cur_buf(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you elaborate what issues you encountered. We already have a a gen_new_buf function called by on_bufenter, which should guarantee that all call to |
||
return self._bufs[Vim.current.buffer.number] | ||
if Vim.current.buffer.number in self._bufs: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you encounter a key not found error here? |
||
return self._bufs[Vim.current.buffer.number] | ||
else: | ||
return self.generate_and_ret_buf() | ||
|
||
@property | ||
def cur_node(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to put the replace in Vim.AsyncRun