@@ -400,7 +400,7 @@ function! leetcode#ListProblems(refresh) abort
400400 let companies = topics_and_companies[' companies' ]
401401
402402 " concatenate the topics into a string
403- let topic_slugs = map (copy (topics), ' v:val["topic_slug"]' )
403+ let topic_slugs = map (copy (topics), ' v:val["topic_slug"] . ":" . v:val["num_problems"] ' )
404404 let topic_lines = s: FormatIntoColumns (topic_slugs)
405405
406406 call append (' $' , [' # LeetCode' , ' ' , ' ## Topics' , ' ' ])
@@ -409,7 +409,7 @@ function! leetcode#ListProblems(refresh) abort
409409 call append (' $' , topic_lines)
410410 let b: leetcode_topic_end_line = line (' $' )
411411
412- let company_slugs = map (copy (companies), ' v:val["company_slug"]' )
412+ let company_slugs = map (copy (companies), ' v:val["company_slug"] . ":" . v:val["num_problems"] ' )
413413 let company_lines = s: FormatIntoColumns (company_slugs)
414414
415415 call append (' $' , [' ' , ' ## Companies' , ' ' ])
@@ -445,6 +445,7 @@ function! s:HandleProblemListCR() abort
445445 if line_nr >= b: leetcode_topic_start_line &&
446446 \ line_nr < b: leetcode_topic_end_line
447447 let topic_slug = expand (' <cWORD>' )
448+ let topic_slug = <SID> TagName (topic_slug)
448449 if topic_slug != ' '
449450 call s: ListProblemsOfTopic (topic_slug, ' norefresh' )
450451 endif
@@ -454,6 +455,7 @@ function! s:HandleProblemListCR() abort
454455 if line_nr >= b: leetcode_company_start_line &&
455456 \ line_nr < b: leetcode_company_end_line
456457 let company_slug = expand (' <cWORD>' )
458+ let company_slug = <SID> TagName (company_slug)
457459 if company_slug != ' '
458460 call s: ListProblemsOfCompany (company_slug, ' norefresh' )
459461 endif
@@ -478,6 +480,29 @@ function! s:HandleProblemListCR() abort
478480 endif
479481endfunction
480482
483+ function ! s: TagName (tag )
484+ return substitute (a: tag , ' :\d*$' , ' ' , ' g' )
485+ endfunction
486+
487+ function ! s: GetProblem (id)
488+ for problem in b: leetcode_downloaded_problems
489+ if problem[' id' ] == a: id
490+ return problem
491+ endif
492+ endfor
493+ return {}
494+ endfunction
495+
496+ function ! s: ProblemIdFromNr (nr)
497+ let content = getline (a: nr )
498+ let items = split (content, ' |' )
499+ if len (items ) < 2
500+ return -1
501+ endif
502+ let strid = trim (items [1 ], ' ' )
503+ return strid
504+ endfunction
505+
481506function ! s: HandleProblemListR () abort
482507 if b: leetcode_buffer_type == # ' all'
483508 call leetcode#ListProblems (' redownload' )
0 commit comments