Fix rtl sequences ending with fitzpatrick modifier

When sequence ends with skintone modifier, it would remain at
the end.

Example:

Input:   [128105, 127995, 8205, 129309, 8205, 128104, 127996]
Output:  [128104, 8205, 129309, 8205, 127995, 128105, 127996]
pull/282/head
Roel Nieskens 2019-10-03 09:10:59 +02:00
parent 833a43d032
commit ac638130b3
1 changed files with 4 additions and 1 deletions

View File

@ -228,7 +228,10 @@ def get_rtl_seq(seq):
rev_seq = list(seq) rev_seq = list(seq)
rev_seq.reverse() rev_seq.reverse()
for i in xrange(1, len(rev_seq)): starts_with_fp = is_fitzpatrick(rev_seq[0])
for i in range(1, len(rev_seq)):
if i == 2 and starts_with_fp:
continue
if is_fitzpatrick(rev_seq[i-1]): if is_fitzpatrick(rev_seq[i-1]):
tmp = rev_seq[i] tmp = rev_seq[i]
rev_seq[i] = rev_seq[i-1] rev_seq[i] = rev_seq[i-1]