make sure to update sort field when fields moved

This commit is contained in:
Damien Elmes 2012-07-19 15:16:08 +09:00
parent 779bcbef39
commit 9d153313e5

View file

@ -259,9 +259,13 @@ select id from cards where nid in (select id from notes where mid = ?)""",
oldidx = m['flds'].index(field) oldidx = m['flds'].index(field)
if oldidx == idx: if oldidx == idx:
return return
# remember old sort field
sortf = m['flds'][m['sortf']]
# move
m['flds'].remove(field) m['flds'].remove(field)
m['flds'].insert(idx, field) m['flds'].insert(idx, field)
m['sortf'] = idx # restore sort field
m['sortf'] = m['flds'].index(sortf)
self._updateFieldOrds(m) self._updateFieldOrds(m)
self.save(m) self.save(m)
def move(fields, oldidx=oldidx): def move(fields, oldidx=oldidx):