@@ -527,7 +527,7 @@ function! s:HandleProblemListCR() abort
527527 let problem = s: GetProblem (problem_id)
528528 let problem_slug = problem[' slug' ]
529529 let problem_ext = s: SolutionFileExt (g: leetcode_solution_filetype )
530- let problem_file_name = printf (' [DESC] %s.%s.%s' , problem_id,
530+ let problem_file_name = printf (' %s.%s.%s' , problem_id,
531531 \ s: SlugToFileName (problem_slug),
532532 \ problem_ext)
533533
@@ -719,23 +719,23 @@ function! leetcode#ResetSolution(with_latest_submission) abort
719719 call add (output, s: CommentLine (filetype , line ))
720720 endfor
721721 call add (output, s: CommentEnd (filetype ))
722- call append (' $' , output )
722+ call append (' $' , code )
723723 silent ! normal ! gggqG
724724
725- let problem_ext = s: SolutionFileExt (g: leetcode_solution_filetype )
726- " TODO avoid recalculation of problem_ext twice
727- let problem_new_file_name = printf (' %s.%s.%s' , problem[' id' ], problem_slug, problem_ext)
728- if buflisted (problem_file_name)
729- execute bufnr (problem_new_file_name) . ' buffer'
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'
730728 return
731729 endif
732730
733- execute ' rightbelow new ' . problem_new_file_name
731+ execute ' leftabove ' . len (output). ' new ' . problem_desc_file_name
734732
735733
736- call append (' $' , code)
734+ call append (' $' , output)
735+ setlocal nomodifiable
737736
738737 silent ! normal ! ggdd
738+ execute ' wincmd j'
739739endfunction
740740
741741function ! s: CommentStart (filetype , title ) abort
0 commit comments