From 0c468f5947741c0583330535e62c361f3a6af5ed Mon Sep 17 00:00:00 2001 From: Victor Uriarte Date: Fri, 10 Jun 2016 18:53:15 -0700 Subject: Fix get_token_at_offset behavior at edge At position 6 (with an index starting at 0) it should have been on 2nd word for the example sql='select * from dual' --- sqlparse/sql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sqlparse/sql.py') diff --git a/sqlparse/sql.py b/sqlparse/sql.py index ced18af..a84dbf3 100644 --- a/sqlparse/sql.py +++ b/sqlparse/sql.py @@ -167,7 +167,7 @@ class TokenList(Token): idx = 0 for token in self.flatten(): end = idx + len(token.value) - if idx <= offset <= end: + if idx <= offset < end: return token idx = end -- cgit v1.2.1