Skip to content

Commit ee56135

Browse files
committed
Adjust the order of opening the desc window and generating the desc
1 parent 6495b2f commit ee56135

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

autoload/leetcode.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,12 @@ def _echoerr(s):
767767
print(s)
768768

769769

770-
def _unescape_with_Chinese(code) :
770+
def _unescape_with_Chinese(code):
771771
for ch in set(re.findall(r'\\u\w{4}', code)):
772772
code = code.replace(ch, ch.encode('utf-8').decode('unicode_escape'))
773-
log.info("code is %s", code)
774773
return code.splitlines()
775774

776775

777776

778-
779777
task_thread = Thread(target=_thread_main, daemon=True)
780778
task_thread.start()

autoload/leetcode.vim

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,14 @@ function! leetcode#ResetSolution(with_latest_submission) abort
705705
endif
706706

707707
silent! normal! ggdG
708+
call append('$', code)
709+
silent! normal! ggdd
710+
711+
let problem_desc_file_name = printf('[DESCRIPTION] %s.%s', problem['id'], problem_slug)
712+
if buflisted(problem_desc_file_name)
713+
execute bufnr(problem_desc_file_name) . 'buffer'
714+
return
715+
endif
708716

709717
let output = []
710718
call add(output, s:CommentStart(filetype, problem['title']))
@@ -719,24 +727,16 @@ function! leetcode#ResetSolution(with_latest_submission) abort
719727
call add(output, s:CommentLine(filetype, line))
720728
endfor
721729
call add(output, s:CommentEnd(filetype))
722-
call append('$', code)
723-
silent! normal! gggqG
724-
725-
let problem_desc_file_name = printf('[DESCRIPTION] %s.%s', problem['id'], problem_slug)
726-
if buflisted(problem_desc_file_name)
727-
execute bufnr(problem_desc_file_name) . 'buffer'
728-
return
729-
endif
730730

731731
execute 'leftabove '. len(output). 'new ' . problem_desc_file_name
732-
733-
734732
call append('$', output)
733+
silent! normal! ggdd
734+
silent! normal! gggqG
735+
735736
setlocal nomodifiable
736737
setlocal buftype=nofile
737738
setlocal nospell
738739

739-
silent! normal! ggdd
740740
execute 'wincmd j'
741741
endfunction
742742

0 commit comments

Comments
 (0)