Skip to content

Commit 0e9faa4

Browse files
committed
fix(lua): pin 的 commit counter 從 0 開始
1 parent ebf8f31 commit 0e9faa4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

lua/moran_pin.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- moran_pin.lua
2-
-- version: 0.1.3
2+
-- version: 0.1.4
33
-- author: kuroame
44
-- license: GPLv3
55
-- You may copy, distribute and modify the software as long as you track
@@ -8,6 +8,7 @@
88
-- along with build & install instructions.
99

1010
-- changelog
11+
-- 0.1.4: make commit counter always start from 0
1112
-- 0.1.3: use C-- and C-= (C-+) to reorder candidates
1213
-- 0.1.2: add freestyle mode, add switch to enable/disable pin
1314
-- 0.1.1: simple configuration
@@ -160,14 +161,14 @@ function user_db.toggle_pin_status(input, cand_text)
160161
local pinned_res = pin_db:query(input .. sep_t)
161162
if pinned_res ~= nil then
162163
local key = input .. sep_t .. cand_text
163-
local max_commits = 0
164+
local max_commits = -1
164165
for k, v in pinned_res:iter() do
165166
local unpacked = user_db.unpack_entry(k, v)
166167
if unpacked then
167168
-- found existing entry here
168169
if key == k then
169170
-- if it's an active one, set its commit counter to -1 to tombstone it
170-
if unpacked.commits > 0 then
171+
if unpacked.commits >= 0 then
171172
user_db.tombstone(key)
172173
-- good to leave now
173174
return

0 commit comments

Comments
 (0)