Fix a crash when detecting URLs continued onto multiple lines
Fixes #244
This commit is contained in:
parent
4621ff41d9
commit
7ed835cf13
@ -139,7 +139,7 @@ line_url_end_at(Line *self, index_type x, bool check_short) {
|
|||||||
index_type ans = x;
|
index_type ans = x;
|
||||||
if (x >= self->xnum || (check_short && self->xnum <= MIN_URL_LEN + 3)) return 0;
|
if (x >= self->xnum || (check_short && self->xnum <= MIN_URL_LEN + 3)) return 0;
|
||||||
while (ans < self->xnum && is_url_char(self->cells[ans].ch)) ans++;
|
while (ans < self->xnum && is_url_char(self->cells[ans].ch)) ans++;
|
||||||
ans--;
|
if (ans) ans--;
|
||||||
while (ans > x && can_strip_from_end_of_url(self->cells[ans].ch)) ans--;
|
while (ans > x && can_strip_from_end_of_url(self->cells[ans].ch)) ans--;
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
@ -618,4 +618,3 @@ copy_char(Line* self, PyObject *args) {
|
|||||||
COPY_CELL(self, src, to, dest);
|
COPY_CELL(self, src, to, dest);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -269,6 +269,9 @@ class TestDataTypes(BaseTest):
|
|||||||
no_url('http: //acme.com')
|
no_url('http: //acme.com')
|
||||||
no_url('http:/ /acme.com')
|
no_url('http:/ /acme.com')
|
||||||
|
|
||||||
|
l4 = create(' xxxxxtekljhgdkjgd')
|
||||||
|
self.ae(l4.url_end_at(0), 0)
|
||||||
|
|
||||||
def rewrap(self, lb, lb2):
|
def rewrap(self, lb, lb2):
|
||||||
hb = HistoryBuf(lb2.ynum, lb2.xnum)
|
hb = HistoryBuf(lb2.ynum, lb2.xnum)
|
||||||
cy = lb.rewrap(lb2, hb)
|
cy = lb.rewrap(lb2, hb)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user