mirror of
https://github.com/soywod/himalaya.git
synced 2024-09-29 04:31:11 +00:00
vim: fix extracting message ids from list (#247)
The current method doesn't work because the list uses a fancy line character (`│`) as the separator, not a regular pipe character (`|`). Matching for the first number in the line instead solves the problem and will continue to work regardless of what separator is used.
This commit is contained in:
parent
ae31f48bb5
commit
aae7b5a310
|
@ -326,9 +326,13 @@ function! s:bufwidth()
|
||||||
return width - numwidth - foldwidth - signwidth
|
return width - numwidth - foldwidth - signwidth
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:get_msg_id(line)
|
||||||
|
return matchstr(a:line, '[0-9]*')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:get_focused_msg_id()
|
function! s:get_focused_msg_id()
|
||||||
try
|
try
|
||||||
return s:trim(split(getline("."), "|")[0])
|
return s:get_msg_id(getline("."))
|
||||||
catch
|
catch
|
||||||
throw "message not found"
|
throw "message not found"
|
||||||
endtry
|
endtry
|
||||||
|
@ -336,7 +340,7 @@ endfunction
|
||||||
|
|
||||||
function! s:get_focused_msg_ids(from, to)
|
function! s:get_focused_msg_ids(from, to)
|
||||||
try
|
try
|
||||||
return join(map(range(a:from, a:to), "s:trim(split(getline(v:val), '|')[0])"), ",")
|
return join(map(range(a:from, a:to), "s:get_msg_id(getline(v:val))"), ",")
|
||||||
catch
|
catch
|
||||||
throw "messages not found"
|
throw "messages not found"
|
||||||
endtry
|
endtry
|
||||||
|
|
Loading…
Reference in a new issue