diff plugins/hghelp/hghelp.vim @ 15:7edd5f6fe136

This is another test of commiting with the message this time
author Luka Sitas <lsitas@avatarasoftware.com>
date Tue, 02 Dec 2025 12:13:02 -0500
parents 6ee7fce1cba8
children 412c33afd395
line wrap: on
line diff
--- a/plugins/hghelp/hghelp.vim	Tue Dec 02 12:01:08 2025 -0500
+++ b/plugins/hghelp/hghelp.vim	Tue Dec 02 12:13:02 2025 -0500
@@ -69,7 +69,7 @@
   " Top window for file selection
   enew
   let b:hgcommit_type = 'filelist'
-  call setline(1, s:FormatHgStatusLines(l:lines))
+  call setline(1, l:lines)
   setlocal buftype=acwrite bufhidden=wipe nobuflisted noswapfile
   setlocal nomodifiable
   setlocal cursorline
@@ -85,7 +85,7 @@
   " Optional: initial comment
   call setline(1, ['# Enter commit message above. Lines starting with # are ignored.'])
   " Map to commit
-  nnoremap <silent> <buffer> <leader>cc :call <SID>DoHgCommit()<CR>
+  nnoremap <silent> <buffer> <leader>c :call <SID>DoHgCommit()<CR>
 
   " Go back to top window to start there
   wincmd k
@@ -191,6 +191,24 @@
   return l:files
 endfunction
 
+function! s:GetHgCommitMessage() abort
+  let l:msg_lines = []
+  for l:w in range(1, winnr('$'))
+    execute l:w . 'wincmd w'
+    if get(b:, 'hgcommit_type', '') ==# 'message'
+      " Get commit message lines, ignoring leading '#' lines
+      let l:all_lines = getline(1, '$')
+      let l:msg_lines = []
+      for l:L in l:all_lines
+        if l:L =~# '^#'
+          continue
+        endif
+        call add(l:msg_lines, l:L)
+      endfor
+    endif
+  endfor
+  return l:msg_lines
+endfunction
 
 function! s:DoHgCommit() abort
   if get(b:, 'hgcommit_type', '') !=# 'message'
@@ -206,16 +224,8 @@
     return
   endif
 
-  " Get commit message lines, ignoring leading '#' lines
-  let l:all_lines = getline(1, '$')
-  let l:msg_lines = []
-  for l:L in l:all_lines
-    if l:L =~# '^#'
-      continue
-    endif
-    call add(l:msg_lines, l:L)
-  endfor
 
+  let l:msg_lines = s:GetHgCommitMessage()
   let l:msg = join(l:msg_lines, "\n")
   if empty(l:msg)
     echohl ErrorMsg